• NVIDIA Jetson TX2 安装ORB-SLAM3 ROS 错误总结


    背景:
    NVIDIA Jetson TX2 用RealSense T265 跑 ORB-SLAM3 ros
    下载:

    git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git
    
    • 1

    这时 Examples 里面没有ROS

    ├── Examples
    │   ├── Calibration
    │   ├── Monocular
    │   ├── Monocular-Inertial
    │   ├── REAMDME.md
    │   ├── RGB-D
    │   ├── RGB-D-Inertial
    │   ├── Stereo
    │   └── Stereo-Inertial
    ├── Examples_old
    │   ├── Monocular
    │   ├── Monocular-Inertial
    │   ├── REAMDME.md
    │   ├── RGB-D
    │   ├── RGB-D-Inertial
    │   ├── ROS
    │   ├── Stereo
    │   └── Stereo-Inertial
    ...
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    参考 https://github.com/UZ-SLAMLab/ORB_SLAM3/issues/442
    将Examples_old文件夹下ROS文件夹复制到Examples文件夹下

    sudo jtop
    
    • 1

    在这里插入图片描述jetson TX2 刷机时,OpenCV 4.1.1 已安装,可以用这个版本的
    修改 xxx/ORB_SLAM3/CMakeLists.txt

    find_package(OpenCV 4.1.1)
       if(NOT OpenCV_FOUND)
          message(FATAL_ERROR "OpenCV > 4.4 not found.")
       endif()
    
    • 1
    • 2
    • 3
    • 4

    还有 xxx/ORB_SLAM3/Examples/ROS/ORB_SLAM3/CMakeLists.txt

    find_package(OpenCV 4.1.1 QUIET)
    if(NOT OpenCV_FOUND)
       find_package(OpenCV 2.4.3 QUIET)
       if(NOT OpenCV_FOUND)
          message(FATAL_ERROR "OpenCV > 2.4.3 not found.")
       endif()
    endif()
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    错误1. No module named ‘rospkg’

    File "/opt/ros/melodic/share/rosunit/cmake/../scripts/test_results_dir.py", line 43, in <module>
        import rospkg
    ModuleNotFoundError: No module named 'rospkg'
    CMake Error at /opt/ros/melodic/share/ros/core/rosbuild/public.cmake:356 (message):
      Failed to invoke
      '/opt/ros/melodic/share/rosunit/cmake/../scripts/test_results_dir.py'
    Call Stack (most recent call first):
      CMakeLists.txt:4 (rosbuild_init)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    当前在 conda base 环境中,Python 3.9.7

    $ conda env list
    # conda environments:
    #
    base                  *  /home/wx/newdisk/3rdparty/mambaforge
    imu_b9                   /home/wx/newdisk/3rdparty/mambaforge/envs/imu_b9
    
    • 1
    • 2
    • 3
    • 4
    • 5

    退出conda base 环境

    conda deactivate
    
    • 1

    此时:

    $ pip list
    Package                       Version
    ----------------------------- -------------------
    ...
    rosparam                      1.14.12
    rospkg                        1.3.0
    rospy                         1.14.12
    rosservice                    1.14.12
    rostest                       1.14.12
    rostopic                      1.14.12
    rosunit                       1.14.9
    roswtf                        1.14.12
    ...
    rtabmap-ros                   0.20.18
    rviz                          1.13.21
    ...
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    错误2. fatal error: sophus/se3.hpp: No such file or directory

    ImuTypes.h:29:10: fatal error: sophus/se3.hpp: No such file or directory
     #include 
              ^~~~~~~~~~~~~~~~
    compilation terminated.
    CMakeFiles/MonoAR.dir/build.make:198: recipe for target 'CMakeFiles/MonoAR.dir/src/AR/ViewerAR.cc.o' failed
    make[2]: *** [CMakeFiles/MonoAR.dir/src/AR/ViewerAR.cc.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    参考:在ubuntu18.04系统上使用ROS跑ORB-SLAM3时遇到的问题总结
    xxx/Examples/ROS/ORB_SLAM3/CMakeLists.txtinclude_directories

    ${PROJECT_SOURCE_DIR}/../../../Thirdparty/Sophus
    
    • 1

    如下:

    include_directories(
    ${PROJECT_SOURCE_DIR}
    ${PROJECT_SOURCE_DIR}/../../../
    ${PROJECT_SOURCE_DIR}/../../../include
    ${PROJECT_SOURCE_DIR}/../../../include/CameraModels
    ${PROJECT_SOURCE_DIR}/../../../Thirdparty/Sophus
    ${Pangolin_INCLUDE_DIRS}
    )
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    错误3. error: conversion from ‘Sophus::SE3f {aka Sophus::SE3}’ to non-scalar type ‘cv::Mat’ requested

    /home/wxf/newdisk/ros/ORB_SLAM3/Examples/ROS/ORB_SLAM3/src/AR/ros_mono_ar.cc:151:41: error: conversion from ‘Sophus::SE3f {aka Sophus::SE3<float>}’ to non-scalar type ‘cv::Mat’ requested
         cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());
                       ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • 1
    • 2
    • 3

    参考:buildros.sh

    错误4. error while loading shared libraries: libpango_core.so

    error while loading shared libraries: libpango_core.so: cannot open shared object file: No such file or directory
    
    • 1

    参考 error while loading shared libraries: libpango_windowing.so: cannot open shared object file: No such

     sudo ldconfig
    
    • 1

    错误5. Gtk-Message: 14:43:08.216: Failed to load module “canberra-gtk-module”

    Gtk-Message: 14:43:08.216: Failed to load module "canberra-gtk-module"
    
    • 1

    参考:解决 Failed to load module canberra-gtk-module

    sudo apt-get install libcanberra-gtk-module
    
    • 1
  • 相关阅读:
    (Python) Python语音处理工具包AudioSegment的基本使用
    【C++11】函数的可变参数模板
    学习笔记-GO安全
    1、Elasticsearch集群种类
    【C++String类使用】万字详解保姆级教学,手把手教你使用string类。
    力扣:153. 寻找旋转排序数组中的最小值(Python3)
    imedicallis命令的背后
    idea2018 编译打包报错java.lang.StackOverflowError
    golang 控制并发有两种经典方式:WaitGroup 和 Context
    跟着江南一点雨学习springmvc(2)
  • 原文地址:https://blog.csdn.net/weixin_40378209/article/details/126793843