• Xavier(8):Xavier使用速腾聚创激光雷达运行a-loam算法部分报错与解决方案



    在这里插入图片描述
    左边是a-loam效果,右边是激光雷达点云。
    本机使用Nvidia xavier镜像,为ubuntu18.04、ros-melodic、opencv4
    a-loam经过简单的源码修改可以适用于opencv4.x

    1 速腾聚创激光雷达驱动

    报错:Project ‘cv_bridge’ specifies ‘/usr/include/opencv’ as an include dir

    CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message):
      Project 'cv_bridge' specifies '/usr/include/opencv' as an include dir,
      which is not found.  It does neither exist as an absolute directory nor in
      '${{prefix}}//usr/include/opencv'. 
    
    • 1
    • 2
    • 3
    • 4

    参考:https://blog.csdn.net/qq_53627591/article/details/126116822
    原因是:NVIDIA xaiver的镜像image自带的是opencv4版本,下面把opencv命名成了opencv4
    sudo gedit /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake
    修改前

    if(NOT "include;/usr/include;/usr/include/opencv " STREQUAL " ")
      set(cv_bridge_INCLUDE_DIRS "")
      set(_include_dirs "include;/usr/include;/usr/include/opencv")
    
    • 1
    • 2
    • 3

    修改后

    if(NOT "include;/usr/include;/usr/include/opencv4 " STREQUAL " ")
      set(cv_bridge_INCLUDE_DIRS "")
      set(_include_dirs "include;/usr/include;/usr/include/opencv4")
    
    • 1
    • 2
    • 3

    下面这个报错在其他程序里面出现,在编译速腾聚创激光雷达驱动没有出现,此处作为参考

    Project ‘grid_map_cv’ specifies ‘/usr/include/opencv’ as an include dir

    CMake Error at /opt/ros/melodic/share/grid_map_cv/cmake/grid_map_cvConfig.cmake:113 (message):
      Project 'grid_map_cv' specifies '/usr/include/opencv' as an include dir,
      which is not found.  It does neither exist as an absolute directory nor in
      '${{prefix}}//usr/include/opencv'.  Check the issue tracker
      'http://github.com/anybotics/grid_map/issues' and consider creating a
      ticket if the problem has not been reported yet.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    修改上面报错的第一行中的文件的94行和96行,将opencv替换为opencv4:
    修改前

    if(NOT "include;/usr/include;/usr/include/opencv " STREQUAL " ")
      set(grid_map_cv_INCLUDE_DIRS "")
      set(_include_dirs "include;/usr/include;/usr/include/opencv")
    
    • 1
    • 2
    • 3

    修改后

    if(NOT "include;/usr/include;/usr/include/opencv4 " STREQUAL " ")
      set(grid_map_cv_INCLUDE_DIRS "")
      set(_include_dirs "include;/usr/include;/usr/include/opencv4")
    
    • 1
    • 2
    • 3

    2 a-loam算法

    报错: fatal error: opencv/cv.h: 没有那个文件或目录

    xx/src/A-LOAM/src/draw_boxes.cpp:7:10: fatal error: opencv/cv.h: 没有那个文件或目录
     #include 
    
    • 1
    • 2

    修改 #include #include

    报错:error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope

    error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
             cv::Mat left_image = cv::imread(left_image_path.str(), CV_LOAD_IMAGE_GRAYSCALE);
    
    • 1
    • 2

    参考:https://blog.csdn.net/weixin_41560777/article/details/124138138
    找到对应的kittiHelper.cpp文件,将91行与93行的CV_LOAD_IMAGE_GRAYSCALE改为cv::IMREAD_GRAYSCALE

    报错:[FATAL] [1668787250.688458461]: BREAKPOINT HIT

    先启动速腾雷达驱动roslaunch rslidar_sdk start.launch ,后启动a-loamroslaunch aloam_velodyne aloam_velodyne_VLP_16_c2.launch

    [FATAL] [1668787250.688458461]: BREAKPOINT HIT
    	file = /home/aaeon/hxz/c2_aloam/src/A-LOAM/src/laserOdometry.cpp
    	line=240
    
    [alaserOdometry-2] process has died [pid 8867, exit code -6, cmd /home/aaeon/hxz/c2_aloam/devel/lib/aloam_velodyne/alaserOdometry __name:=alaserOdometry __log:=/home/aaeon/.ros/log/2653080a-675a-11ed-a57f-48b02d185503/alaserOdometry-2.log].
    log file: /home/aaeon/.ros/log/2653080a-675a-11ed-a57f-48b02d185503/alaserOdometry-2*.log
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    在这里插入图片描述

    根据报错查看/home/aaeon/hxz/c2_aloam/src/A-LOAM/src/laserOdometry.cpp240行左右内容,怀疑是时间戳问题

                if (timeCornerPointsSharp != timeLaserCloudFullRes ||
                    timeCornerPointsLessSharp != timeLaserCloudFullRes ||
                    timeSurfPointsFlat != timeLaserCloudFullRes ||
                    timeSurfPointsLessFlat != timeLaserCloudFullRes)
                {
                    printf("unsync messeage!");
                    ROS_BREAK();
                }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    先启动启动a-loamroslaunch aloam_velodyne aloam_velodyne_VLP_16_my.launch,后启动速腾雷达驱动roslaunch rslidar_sdk start.launch 则不会报错,且会正常运行

    在这里插入图片描述

  • 相关阅读:
    C++应程序实现修改设备IP地址、MAC、设备ID功能
    【YAML】【YAML的实践】【YAML的使用学习记录】
    谈谈行情与就业吧!
    边缘计算系统设计与实践
    【调制解调】PM 调相
    一文看懂ELK日志查看安装配置(超详细)
    【每日一题Day37】LC795区间子数组的个数 | 单调栈 模拟
    基于ttcrpy(三维射线追踪)的跨孔CT高斯牛顿算法及python代码分享(1)
    java 导出到excel的几种方式你要知道
    基于多目标优化算法的电力系统分析(Matlab代码实现)
  • 原文地址:https://blog.csdn.net/BIT_HXZ/article/details/127937738