R3live:整体分析

R3LIVE相关参考:
R3LIVE(升级R2LIVE):编译与运行

https://blog.csdn.net/handily_1/article/details/122271243?spm=1001.2014.3001.5502
R3live:整体分析
https://blog.csdn.net/handily_1/article/details/122360134?spm=1001.2014.3001.5502
运行代码报错:Failed to load module “canberra-gtk-module“
https://blog.csdn.net/handily_1/article/details/122359275
R3live笔记:(图像处理)视觉-惯性里程计VIO部分
https://blog.csdn.net/handily_1/article/details/122377514

编译

编译运行R3LIVE参考文章:R3LIVE(升级R2LIVE):编译与运行

https://blog.csdn.net/handily_1/article/details/122271243?spm=1001.2014.3001.5502

目录

    • 编译
    • 1. rviz分析
    • 2. ros节点与话题
    • 3. launch文件分析
    • 4. r3live_config文件分析
    • 5. cmakelists.txt

1. rviz分析

简单分析一下rviz中都显示什么内容

  1. Global Options坐标系:world
  2. Grid:栅格
  3. Axes:Fixed Frame的坐标系,不能添加相对于其他坐标系的Axes
  4. LIO文件夹
    pointcloud_map: 订阅的是/cloud_registered,这个就是处理后的全部点云了
    current_scan:当前扫描到的全部点,订阅的也是/cloud_registered,Size是5,Alpha是1,Decay是0
    feature_map:特征点地图,订阅的是/Laser_map
    Path:r3live计算出来的轨迹,订阅的是/path
    Odometry:/r2live/odometry 没用到
    Odometry:建图的时候的位姿,订阅的是/aft_mapped_to_init
    Odometry:相机位姿,订阅的是/camera_odom
    Path:视觉计算出的轨迹,订阅的是/camera_path
    track_pts:应该是视觉计算出的点云,跑代码的时候"/track_pts"这个话题并没有数据输出
  5. RGB_map文件夹
    这里面全是由不同的 /RGB_map_*话题组成的一张RGB地图
  6. Input image:rviz显示输入图像
  7. Tracked points:rviz显示视觉追踪图像

2. ros节点与话题


/RGB_map_*话题计较长哈,回头处理一下图片,其实r3live节点与话题和还是很清晰明了的, 一共就/r3live_LiDAR_front_end和/r3live_mapping两个节点:

/r3live_LiDAR_front_end节点算法来自于经典算法LOAM中的特征提取部分,其实也是R2live、fast-lio中都使用到的,他订阅/livox/lidar雷达话题信息,经过处理后发布点云/laser_cloud,平面点/laser_cloud_flat和角点/laser_cloud_sharp信息。

/r3live_mapping节点就订阅平面点/laser_cloud_flat、imu话题/livox/imu和相机(这里的图片是compressed格式)话题/camera/image_color/compressed。发布的话题是前面rviz订阅的所有。

3. launch文件分析

以r3live_bag.launch为例:

<launch>
    <!-- Subscribed topics -->
    <param name="LiDAR_pointcloud_topic" type="string" value= "/laser_cloud_flat" />
    <param name="IMU_topic" type="string" value= "/livox/imu" />
    <param name="Image_topic" type="string" value= "/camera/image_color" />
    <param name="r3live_common/map_output_dir" type="string" value="$(find r3live)/../r3live_output" />
    <rosparam command="load" file="$(find r3live)/../config/r3live_config_r3live.yaml" />
  
   <node pkg="r3live" type="r3live_LiDAR_front_end" name="r3live_LiDAR_front_end"  output="screen"  required="true">
    <remap from="/livox/lidar" to="/livox/lidar" />
  </node>

    <node pkg="r3live" type="r3live_mapping" name="r3live_mapping" output="screen" required="true" />
    
    <arg name="rviz" default="1" />
    <group if="$(arg rviz)">
        <node name="rvizvisualisation" pkg="rviz" type="rviz" output="log" args="-d $(find r3live)/../config/rviz/r3live_rviz_config.rviz" />
    </group>
</launch>
  • 第一个参数是设置r3live处理的雷达话题,不是livox话题
  • 定义imu、Image的topic和地图保存路径
  • 加载配置文件r3live_config_r3live.yaml
  • 启动r3live_LiDAR_front_end节点和r3live_mapping节点
  • 启动rviz

4. r3live_config文件分析

Lidar_front_end:
   lidar_type: 0   # 1 for Livox-avia, 3 for Ouster-OS1-64
   N_SCANS: 6
   using_raw_point: 1
   point_step: 1
   
   
r3live_common:
   if_dump_log: 0                   # If recording ESIKF update log. [default = 0]
   record_offline_map: 1            # If recording offline map. [default = 1]
   pub_pt_minimum_views: 3          # Publish points which have been render up to "pub_pt_minimum_views" time. [default = 3]
   minimum_pts_size: 0.01           # The minimum distance for every two points in Global map (unit in meter). [default = 0.01] 
   image_downsample_ratio: 1        # The downsample ratio of the input image. [default = 1]
   estimate_i2c_extrinsic: 1        # If enable estimate the extrinsic between camera and IMU. [default = 1] 
   estimate_intrinsic: 1            # If enable estimate the online intrinsic calibration of the camera lens. [default = 1] 
   maximum_vio_tracked_pts: 600     # The maximum points for tracking. [default = 600]
   append_global_map_point_step: 4
