Ubuntu18.04下成功实现ORB_SLAM2 奥比中光astra深度相机

   在ROS环境下,采用奥比中光的Astra深度相机,复现ORB_SLAM2代码,真的太难了,不过csdn上有好多大佬,纯纯地靠大佬们带飞,基本上我是参照这篇博客使用奥比中光Orbbec Astra Pro在ROS下跑orb_slam2_梁小憨憨的博客-CSDN博客来实现的,博主写的超级详细,简直是搞视觉SLAM小白的福音。所以针对我在实现ORB_SLAM2过程中存在的问题做个简单整理:

一、在ROS melodic环境下安装奥比中光相机驱动

1、按照参考的博客开始安装,到run astra_camera这步时,深度图可以看到,彩色图像显示“NO image”,应该是相机接口的问题,我试了他的解决方法,好像还是有问题,然后就去一顿搜索。

(1)首先查看相机接口:

lsusb

可以查阅到:

Bus 001 Device 019: ID 2bc5:0502 # RGB模块
Bus 001 Device 018: ID 2bc5:0403 # 深度模块

(2)接着修改Astrapro.launch

cd  ~/home/wsy/robot_positioning_ws/src/astra_camera/launch
gedit astrapro.launch

改为如下所示:(只改RGB模块)

 

source一下:

 source ~/rgbd_ws/devel/setup.bash

 再次运行:

 roslaunch astra_camera astrapro.launch

二、安装ORB_SLAM2

按照步骤一步步来,直到实时运行ORB_SLAM2在编译的时候出现问题了:

./build_ros.sh

运行完之后会出现一堆错误,按照这篇Ubuntu18.04 编译 ORB-SLAM2(./build.sh + ./build_ros.sh)完整流程,各种报错处理(踩坑总结)_m0_60355964的博客-CSDN博客_./build_ros.sh

1、解决部分问题,但是有个“'sudo rosdep init' and 'rosdep update'”问题困扰很久:

[rosbuild] Building package ORB_SLAM2
Failed to invoke /opt/ros/noetic/bin/rospack deps-manifests ORB_SLAM2
[rospack] Error: the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'


CMake Error at /opt/ros/noetic/share/ros/core/rosbuild/public.cmake:129 (message):
  

  Failed to invoke rospack to get compile flags for package 'ORB_SLAM2'.
  Look above for errors from rospack itself.  Aborting.  Please fix the
  broken dependency!

Call Stack (most recent call first):
  /opt/ros/noetic/share/ros/core/rosbuild/public.cmake:207 (rosbuild_invoke_rospack)
  CMakeLists.txt:4 (rosbuild_init)


-- Configuring incomplete, errors occurred!
See also "/home/liuxinze/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found.  Stop.

 按照如下步骤进行终端输入:

sudo -H pip3 install rosdepc
sudo rosdepc init
rosdepc update

参考:orb_slam2编译 ./build_ros.sh出现问题 很久没办法解决 请大家帮个忙谢谢!-编程语言-CSDN问答

 

2、还遇到了“Pangolin could not be found because dependency Eigen3 could not be found”的问题。

问题报错如下:
 

CMake Error at CMakeLists.txt:25 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/Pangolin/PangolinConfig.cmake

  but it set Pangolin_FOUND to FALSE so package "Pangolin" is considered to
  be NOT FOUND.  Reason given by package:

  Pangolin could not be found because dependency Eigen3 could not be found.

-- Configuring incomplete, errors occurred!
See also "/home/dongying/study/ManhattanSLAM/build/CMakeFiles/CMakeOutput.log".
See also "/home/dongying/study/ManhattanSLAM/build/CMakeFiles/CMakeError.log".
Makefile:940: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1

 参照博客:Pangolin could not be found because dependency Eigen3 could not be found._复古蓝的博客-CSDN博客

解决方法如下:
在CMakeLists.txt文件下修改,CMakeLists.txt文件路径为:

/home/wsy/工作空间/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2

 找到find_package(Eigen3 3.1.0 REQUIRED)并进行以下修改:

find_package(Eigen3 REQUIRED NO_MODULE)

这样问题就解决的差不多了,可以正常运行了。

你可能感兴趣的:(机器人,自动驾驶,人工智能)