本文主要是介绍基于ROS-Melodic版本的AUBO-i5基础环境搭建,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
基于ROS-Melodic版本的AUBO-i5基础环境搭建
- 一、创建aubo_ws工作空间
- 二、下载AUBO的功能包源码
- 三、配置功能包的环境变量
- 四、编译前的配置
- 五、编译
- 六、运行
版本:Ubuntu 18.04 ROS Melodic
一、创建aubo_ws工作空间
- 创建文件夹
mkdir -p ~/aubo_ws/src
- 编译
- 目的:将
普通文件夹
转变成ROS的工作空间
。注意路径! - 成功标志:
~/aubo_ws/src
文件夹包含CMakeLists.txt
cd ~/aubo_ws
catkin_make
二、下载AUBO的功能包源码
- 将
功能包
放到工作空间下的src目录
cd ~/aubo_ws/src
- 获取源码 -
melodic
版本
git clone https://github.com/AuboRobot/aubo_robot -b melodic
三、配置功能包的环境变量
- 目的:在任意终端,都可以运行功能包的文件
- 打开
.bashrc
文件
sudo gedit ~/.bashrc
- 将该行放到
.bashrc
文件中,并保存
source ~/aubo_ws/devel/setup.bash
- 验证是否添加成功。
- 一定要重新开个终端,打印出
ROS_PACKAGE_PATH
变量值 - 成功标志:环境变量的值包含功能包的位置
~/aubo_ws/src
即可。
echo $ROS_PACKAGE_PATH
四、编译前的配置
- 通过rosdep安装源码依赖(比较费时)
cd ~/aubo_ws/src
rosdep install -y --from-paths . --ignore-src --rosdistro melodic -r
成功标志
- 修改系统eigen3软链接
在任何目录下,都可以
sudo ln -sf /usr/include/eigen3/Eigen/ /usr/include/Eigen
sudo ln -sf /usr/include/eigen3/unsupported/ /usr/include/unsupported
- 安装
libprotobuf9
如何目录,都可,看自己习惯。
- 方式一:
wget http://archive.ubuntu.com/ubuntu/pool/main/p/protobuf/libprotobuf9v5_2.6.1-1.3_amd64.deb
sudo dpkg -i libprotobuf9v5_2.6.1-1.3_amd64.deb
- 方式二:
如果wget
下载失败,可以采用下面的方法。 - 将
http://archive.ubuntu.com/ubuntu/pool/main/p/protobuf/libprotobuf9v5_2.6.1-1.3_amd64.deb
输入到【浏览器搜索框】中 - 回车(保存.deb文件)
- 使用
dpkg
完成.deb的安装
sudo dpkg -i libprotobuf9v5_2.6.1-1.3_amd64.deb
- 安装所需软件
- 将安装软件的命令,全部放到
deps.sh
文件中,一步执行。就无需一个一个sudo apt install
安装了 - 放到
aubo_robot
功能包下
cd ~/aubo_ws/src/aubo_robot
- 创建
.sh
文件
touch deps.sh
- 打开
deps.sh
文件
sudo gedit deps.sh
- 将安装软件的命令,全部放到
deps.sh
文件中,一步执行。就无需一个一个sudo apt install
安装了。deps.sh
文件的内容:
sudo apt install -y ros-melodic-moveit*
sudo apt install -y ros-melodic-moveit-visual-tools
sudo apt install -y ros-melodic-industrial-*sudo apt install -y ros-melodic-gazebo-ros
sudo apt install -y ros-melodic-gazebo-plugins
sudo apt install -y ros-melodic-gazebo-ros-control
sudo apt install -y ros-melodic-joint-state-controller
sudo apt install -y ros-melodic-position-controllers
sudo apt install -y ros-melodic-joint-trajectory-controllersudo apt install -y ros-melodic-gazebo-ros-control
sudo apt install -y ros-melodic-moveit-simple-controller-manager
sudo apt install -y ros-melodic-rviz-visual-tools
sudo apt install -y ros-melodic-moveit-visual-tools
- 执行依赖文件(也挺费时)
sh deps.sh
- 更新
Moveit_core_lib
- 位置
/home/xiao/aubo_ws/src/aubo_robot/UpdateMoveitLib/Kinetic
- 打开
Update.sh
文件。将kinect
改为melodic
- 进入Update.sh文件的路径下,执行下面两条命令:
chmod +x Update.sh
sudo ./Update.sh
- lib库环境变量配置
该部分参考遨博协作机器人ROS开发 - ROS Melodic环境搭建与测试
- 进入aubo sdk库的路径
roscd aubo_driver/lib/lib64/
-
pwd
命令,打印当前文件夹绝对路径- 笔者的是:
/home/xiao/aubo_ws/src/aubo_robot/aubo_driver/lib/lib64
- 笔者的是:
-
新建
ldconfig
配置文件
sudo gedit /etc/ld.so.conf.d/aubo_driver.conf
- 将库的路径拷贝到文件中,保存后退出
/home/xiao/aubo_ws/src/aubo_robot/aubo_driver/lib/lib64
/home/xiao/aubo_ws/src/aubo_robot/aubo_driver/lib/lib64/aubocontroller
/home/xiao/aubo_ws/src/aubo_robot/aubo_driver/lib/lib64/config
/home/xiao/aubo_ws/src/aubo_robot/aubo_driver/lib/lib64/log4cplus
- 使新建的
aubo_driver.conf
配置文件生效
sudo ldconfig
五、编译
如果上面操作完成,编译不会报错。
cd ~/aubo_ws
catkin_make
- 报错:
/usr/bin/ld: cannot find -lindustrial_robot_client
- /usr/bin/ld: cannot find -lindustrial_robot_client
collect2: error: ld returned 1 exit status
aubo_ggcnn_gazebo/aubo_ggcnn_gazebo/robot/aubo_robot/aubo_controller/CMakeFiles/aubo_joint_trajectory_action.dir/build.make:129: recipe for target ‘/home/xiao/catkin_ws/devel/lib/aubo_controller/aubo_joint_trajectory_action’ failed
- /usr/bin/ld: cannot find -lindustrial_robot_client
- 原因:industrial-robot-client 包没安装
- 解决:为避免其他错误,我安装了
ros-melodic-industrial-*
sudo apt remove ros-melodic-industrial-*
- 解决:为避免其他错误,我安装了
六、运行
- 运行moveit仿真
roslaunch aubo_i5_moveit_config moveit_planning_execution.launch robot_ip:=127.0.0.1
- 报错1
- [ERROR] [1676803133.388400621]: PluginlibFactory: The plugin for class ‘moveit_rviz_plugin/MotionPlanning’ failed to load. Error: Failed to load library /opt/ros/melodic/lib/libmoveit_motion_planning_rviz_plugin.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string:
Could not load library (Poco exception = libmoveit_robot_trajectory.so.0.9.15: cannot open shared object file: No such file or directory)
- [ERROR] [1676803133.388400621]: PluginlibFactory: The plugin for class ‘moveit_rviz_plugin/MotionPlanning’ failed to load. Error: Failed to load library /opt/ros/melodic/lib/libmoveit_motion_planning_rviz_plugin.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string:
- 原因1:
- /opt/ros/melodic/lib/目录下只有libmoveit_robot_trajectory.so.1.0.11,libmoveit_robot_model.so.1.0.11,libmoveit_robot_state.so.1.0.11三个文件,没有
0.9.15
文件
- /opt/ros/melodic/lib/目录下只有libmoveit_robot_trajectory.so.1.0.11,libmoveit_robot_model.so.1.0.11,libmoveit_robot_state.so.1.0.11三个文件,没有
- 解决1
-
- 知识点补充 -> 复制
cp a b
(a为旧的,b为新的) ;修改mv a b
(a为旧的,b为新的)
- 知识点补充 -> 复制
-
- 需要先查看自己
/opt/ros/melodic/lib/
目录下3个文件的版本号,我的是1.0.11
,根据自己的修改一下
- 需要先查看自己
-
- 感谢该作者!!!
-
- 操作:这样写显得有些占地方,但是为方便大家一行一行复制。
- (1)将
1.0.11
3个文件复制到/opt/ros/melodic/
目录下
cd /opt/ros/melodic/lib
sudo cp -r libmoveit_robot_trajectory.so.1.0.11 ..
sudo cp -r libmoveit_robot_model.so.1.0.11 ..
sudo cp -r libmoveit_robot_state.so.1.0.11 ..
- (2)将
/opt/ros/melodic/
目录下的1.0.11
3个文件的后缀改为0.9.15
cd ..
sudo mv libmoveit_robot_trajectory.so.1.0.11 libmoveit_robot_trajectory.so.0.9.15
sudo mv libmoveit_robot_model.so.1.0.11 libmoveit_robot_model.so.0.9.15
sudo mv libmoveit_robot_state.so.1.0.11 libmoveit_robot_state.so.0.9.15
- (3)将
/opt/ros/melodic/
目录下0.9.15
3个文件复制到/opt/ros/melodic/lib/
目录下
sudo cp -r libmoveit_robot_trajectory.so.0.9.15 lib/
sudo cp -r libmoveit_robot_model.so.0.9.15 lib/
sudo cp -r libmoveit_robot_state.so.0.9.15 lib/
-
搞定啦!
好吧,rviz可以正常显示,但是无法规划机械臂运动。。。
-
报错2:
- [ERROR] [1676810486.905088528]: spline start
[move_group-6] process has died [pid 8463, exit code -11, cmd /opt/ros/melodic/lib/moveit_ros_move_group/move_group __name:=move_group __log:=/home/xiao/.ros/log/b20c85f6-b052-11ed-94df-845cf3931fde/move_group-6.log].
log file: /home/xiao/.ros/log/b20c85f6-b052-11ed-94df-845cf3931fde/move_group-6*.log
- 原因:move_group出错,导致rviz里面无法规划路径。
- 解决:卸载moveit 重新装。再更新软件列表。
sudo apt remove ros-melodic-moveit*
sudo apt install ros-melodic-moveit*
- [ERROR] [1676810486.905088528]: spline start
这回真的搞定了!
这篇关于基于ROS-Melodic版本的AUBO-i5基础环境搭建的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!