Intel® RealSense™ SDK 2.0的安装
1、注册服务器的公钥:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
2、将服务器添加到存储库列表中:
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
3、安装库
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
查看realsense-viewer:
realsense-viewer
安装realsense2-camera
sudo apt-get install ros-noetic-realsense2-camera
启动相机节点
roslaunch realsense2_camera rs_camera.launch
可以通过
rostopic list
查看都有哪些话题
启动相机点云
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
启动rviz
与深度值进行对齐:
roslaunch realsense2_camera rs_camera.launch align_depth:=true
可以使用rqt工具进行查看
rosrun rqt_image_view rqt_image_view
也可以下载源码进行编译
GitHub - IntelRealSense/realsense-ros at ros1-legacy
git clone -b ros1-legacy https://github.com/IntelRealSense/realsense-ros.git
注:如果不指定分支,它会下载ros2这个主分支,切记~
IMU标定:
IMU Calibration Tool for Intel® RealSense™ Depth Camera
IMU标定工具:
GitHub - IntelRealSense/librealsense: Intel® RealSense™ SDK
脚本文件在 tools/rs-imu-calibration 文件夹中
标定部分后续再更新。。。默认使用了出厂的内参,获取内参的方法如下
RealSense 获取相机内参数的方法:
rs-sensor-control
Principal Point : 329.578, 232.509
Focal Length : 603.086, 603.26
Distortion Model : Brown Conrady
Distortion Coefficients : [0.15858,-0.492513,-0.00218088,0.00021294,0.4519]
Translation Vector : [0.0127626,-0.00280832,-0.00553363]
Rotation Matrix : [0.999902,0.012413,-0.00643062]
: [-0.0121827,0.999324,0.0346926]
: [0.00685691,-0.0346109,0.999377]
相机的内参矩阵:
K = fx s x0
0 fy y0
0 0 1
fx,fy为焦距,一般情况下,二者相等。
x0,y0为主坐标(相对于成像平面)。
s为坐标轴倾斜参数,理想情况下为0。
import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config() config.enable_stream(rs.stream.color,640,480,rs.format.rgb8,30)
cfg = pipeline.start(config)
profile = cfg.get_stream(rs.stream.color)
intr = profile.as_video_stream_profile().get_intrinsics()
print(intr)
[ 640x480 p[329.578 232.509] f[603.086 603.26] Brown Conrady [0.15858 -0.492513 -0.00218088 0.00021294 0.4519] ]
Principal Point : 329.578, 232.509
Focal Length : 603.086, 603.26
Distortion Model : Brown Conrady
Distortion Coefficients : [0.15858,-0.492513,-0.00218088,0.00021294,0.4519]
RealSense检测图像质量
rs-depth-quality