2018年12月9日日曜日
rosdep in Linux mint tara(ubuntu18.04)
ERROR: Rosdep cannot find all required resources to answer your query Missing resource moveit_sample ROS path [0]=/opt/ros/melodic/share/ros ROS path [1]=/opt/ros/melodic/share ROS path [2]=/home/harumo/catkin_ws/src/industrial_core/industrial_core ROS path [3]=/home/harumo/catkin_ws/src/industrial_core/industrial_deprecated ROS path [4]=/home/harumo/catkin_ws/src/industrial_core/industrial_msgs ROS path [5]=/home/harumo/catkin_ws/src/industrial_core/industrial_trajectory_filters ROS path [6]=/home/harumo/catkin_ws/src/industrial_core/industrial_utils ROS path [7]=/home/harumo/catkin_ws/src/motoman/motoman ROS path [8]=/home/harumo/catkin_ws/src/motoman/motoman_gp12_support ROS path [9]=/home/harumo/catkin_ws/src/motoman/motoman_gp7_support ROS path [10]=/home/harumo/catkin_ws/src/motoman/motoman_gp8_support ROS path [11]=/home/harumo/catkin_ws/src/motoman/motoman_mh12_support ROS path [12]=/home/harumo/catkin_ws/src/motoman/motoman_mh50_support ROS path [13]=/home/harumo/catkin_ws/src/motoman/motoman_mh5_support ROS path [14]=/home/harumo/catkin_ws/src/motoman/motoman_motomini_support ROS path [15]=/home/harumo/catkin_ws/src/motoman/motoman_msgs ROS path [16]=/home/harumo/catkin_ws/src/motoman/motoman_sda10f_moveit_config ROS path [17]=/home/harumo/catkin_ws/src/motoman/motoman_sda10f_support ROS path [18]=/home/harumo/catkin_ws/src/motoman/motoman_sia10d_support ROS path [19]=/home/harumo/catkin_ws/src/motoman/motoman_sia10f_support ROS path [20]=/home/harumo/catkin_ws/src/motoman/motoman_sia20d_moveit_config ROS path [21]=/home/harumo/catkin_ws/src/motoman/motoman_sia20d_support ROS path [22]=/home/harumo/catkin_ws/src/motoman/motoman_sia5d_support ROS path [23]=/home/harumo/catkin_ws/src/moveit_sample ROS path [24]=/home/harumo/catkin_ws/src/ros_start ROS path [25]=/home/harumo/catkin_ws/src/sia20 ROS path [26]=/home/harumo/catkin_ws/src/industrial_core/simple_message ROS path [27]=/home/harumo/catkin_ws/src/industrial_core/industrial_robot_client ROS path [28]=/home/harumo/catkin_ws/src/industrial_core/industrial_robot_simulator ROS path [29]=/home/harumo/catkin_ws/src/motoman/motoman_driver ROS path [30]=/home/harumo/catkin_ws/src/urdf_start
とか,あるいは下記のようなもの
ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies: motoman_driver: Cannot locate rosdep definition for [roslint] motoman_gp7_support: Cannot locate rosdep definition for [roslaunch] motoman_sia10f_support: Cannot locate rosdep definition for [roslaunch] industrial_core: Cannot locate rosdep definition for [industrial_trajectory_filters] urdf_start: No definition of [gazebo] for OS version [] motoman_sia10d_support: Cannot locate rosdep definition for [roslaunch] motoman_mh50_support: Cannot locate rosdep definition for [roslaunch] motoman_sda10f_moveit_config: Cannot locate rosdep definition for [xacro] industrial_trajectory_filters: Cannot locate rosdep definition for [orocos_kdl] ros_start: Cannot locate rosdep definition for [std_msgs] motoman_mh12_support: Cannot locate rosdep definition for [roslaunch] my_moveit: Cannot locate rosdep definition for [trajectory_msgs] industrial_utils: Cannot locate rosdep definition for [rosunit] motoman_motomini_support: Cannot locate rosdep definition for [roslaunch] industrial_robot_simulator: Cannot locate rosdep definition for [roslaunch] industrial_msgs: Cannot locate rosdep definition for [message_runtime] motoman_mh5_support: Cannot locate rosdep definition for [roslaunch] motoman_sda10f_support: Cannot locate rosdep definition for [roslaunch] industrial_robot_client: Cannot locate rosdep definition for [rosunit] motoman_msgs: Cannot locate rosdep definition for [trajectory_msgs] sia20: No definition of [gazebo] for OS version [] motoman_sia20d_support: Cannot locate rosdep definition for [roslaunch] industrial_deprecated: Cannot locate rosdep definition for [catkin] motoman: Cannot locate rosdep definition for [motoman_sia5d_support] motoman_gp12_support: Cannot locate rosdep definition for [roslaunch] motoman_sia20d_moveit_config: Cannot locate rosdep definition for [xacro] motoman_sia5d_support: Cannot locate rosdep definition for [roslaunch] simple_message: Cannot locate rosdep definition for [rosunit] motoman_gp8_support: Cannot locate rosdep definition for [roslaunch]
そういうときは,このコマンド.
(catkin_wsに移動してから下記のコマンドを打ってくださいね)
rosdep install --from-paths src --ignore-src --rosdistro melodic -y --os=ubuntu:bionic
2017年6月20日火曜日
atomでtexを自動更新する環境を作成(ubuntu,mint)
2017年4月20日木曜日
自作ライブラリをCMakeでディレクトリごとインストールする方法
自作ライブラリをCMakeでディレクトリごとインストールする方法
春先は送迎会などで諭吉が吹き飛んでいくのが悲しい限りです. ああ,諭吉よ.どうしてあなたは行ってしまったのですか. それはさておき, githubとかで自作ライブラリを公開するときに CMakeつかってビルドして/usr/local/lib/にインストールする方法を紹介しますね.
まず,今回はSonyの開発した人類の永遠の友であるPS3のコントローラーをlinuxで簡単に使用できるライブラリを作ったので,それをドヤ顔してgithubに公開してやろうかと思ったところ,opencvとかのように
sudo make install
とかやると, /usr/local/inculde/と /usr/local/lib/ にいい感じにインストールされる方法がわからなかったときのメモであぞよ.
というわけで,どうすればいいかお教えしましょう. まず,本日の生け贄... 本日のメインディッシュはdualshockという名前のライブラリとなっております.
構成
本日の構成は
dualshock|-CMakeLists.txt|-READEME.md|-example--testDs3.cpp|-include--dualshock--ds3.cpp|-src--ds3.cpp
となっております.というか,こんな感じのディレクトリ構成にしてください.多少は意味があります.
CMakeLists.txt
CMakeLists.txtは以下のように記述すること.
cmake_minimum_required(VERSION 3.5)project(dualshock)add_definitions("-std=c++11")set(SRC_DIR src)set(INCLUDE_DIR include/dualshock)include_directories(${INCLUDE_DIR})add_library(dualshock STATIC ${SRC_DIR}/ds3.cpp)target_link_libraries(dualshock pthread)install( TARGETS dualshockRUNTIME DESTINATION binLIBRARY DESTINATION libARCHIVE DESTINATION lib)install(DIRECTORY include/dualshockDESTINATION /usr/local/include)
ポイント
この場合,ファイル構成は綺麗になるが,ヘッダーと実装ファイルの 関係をどのように定義するのかが問題となる.
コンパイル時と,インストール後に使用するときとでは, それらの関係が異なるのである.
具体的には,cppファイルでどのようにヘッダーをincludeするのかということである.
でも,よく考えると,ヘッダーのincludeはコンパイルの時にのみ必要になる.ということは,インストールするときさえ乗り切れば,あとは,どうとでもなる.ということ.よって,ds3.cppのinclude部分をちょっとかえる.
FROM
#include "ds3.hpp"
ライブラリ内のヘッダーを参照するようにincludeのパスを変更する.
TO
#include "../include/dualshock/ds3.hpp"
結果
これを実行すると /usr/local/include 以下に /dualshock/ds3.hpp
/usr/local/lib/ 以下に libdualshock.a
がインストールされる.
2017年3月23日木曜日
TUTの学内LANにVPNで接続する方法
george washington.vpn.***.**.**
2017年3月1日水曜日
YouCompleteMeをNeoVimでインストールしようとしたらハマった話.
$ pip3 install neovim
$ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:neovim-ppa/unstable $ sudo apt-get update
$ sudo apt-get install neovim
$ mkdir -p ~/.config/nvim
neovimではvimrcのかわりにinit.vimを使用するので~/.bashrcに
export XDG_CONFIG_HOME="$HOME/.config/nvim"
を書き込んでおく.書き込んだ後,source ~/.bashrcを実行するのもわすれずにここでポイント!!!!
vimrcのdein.vimで管理しているプラグインの中でdein.vimとYouConpleteMeのプラグイン以外のプラグインを全部コメントアウトする.これは非常に重要である.どれくらい重要かというと...ちょっと想像できません.ご了承ください.
vimrcの中身を~/.config/nvim/init.vimに書き写す.
そのあと,deinをインストール
$ mkdir -p ~/.vim/dein/repos/github.com/Shougo/dein.vim $ git clone https://github.com/Shougo/dein.vim.git ~/.vim/dein/repos/github.com/Shougo/dein.vim
そしてnvimをたちあげると,もしくは:call dein#install()すると
deinとyoucompeltemeがインストールされます.
あとは,YouCompleteMeをコンパイルするだけなので
$ cd .vim/dein.vim/repos/github.com/Valloric/YouCompleteMe/
とする.君のシステムにすでにあるclangを使わないように!
要求するバージョンはclang3.9以上なのだとある!
...最新(2017-03-01)じゃん.
これで,YouCompleteMeは復活し,私の威厳は保たれた.おしまい.
重要なところは,init.vimのなかのdeinとyoucompleteme以外のプラグインをコメントアウト
したことで,再インストールとか全消去とかは必要あるかどうかはわかりません.
コメントアウトだけで復活するかも知れません.
2017年1月19日木曜日
c++11でliboctave
C++11でliboctave
liboctaveとは
前々から,やってみたかったのだが,簡単に数値計算をc++でできるliboctaveを導入してみた.
ていうか,matlabってあるじゃん.あの,お値段がとてつもなく高い数値計算用ソフト.あのお値段では,叶姉妹ぐらいのファビュラスなお金持ちでないと使うことができないのでは無いだろうか.いや,そうに違いない.
しかし,私は,お金持ちではないので創意工夫でどうにかするしか無い.そこでliboctaveである.matlabのコードがそのまま動くと言われているくらいmatlabにそっくりなoctaveっていう数値解析ソフトが存在し,それはc++11で実装されている.したがって,octaveを構成しているライブラリをc++11の自分のプログラムから呼び出すことが可能なのである.
Let’s 数値計算
環境は以下のとおりである
- Ubuntu16.04(Linux mintの信者をやめたわけではない)
- Cmake
- LLVN Clang
さあ,パーティーの時間だ!!
$ sudo apt-get install octave liboctave-dev
$ sudo ldconfig
さあ,お片付けの時間だ!!
以下のようなテスト用のサンプルプログラムを用意します.
#include <iostream>
//#include </usr/local/include/octave-4.2.0/octave/config.h>
//octave-4.2.0ぐらいからはconfig.hはいらないらしい.コンパイラに怒られた.\(^o^)/
#include </usr/local/include/octave-4.2.0/octave/Matrix.h>
using namespace std;
int main(int argc, char**argv)
{
Matrix A(2,3), B(2,2,1.0);
ColumnVector x(3), y(2), z(2);
for(int r(0); r<2; ++r)
for(int c(0); c<3; ++c)
A(r,c) = r+c;
for(int r(0); r<3; ++r) x(r)=(r+1.0)*2.0;
for(int r(0); r<2; ++r) y(r)=(r+1.0)*r;
z = B*(A*x+y);
cout<<"A="<<endl;
cout<<A;
cout<<"B="<<endl;
cout<<B;
cout<<"x= "<<x.transpose()<<endl;
cout<<"y="<<y.transpose()<<endl;
cout<<"z="<<z.transpose()<<endl;
return 0;
}
コンパイルは以下の感じで
clang++ -std=c+=11 test.cpp -loctave
Cmakeを使うときは以下の感じで
cmake_minimum_required(VERSION 3.5)
project(test)
add_executable(test test.cpp)
target_link_libraries(test octave)
結果は以下な感じざんす
A=
0 1 2
1 2 3
B=
1 1
1 1
x= 2 4 6
y= 0 2
z= 46 46
なんと言うことでしょう.
あの憎きmatlabと同等の環境を手に入れてしまった.ふはは.
何と言う高揚感!
まあ,当然のごとく,こういったことには先人がいて,わたしはコピーしただけなんだけどね.
どんなことができるかはここを見る
2016年7月10日日曜日
YouCompleteMeでPython future のエラーが出て補完できない!
突然クラッシュしていうことにゃ
YouCompleteMe unavailable: This package should not be accessible on Python 3. Ei
ther you are trying to run from the python-future src folder or your installatio
n of python-future is corrupted.
あなたの元をわたしは去らねばならなくなりました.
わたしは,あなたのコーディングを手助けしてきましたが,とうとうお別れの時がきました.
今日のような日が訪れることは以前からわかっていました.あの,パイソン3がやってきたのです.
わたしはパイソン2.7やっていけますが,3とは相容れることができません.
おごれるものも久しからず,ただ春の夜の夢のごとし.さようなら.(意訳)