r3live_vio:
   camera_intrinsic:          # 相机内参
      [863.4241, 0.0, 640.6808,
      0.0,  863.4171, 518.3392,
      0.0, 0.0, 1.0 ] 
   camera_dist_coeffs: [-0.1080, 0.1050, -1.2872e-04, 5.7923e-05, -0.0222]  # 畸变系数k1, k2, p1, p2, k3
# 相机外参
   camera_ext_R:
         [-0.00113207, -0.0158688, 0.999873,
            -0.9999999,  -0.000486594, -0.00113994,
            0.000504622,  -0.999874,  -0.0158682]

   camera_ext_t: [0,0,0] 

r3live_lio:        
   lio_update_point_step: 4   # Point step used for LIO update.  
   max_iteration: 2           # Maximum times of LIO esikf.
   lidar_time_delay: 0        # The time-offset between LiDAR and IMU, provided by user. 
   #  体素大小
   filter_size_corner: 0.30   
   filter_size_surf: 0.30
   filter_size_surf_z: 0.30
   filter_size_map: 0.30

5. cmakelists.txt

  • 生成r3live_LiDAR_front_end可执行文件
add_executable(r3live_LiDAR_front_end src/loam/LiDAR_front_end.cpp)
target_link_libraries(r3live_LiDAR_front_end ${catkin_LIBRARIES} ${PCL_LIBRARIES})
  • 生成r3live_cam_cali_create_cali_board可执行文件
if(Ceres_FOUND)
  message(STATUS "===== Find ceres, Version ${Ceres_VERSION} =====")  
  include_directories(${CERES_INCLUDE_DIRS})
  add_executable(r3live_cam_cali src/r3live_cam_cali.cpp)
  target_link_libraries(r3live_cam_cali ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${CERES_LIBRARIES})

  add_executable(r3live_cam_cali_create_cali_board src/r3live_cam_cali_create_cali_board.cpp)
  target_link_libraries(r3live_cam_cali_create_cali_board ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
endif()
  • 生成r3live_mapping可执行文件
add_executable(r3live_mapping src/r3live.cpp 
                src/r3live_lio.cpp
                src/loam/include/kd_tree/ikd_Tree.cpp
                src/loam/include/FOV_Checker/FOV_Checker.cpp 
                src/loam/IMU_Processing.cpp
                src/rgb_map/offline_map_recorder.cpp
                #From VIO
                src/r3live_vio.cpp
                src/optical_flow/lkpyramid.cpp
                src/rgb_map/rgbmap_tracker.cpp
                src/rgb_map/image_frame.cpp
                src/rgb_map/pointcloud_rgbd.cpp
              )
target_link_libraries(r3live_mapping 
                          ${catkin_LIBRARIES}
                          ${Boost_LIBRARIES}
                          ${Boost_FILESYSTEM_LIBRARY}
                          ${Boost_SERIALIZATION_LIBRARY} #serialization
                          ${OpenCV_LIBRARIES}
                          #${OpenMVS_LIBRARIES}
                          pcl_common 
                          pcl_io) 
  • 生成r3live_meshing可执行文件
FIND_PACKAGE(CGAL REQUIRED)
if(CGAL_FOUND)
	include_directories(${CGAL_INCLUDE_DIRS})
	add_definitions(${CGAL_DEFINITIONS})
	link_directories(${CGAL_LIBRARY_DIRS})
  ADD_DEFINITIONS(-D_USE_BOOST -D_USE_EIGEN -D_USE_OPENMP)
  SET(_USE_BOOST TRUE)
  SET(_USE_OPENMP TRUE)
  SET(_USE_EIGEN TRUE)
#生成r3live_meshing可执行文件
  add_executable(r3live_meshing src/r3live_reconstruct_mesh.cpp                              
                                src/rgb_map/image_frame.cpp
                                src/rgb_map/pointcloud_rgbd.cpp  
                                # Common
                                src/meshing/MVS/Common/Common.cpp
                                src/meshing/MVS/Common/Log.cpp
                                src/meshing/MVS/Common/Timer.cpp
                                src/meshing/MVS/Common/Types.cpp
                                src/meshing/MVS/Common/Util.cpp
                                # MVS                       
                                src/meshing/MVS/Mesh.cpp
                                src/meshing/MVS/PointCloud.cpp
                                src/meshing/MVS/Camera.cpp
                                src/meshing/MVS/Platform.cpp
                                src/meshing/MVS/PLY.cpp
                                src/meshing/MVS/OBJ.cpp
                                src/meshing/MVS/IBFS.cpp
                                )
target_link_libraries(r3live_meshing 
                                  ${catkin_LIBRARIES}
                                  ${Boost_LIBRARIES}
                                  ${Boost_FILESYSTEM_LIBRARY}
                                  ${Boost_SERIALIZATION_LIBRARY} # serialization
                                  ${CGAL_LIBS}
                                  ${OpenCV_LIBRARIES}
                                  ${JPEG_LIBRARIES} 
                                  gmp
                                  pcl_common 
                                  pcl_io
                                  pcl_kdtree)

endif()

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