安装卸载指导:
https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md1
2$ sudo apt-get install librealsense2-dkms
$ sudo apt-get install librealsense2-utils
进行程序开发和调试的时候会用到:1
2$ sudo apt-get install librealsense2-dev
$ sudo apt-get install librealsense2-dbg
安装完了之后看看这个能打开吧1
$ rs-capture
ROS的功能包:
https://github.com/IntelRealSense/realsense-ros
这个包的编译依赖ddynamic_reconfigure,所以就安装一下:1
$ sudo apt install ros-melodic-ddynamic-reconfigure
dynamic_reconfigure可以用来实时修改参数,很适合用于机器人参数可视化在线调试。减少了在调试机器人的时候修改完参数再编译这样低效的操作过程,同时效果和qt GUI差不多。
https://blog.csdn.net/qq_16481211/article/details/84675776
编译好了之后启动:1
$ roslaunch realsense2_camera rs_rgbd.launch
打开RVIZ可以查看点云信息。
内参获取
下面的方式可以查看相机的内参,也可以自己标定一下。1
2$ rostopic echo /camera/color/camera_info
$ rostopic echo /camera/aligned_depth_to_color/camera_info
topic中所有aligned_depth_to_color是指已经将深度信息通过相机到RGBD的外参映射到彩色图像上了
ORB-SLAM
源码:
https://github.com/raulmur/ORB_SLAM2
里面是有个ROS功能包的:ORB-SLAM2/Examples/ROS/ORB-SLAM2
要用realsense d435i进行的话,需要改一下topic的订阅:1
2message_filters::Subscriber<sensor_msgs::Image> rgb_sub(nh, "/camera/color/image_raw", 1);
message_filters::Subscriber<sensor_msgs::Image> depth_sub(nh, "/camera/aligned_depth_to_color/image_raw", 1);
重新编译ORB-SLAM2
需要安装Pangolin:
1 | $ chmod +x build_ros.sh |
连接realsense d435i,启动ROS realsense2_camera:1
$ roslaunch realsense2_camera rs_rgbd.launch
先用TUM1.yaml的参数运行一下试试看:1
$ rosrun ORB_SLAM2 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml
修改yaml文件中的部分参数再试试看!1
$ rosrun ORB_SLAM2 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/realsense_d435i.yaml
RTAB
参考链接:
http://wiki.ros.org/rtabmap_ros
安装move_base, rtabmap1
2
3$ sudo apt install ros-melodic-move-base
$ sudo apt install ros-melodic-rtabmap
$ sudo apt install ros-melodic-imu-filter-madgwick
编译rtabmap_ros包
先启动1
2$ roslaunch realsense2_camera rs_camera.launch align_depth:=true unite_imu_method:="linear_interpolation"
$ 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
再打开地图1
$ roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start --Optimizer/GravitySigma 0.3" 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
重置一下服务1
$ rosservice call /rtabmap/reset
然后就可以看见图像了。
地图保存的位置在
~/.ros/rtabmap.db
查看保存的地图可以用1
$ rtabmap-databaseViewer ~/.ros/rtabmap.db
这个命令。
XtionPRO Live
1 | $ roslaunch openni2_launch openni2.launch depth_registration:=true |
1 | $ roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start" |
1 | $ rosservice call /rtabmap/reset |