ros下编译orb-slam2

在/home/jyyang/catkin_ws/src/ORB-SLAM2_with_line-master/Examples/ROS/ORB_SLAM2下

mkdir build
cd build
cmake ..
make -j3

若遇报错:

Traceback (most recent call last):
File “/opt/ros/kinetic/share/ros/core/rosbuild/bin/check_same_directories.py”, line 46, in
raise Exception
Exception
CMake Error at /opt/ros/kinetic/share/ros/core/rosbuild/private.cmake:102 (message):
[rosbuild] rospack found package “ORB_SLAM2_PointMap_SegNetM” at “”, but
the current directory is
“/home/xxx/catkin_ws/src/DS-SLAM/Examples/ROS/ORB_SLAM2_PointMap_SegNetM”.
You should double-check your ROS_PACKAGE_PATH to ensure that packages are
found in the correct precedence order.
执行:

sudo gedit ~/.bashrc

在文件最后加:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/...自己的路径../catkin_ws/src/DS-SLAM/Examples/ROS/ORB_SLAM2_PointMap_SegNetM

然后保存运行

source ~/.bashrc

检查ros环境路径是否添加成功

echo $ROS_PACKAGE_PATH

返回

xx@xxxxxxxxx:~$ echo $ROS_PACKAGE_PATH
/opt/ros/melodic/share:/home/cs/catkin_ws/src/DS-SLAM/Examples/ROS/ORB_SLAM2_PointMap_SegNetM

则成功!

若遇报错:

/usr/bin/ld: CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o: undefined reference to symbol ‘_ZN5boost6system1

解决方案:编辑CMakelists文件加入:

ros下编译orb-slam2_第1张图片

 

你可能感兴趣的:(机器人)