系统:Ubuntu16.04
ROS kinetic源码编译记录
1.安装引导依赖关系
sudo apt-get install python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential
2.初始化rosdep
sudo rosdep init
rosdep update
注:如果init和update出错使用手机网络共享更新
3.创建catkin工作空间
mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws
4.ROS-Comm包安装(ROS package, build, and communication libraries. No GUI tools)
rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
wstool init -j8 src kinetic-ros_comm-wet.rosinstall
5.解析依赖
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y
6.编译catkin工作空间
./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
melodic版本编译出现的问题及解决方法
1>出现 error: ‘nullptr’ was not declared in this scope
解决方法:在./src/ros_comm/rosbag/CMakeLists.txt和./src/ros_comm/rosbag_storage/CMakeLists.txt两个文件中加入编译选项 -std=c++11
2>出现“ROS_DISTRO was set to ‘melodic’ before. Please make sure that the environment does not mix paths from different distributions.”
解决方法:由于之前编译了melodic版本导致编译kinetic版本环境配置产生冲突,使用env |grep ros也看不到对应的环境变量设置,就把之前编译melodic版本的工作路径改变了,编译kinetic版本正常了。(i下下策)
7.环境配置
写入.bashrc脚本
echo "source ~/ros_catkin_ws/install_isolated/setup.bash" >> ~/.bashrc
source ~/.bashrc
ROS源码安装kinetic版本
最新推荐文章于 2023-07-25 15:09:56 发布