红联Linux门户
Linux帮助

Ubuntu14.04系统下安装ros_barrett_package教程

发布时间:2016-08-29 10:13:18来源:linux网站作者:信雪神话
备注:
安装记录:环境通用pc平台,i3,i5及amd的处理器计算机上都试过。操作系统ubuntu14.04+ros indigo。
 
1、ros安装完成后,sudo rosdep init做环境的初始化。
rosdep update
echo “source /opt/ros/indigo/setup.bash”>>~/.bashrc
source ~/.bashrc
 
2、从网站下载及解压各种包
http://wiki.ros.org/barrett_hand
http://wiki.ros.org/libpcan
https://github.com/ipa320/cob_extern
https://github.com/RobotnikAutomation/pcan_python
http://www.peak-system.com/fileadmin/media/linux/index.htm
驱动如未安装成功也可以先安装BHand package。从GitHub下载相应的package(注:教程用的indigo 64版本,所以下载了相应的 ”barrett_hand-indigo-devel”安装包)
Ubuntu14.04系统下安装ros_barrett_package教程
2.1、按照常规方法来安装ros package,需要先创建一个工作空间,然后用ros提供的catkin_make命令来安装package,以下为安装步骤:
创建catkin工作空间:用户名robot,具体的路径和用户名相关。
$ mkdir -p home/robot/catkin_bhand/src
$ catkin_init_workspace
$ cd catkin_bhand/
$ catkin_make
$ sourcecatkin_bhand/devel/setup.bash
PS:
该句话最好加在.bashrc中,否则可能会出现
error:can’t load。。。have you “make” in []
$ cp -r /home/robot/Downloads/barrett_hand-indigo-devel/home/robot/catkin_bhand/src/
$ catkin_make
(注:重新创建工作空间后需要用source命令临时设置环境变量,不然会提示找不到相应的命令。Setup.bash的路径/命令如下)
$ source home/robot/catkin_ws/devel/setup.bash
2.2、安装BHand_package下各功能包的方法:
在安装好解压barrett_hand-indigo-devel之后,工作空间中会有以下文件夹:
进入到每个包目录下,分别对其进行编译,安装:
$ cd catkin_bhand/src/barrett_hand-indigo-devel/
$ cd barrett_hand/
$ cmake CMakeLists.txt
$ make
$ sudo make install
$ cd bhand_controller/
$ sudo python setup.py install
$ cmake CMakeLists.txt
$ make
$ sudo make install
PS:
ImportError: No module namedgenmsg
忽略错误,继续下一步
$ cd rqt_bhand/
$ sudo python setup.py install  
$ cmake CMakeLists.txt
$ make
$ sudo make install
 
3、Pcan驱动安装方法
解压cob_extern-hydro_dev文件,并运行:
$ cd home/exbot/Downloads/cob_extern-indigo_dev/libpcan/
$ camke CMakeLists.txt
$ make
ps:需要联网,下载了某些东西,要出现fatal error: popt.h: No such fileor directory
$ sudo make install
PS:
$sudo make install
make[3]: rospack: Command not found
Makefile.tarball:10:/download_unpack_build.mk: No such file or directory
make[3]: *** No rule to maketarget `/download_unpack_build.mk'. Stop.
make[2]: ***[CMakeFiles/build_libpcan] Error 2
make[1]: ***[CMakeFiles/build_libpcan.dir/all] Error 2
make: *** [all] Error 2
忽略错误,继续下一步
之后会生成一些文件夹,其中包括了‘build’文件夹。
回到之前下载及解压文件的目录下,Peak-linux-driver-7.15.2为CAN转USB设备的驱动,不能直接安装,需要将其更名并移动到下面的路径:
$ cp –r peak-linux-driver-7.15.2/home/exbot/Download/cob_extern-hydro_dev/libpcan/build/ peak-linux-driver-7.9
(cob_extern-indigo_dev的MakeFile文件中默认的Peak-linux-driver版本为7.9)
然后运行.sh脚本进行,.安装驱动:
$sudo ./install_pcan.sh
PS:
insmod: ERROR: could not insertmodule pcan.ko: Unknown symbol in module
忽略错误,继续下一步
接着手动加载驱动:
$ modprobe pcan
查询
ls –l /dev/pcan*
若此时插入pcan则可检测到pcanusb0
 
4、编译 _pcan_module.so模块,进入到pcan_python-master文件夹下,然后:
$ apt-get install swig
$ cd home/exbot/Downloads/pcan_python-master
$ make
PS:
fatal error: libpcan.h :No suchfile directory
solution:第3步没有完全编译通过,重新复制解压出来后改名的的peak-linux-driver-7.9到build文件夹下,重新执行3中步骤。
$ sudo make install
详见:https://github.com/RobotnikAutomation/pcan_python
 
5、通过launch文件登陆各节点
Ubuntu14.04系统下安装ros_barrett_package教程
例,Bhand_controller节点
节点中包含的can口设备信息:
Ubuntu14.04系统下安装ros_barrett_package教程
 
6、启动服务/运行方式:
$cd /home/exbot/catkin_bhand/src/barrett_hand-hydro-devel/bhand_controller/devel
$source setup.bash
$export PYTHONPATH=/home/exbot/Downloads/pcan_python-master/lib/:$PYTHONPATH
ps:最好将该语句加入到.bashrc中,否则会提示找不到pcan_python module
$roslaunch bhand_controller bhand_controller.launch
PS:
ERROR: cannot launch node of type[bhand_controller/bhand_node.py]: can't locate node [bhand_node.py] in package[bhand_controller]
solution:重新删除工作空间,重新建立。
新开一个命令行:
$rosservice call /bhand_node/actions “action: 1”
此时node便会连接机器人完成初始化,然后将灵巧手指移动到初始位置。调用后回复True才代表初始化成功,否则多尝试两次,不返还true则证明配置不正确。
PS:
若出现error:can’t load[] Have you “make” in []
将 source home/robot/catkin_bhand/devel/setup.bash添加到.bashrc重新开终端运行
Note:其它一些可能会用到的命令:
$ sudo apt-get –f install
$ sudo apt-get install swig
1. installpyyaml:  (http://pyyaml.org/wiki/PyYAMLDocumentation) 
1.1 wgethttp://pyyaml.org/download/pyyaml/PyYAML-3.01.tar.gz 
1.2 tar zxvf PyYAML-3.01.tar.gz 
1.3 cd PyYAML-3.01 && python setup.pyinstall
 
本文永久更新地址:http://www.linuxdiyf.com/linux/23707.html