ROS实验笔记之——Intel Realsense l515激光相机的使用

Posted gwpscut

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ROS实验笔记之——Intel Realsense l515激光相机的使用相关的知识,希望对你有一定的参考价值。

最近实验室购买了Intel Realsense l515相机。本博文记录使用过程~

 驱动安装

先到官网安装驱动:https://github.com/IntelRealSense/realsense-roshttps://github.com/IntelRealSense/realsense-ros安装realsense2_camera

sudo apt-get install ros-melodic-realsense2-camera

然后运行下面命令启动相机

roslaunch realsense2_camera rs_camera.launch

看看所能出来的topic信息

/camera/color/camera_info
/camera/color/image_raw
/camera/color/image_raw/compressed
/camera/color/image_raw/compressed/parameter_descriptions
/camera/color/image_raw/compressed/parameter_updates
/camera/color/image_raw/compressedDepth
/camera/color/image_raw/compressedDepth/parameter_descriptions
/camera/color/image_raw/compressedDepth/parameter_updates
/camera/color/image_raw/theora
/camera/color/image_raw/theora/parameter_descriptions
/camera/color/image_raw/theora/parameter_updates
/camera/depth/camera_info
/camera/depth/image_rect_raw
/camera/depth/image_rect_raw/compressed
/camera/depth/image_rect_raw/compressed/parameter_descriptions
/camera/depth/image_rect_raw/compressed/parameter_updates
/camera/depth/image_rect_raw/compressedDepth
/camera/depth/image_rect_raw/compressedDepth/parameter_descriptions
/camera/depth/image_rect_raw/compressedDepth/parameter_updates
/camera/depth/image_rect_raw/theora
/camera/depth/image_rect_raw/theora/parameter_descriptions
/camera/depth/image_rect_raw/theora/parameter_updates
/camera/extrinsics/depth_to_color
/camera/l500_depth_sensor/parameter_descriptions
/camera/l500_depth_sensor/parameter_updates
/camera/motion_module/parameter_descriptions
/camera/motion_module/parameter_updates
/camera/realsense2_camera_manager/bond
/camera/rgb_camera/parameter_descriptions
/camera/rgb_camera/parameter_updates
/diagnostics
/rosout
/rosout_agg
/tf
/tf_static

若要显示点云,可运行

roslaunch realsense2_camera rs_camera.launch filters:=pointcloud

通过rviz来可视化(主要要显示点云信息需要将frame改为camera link)

运行下面节点来将深度信息与图像align

roslaunch realsense2_camera rs_camera.launch align_depth:=true

也可以通过image view来显示

rosrun rqt_image_view rqt_image_view

 

 

SLAM测试

之前博客《ROS实验笔记之——XBOX Kinect2 的使用及基于RTAB-MAP的建图》介绍过基于Kinect2的SLAM建图,这里试试用l515的效果~

安装rtabmap

sudo apt-get install ros-melodic-rtabmap-ros
rosrun rtabmap_ros pointcloud_to_depthimage cloud:=/camera/depth/color/points camera_info:=/camera/color/camera_info image_raw:=/camera/depth/image_rect_raw image:=/camera/color/image_raw _approx:=false _fill_holes_size:=2

roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start" depth_topic:=/camera/depth/image_rect_raw

无法使用。。topic完全不一样。。。

点进去,发现有rtabmap的launch文件

roslaunch realsense2_camera rs_rtabmap.launch

改为下面的试试

roslaunch realsense2_camera rs_rgbd.launch

然后通过改topic名字来实现rtabmap,发现还是不可以。。。。

# ISSUE: Use unite_imu_method:="copy" if imu topics keep stopping
$ roslaunch realsense2_camera rs_camera.launch \\
    align_depth:=true \\
    unite_imu_method:="linear_interpolation" \\
    enable_gyro:=true \\
     enable_accel:=true

$ rosrun imu_filter_madgwick imu_filter_node \\
    _use_mag:=false \\
    _publish_tf:=false \\
    _world_frame:="enu" \\
    /imu/data_raw:=/camera/imu \\
    /imu/data:=/rtabmap/imu

安装

sudo apt-get install ros-melodic-imu-tools

