文章目录
1. 安装Realsense SDK
1.1 安装要求
操作系统最低要求:ubuntu16
内核版本最低要求:Ubuntu LTS kernels 4.4
查看内核版本:
uname -r
1.2 安装步骤
- 注册服务器公钥
sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
- 将服务器添加到存储库列表
sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main" -u
- 下载并安装基础驱动包
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
- 下载并安装开发和调试包
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
1.3 测试安装
运行realsense软件查看图像和IMU数据:
realsense-viewer
1.4 说明
librealsense2-dkms
是一个具有动态内核模块支持(DKMS)功能的Linux驱动包。没有集成到内核之中的Linux驱动程序需要手动编译,如果遇到因为发行版更新造成的内核版本的变动,由于Linux模块依赖于内核,之前编译的模块无法继续使用,只能重新编译。而DKMS可以维护内核外驱动程序,内核版本变动后能自动生成新的模块。
librealsense2-utils
提供了示例和工具。
librealsense2-dev
和librealsense2-dbg
是开发包和调试包,如果需要通过API去读取realsense的数据,就得安装这两个包。
2. 在ROS下使用Realsense D435i
2.1 安装realsense-ros package
sudo apt-get install ros-kinetic-realsense2-camera
2.2 运行相机节点
roslaunch realsense2_camera rs_camera.launch
如果想启动时,深度相机向其他数据流(如彩色图)对齐,则运行:
roslaunch realsense2_camera rs_camera.launch align_depth:=true
2.3 发布的话题
运行
roslaunch realsense2_camera rs_camera.launch align_depth:=true
再执行
rostopic list
可以看到Realsense发布的所有话题:
/camera/aligned_depth_to_color/camera_info
/camera/aligned_depth_to_color/image_raw
/camera/aligned_depth_to_color/image_raw/compressed
/camera/aligned_depth_to_color/image_raw/compressed/parameter_descriptions
/camera/aligned_depth_to_color/image_raw/compressed/parameter_updates
/camera/aligned_depth_to_color/image_raw/compressedDepth
/camera/aligned_depth_to_color/image_raw/compressedDepth/parameter_descriptions
/camera/aligned_depth_to_color/image_raw/compressedDepth/parameter_updates
/camera/aligned_depth_to_color/image_raw/theora
/camera/aligned_depth_to_color/image_raw/theora/parameter_descriptions
/camera/aligned_depth_to_color/image_raw/theora/parameter_updates
/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/motion_module/parameter_descriptions
/camera/motion_module/parameter_updates
/camera/realsense2_camera_manager/bond
/camera/rgb_camera/auto_exposure_roi/parameter_descriptions
/camera/rgb_camera/auto_exposure_roi/parameter_updates
/camera/rgb_camera/parameter_descriptions
/camera/rgb_camera/parameter_updates
/camera/stereo_module/auto_exposure_roi/parameter_descriptions
/camera/stereo_module/auto_exposure_roi/parameter_updates
/camera/stereo_module/parameter_descriptions
/camera/stereo_module/parameter_updates
主要是分为以下几大类:
分类 | 说明 |
---|---|
/camera/aligned_depth_to_color | 对齐后的深度图像信息 |
/camera/color | 彩色图像信息 |
/camera/depth | 未对齐的深度图像信息 |
/camera/extrinsics | 外参信息 |
/camera/motion_module | IMU信息 |
/camera/realsense2_camera_manager | 管理器信息 |
/camera/rgb_camera | RGB相机参数信息 |
/camera/stereo_module | 双目信息 |
2.4 带宽分析
假设图像尺寸是640*480,帧率30Hz。由于彩色图像为3通道,每通道8位,那么每秒的字节数就是:640*480*3*30 = 27648000(B),换算成MB(除以两次1024)得到带宽:26.37MB/s。
深度图像为单通道,每通道16位,每秒的字节数就是:640*480*2*30 = 18432000(B),则带宽为:17.57MB/s。
通过以下命令查看原始图片的带宽:
rostopic bw /camera/color/image_raw
rostopic bw /camera/depth/image_rect_raw
跟理论分析的差不多。
如果要在网卡和路由器的性能受限的情况下实时传输图片,可以考虑压缩后的图片,它们通过/camera/color/image_raw/compressed
和/camera/depth/image_rect_raw/compressed
两个话题发布,从下面两张图可以看出带宽被极大地降低了:
原始图片的格式是raw,msg类型为sensor_msgs/Image
:
std_msgs/Header header
uint32 height
uint32 width
string encoding
uint8 is_bigendian
uint32 step
uint8[] data
压缩图片的格式是png或者jpeg,msg类型为sensor_msgs/CompressedImage
:
std_msgs/Header header
string format
uint8[] data
3. 参考
[1] ubuntu16.04安装realsenseD435i sdk
[2] librealsense/doc/distribution_linux.md
[3] IntelRealSense / realsense-ros
[4] ROS传输图像带宽不够用的解决方法(realsenseD415压缩图像)
[5] realsense_camera
[6] sensor_msgs/Image Message
[7] sensor_msgs/CompressedImage Message