总结起来如下:主要是驱动、权限、网口配置、bashrc文件配置,网线等这几个方面,可靠连接,软件和硬件为基础,结合起来才能够起作用
一、驱动
驱动的话现在主要是youbot_driver_ros_interface这个包,但是它依赖与youbot_driver和youbot_description这两个
sudo apt-get install ros-indigo-youbot-driver-ros-interface ros-indigo-youbot-description
1、youbot_driver: 个人理解是就是KUKA公司youbot这款机器人的底层函数也可叫做API 也可叫youbot的原生驱动,如何在你的ubuntu装这个youbot_driver,请参考官网 http://www.youbot-store.com/wiki/index.php/Youbot_driver这种方式是装在系统的/opt/ros/indigo/share下的,推荐这种方式。
2、youbot_driver_ros_interface:个人理解就是ROS去调用youbot_driver的一个封装过程,便于我们用ROS的那一套去控制youbot,这个可以叫做youbot在ROS中的驱动,这个是建立在youbot的原生驱动驱动上的,这个在roubot_driver装好后,就可以装了,如何装?请参考官网:http://www.youbot-store.com/wiki/index.php/ROS_Wrapper
二、权限
安装完毕以后,还需要给普通用户赋予网络通信的权限,不然无论怎么换网口,改变ethecat的配置都会can not find slave on eth*的。
sudo setcap cap_net_raw+ep /opt/ros/indigo/lib/youbot_driver_ros_interface/youbot_driver_ros_interface
在youbot的官网也有提到这个http://www.youbot-store.com/wiki/index.php/ROS_Wrapper
sudo ldconfig /opt/ros/indigo/lib
三、网口设置
在终端中输入ifconfig 就可以看到的网口编号,看看你的第一个编号是多少,然后修改youbot-ethercat.cfg这个文件,这个文件在youbot_driver文件夹中的config文件夹中,我的路径是 /opt/ros/indigo/share/youbot_driver/config,我的youbot-ethercat.cfg文件内容如下:
[EtherCAT]EthernetDevice = eth0
EtherCATUpdateRate_[usec] = 1000EtherCATTimeout_[usec] = 500 #timeout value in us for tx frame to return to rx
MaximumNumberOfEtherCATErrors = 100MailboxTimeout_[usec] = 200
BaseJointControllerName = TMCM-174BaseJointControllerNameAlternative = TMCM-1632
ManipulatorJointControllerName = TMCM-KR-841ManipulatorJointControllerNameAlternative = TMCM-1610
四、bashrc文件配置
打开bashrc文件: $ gedit ~/.bashrc 我的最后几行这是这样的:export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/opt/ros/indigo/share:/opt/ros/indigo/stacks:~/catkin_ws/src export YOUBOT_CONFIG_FOLDER_LOCATION=/opt/ros/indigo/share/youbot_driver/config/
source ~/catkin_ws/devel/setup.bash source /opt/ros/indigo/setup.bash
这两个source要注意顺序,一般放在最后的才起作用,我的情况是,我的youbot驱动都放在系统的opt中的,而我的程序包放在本地的catkin_ws文件下的。所以当我要启动驱动时,要把下面这句放在最后source /opt/ros/indigo/setup.bash
当我要跑程序,编译我的包时,我得把下面这句放在最后,不然它就找不到我的包
source ~/catkin_ws/devel/setup.bash
如果那位大神能有什么解决办法,可以给我留言五、youbot机器人上面怎么插网线的
我的机器人网线连接:EtherCAT1连接我的电脑,EtherCAT0连接的底座
网线怎么插,该插哪个口,请参考官网:http://www.youbot-store.com/wiki/index.php/Controlling_youBot_from_external_PC
六、官网的解决方案:点击
最后提醒:当用外部电脑通过网线控制youbot时,最好不要开启youbot自带的PC