即可~使用imu(imu_filter_madgwick - ROS Wiki

GitHub - ccny-ros-pkg/imu_tools: ROS tools for IMU devices

然后运行

$ rosrun nodelet nodelet standalone rtabmap_ros/point_cloud_xyz \\
   _approx_sync:=false  \\
   /depth/image:=/camera/depth/image_rect_raw \\
   /depth/camera_info:=/camera/depth/camera_info \\
   _decimation:=4

$ roslaunch rtabmap_ros rtabmap.launch\\
   rtabmap_args:="\\
     --delete_db_on_start \\
     --Icp/VoxelSize 0.05 \\
     --Icp/PointToPlaneRadius 0 \\
     --Icp/PointToPlaneK 20 \\
     --Icp/CorrespondenceRatio 0.2 \\
     --Icp/PMOutlierRatio 0.65 \\
     --Icp/Epsilon 0.005 \\
     --Icp/PointToPlaneMinComplexity 0 \\
     --Odom/ScanKeyFrameThr 0.7 \\
     --OdomF2M/ScanMaxSize 15000 \\
     --Optimizer/GravitySigma 0.3 \\
     --RGBD/ProximityPathMaxNeighbors 1 \\
     --Reg/Strategy 1" \\
   icp_odometry:=true \\
   scan_cloud_topic:=/cloud \\
   subscribe_scan_cloud:=true \\
   depth_topic:=/camera/aligned_depth_to_color/image_raw \\
   rgb_topic:=/camera/color/image_raw \\
   camera_info_topic:=/camera/color/camera_info \\
   approx_sync:=false \\
   wait_imu_to_init:=true \\
   imu_topic:=/rtabmap/imu 

成功!感觉本质上就是学会怎么改好topic就行了,理解清楚每个topic的意义

使用如下服务可以用于从一个干净的数据库开始建图

rosservice call /rtabmap/reset

如果地图的背景变成红色,那是因为里程表丢失了。访问丢失的里程表(红色屏幕!)部分,了解为什么会发生这种情况!为了再次跟踪里程表,更换相机到红色出现前的最后一个位置,它应该能够重新计算里程表。另一种方法是重置里程表使用菜单选项““Edit->Reset odometry””(注意,一个新的地图创建每次里程表重置)。参见里程表自动复位另一种方法来处理里程表丢失(重置和继续相同的地图)。

若要加上定位,则运行

roslaunch rtabmap_ros rtabmap.launch\\
   rtabmap_args:="\\
     --delete_db_on_start \\
     --Icp/VoxelSize 0.05 \\
     --Icp/PointToPlaneRadius 0 \\
     --Icp/PointToPlaneK 20 \\
     --Icp/CorrespondenceRatio 0.2 \\
     --Icp/PMOutlierRatio 0.65 \\
     --Icp/Epsilon 0.005 \\
     --Icp/PointToPlaneMinComplexity 0 \\
     --Odom/ScanKeyFrameThr 0.7 \\
     --OdomF2M/ScanMaxSize 15000 \\
     --Optimizer/GravitySigma 0.3 \\
     --RGBD/ProximityPathMaxNeighbors 1 \\
     --Reg/Strategy 1" \\
   icp_odometry:=true \\
   scan_cloud_topic:=/cloud \\
   subscribe_scan_cloud:=true \\
   depth_topic:=/camera/aligned_depth_to_color/image_raw \\
   rgb_topic:=/camera/color/image_raw \\
   camera_info_topic:=/camera/color/camera_info \\
   approx_sync:=false \\
   wait_imu_to_init:=true \\
   imu_topic:=/rtabmap/imu \\
   localization:=true

基于intel realsense l515激光相机的rtabmap

参考资料

GitHub - IntelRealSense/realsense-ros: Intel(R) RealSense(TM) ROS Wrapper for D400 series, SR300 Camera and T265 Tracking Module

Realsense L515初次使用记录_复古蓝的博客-CSDN博客

运行Intel realsense L515相机_cyx610481953的博客-CSDN博客librealsense/distribution_linux.md at master · IntelRealSense/librealsense · GitHub运行Intel realsense L515相机_cyx610481953的博客-CSDN博客

rtabmap RGB-D相机手持建图_m0_46530321的博客-CSDN博客
http://wiki.ros.org/rtabmap_ros

以上是关于ROS实验笔记之——Intel Realsense l515激光相机的使用的主要内容,如果未能解决你的问题,请参考以下文章

ROS实验笔记之——安装QPEP以及Intel-MKL

ROS实验笔记之——安装QPEP以及Intel-MKL

PCL学习笔记:环境安装

PCL学习笔记:环境安装

PCL学习笔记:环境安装

ROS实验笔记之——EVO