一、RealSense D435i相机结构介绍

RealSense 是一款立体视觉深度相机,如下图所示,其集成了两个红外传感器(IR Stereo Camera)、一个红外激光发射器(IR Projector)和一个彩色相机(Color Camera)。立体深度相机系统主要包括两部分:视觉处理器D4和深度模块。主机处理器连接 USB 2.0 / USB 3.1 Gen 1。视觉处理器 D4 位于主处理器主板上,RGB颜色传感器数据通过主处理器主板和 D4 板上的彩色图像信号处理器(ISP)发送到视觉处理器D4。IntelRealSense D435i提供了完整的深度相机模块,集成了视觉处理器、立体深度模块、RGB 传感器以及彩色图像信号处理模块。深度模块采用立体视觉的左右成像器、可选的红外激光发射器和 RGB 色彩传感器。
图1

 图2

硬件参数信息
最高 1280×720 双目深度分辨率;
最高 1920×1080 RGB 分辨率;
最高 90 FPS 深度视频流。深度流与普通 RGB 视频流类似,只不过每个像素点的值不再是 RGB 或灰度值,而是物体相对于相机的距离;
更大的85度左右的镜头视场(FOV);
只能对相同帧率的 RGB 与深度视频流做同步设置;
双目 baseline 为 50 mm;
深度探测范围 0.2 m ~ 10 m ;
6DOF追踪功能(six degree of freedom);
深度坐标系以左侧相机为中心(上图中 centerline of 1/4-20 是指三脚架螺丝空的中心);
内含一个 6 自由度的 IMU,对应刚体在三维空间中 6 种运动方式:前后、左右、上下的平移,以及绕刚体三个轴的旋转 —— 绕前后方向轴旋转 roll, 绕左右方向轴旋转 pitch, 绕上下方向轴旋转 yaw;【亮点,该款相机具备IMU】

二、 InterRealSenseD435i SDK安装

博主使用的是命令行的安装

2.1 命令行的安装方式安装

1.注册服务器的公钥:
打开终端输入

sudo apt-key adv --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE


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

安装过程中遇到问题:

解决方法如图所示: 

4.安装开发者和调试包:

在终端里输入

sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg

使用这两条命令的时候会非常的慢。可能是网络的问题

5.测试SDK2

把相机与电脑上的USB3.0口相连后(不是USB3.0口可能会出问题),打开终端输入

realsense-viewer

安装成功后的图像显示为: 

2.2 使用源码编译的方法 

手动下载地址:
github:https://github.com/IntelRealSense/librealsense

1. 下载source
 

git clone https://github.com/IntelRealSense/librealsense
cd librealsense


2. 安装依赖项

sudo apt-get install libudev-dev pkg-config libgtk-3-dev
sudo apt-get install libusb-1.0-0-dev pkg-config
sudo apt-get install libglfw3-dev
sudo apt-get install libssl-dev


3. 安装权限脚本

sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger 


4. 编译安装

mkdir build
cd build
cmake ../ -DBUILD_EXAMPLES=true
make
sudo make install


5. 测试
进入librealsense/build/examples/capture,测试效果:

./rs-capture 

或直接使用realsense-viewer工具查看效果:

realsense-viewer

三、Realsense ROS 安装

3.1 源码编译安装

1,首先创建ROS的工作空间

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace

 这样就在src文件中创建了一个 CMakeLists.txt 的文件,目的是告诉系统,这个是ROS的工作空间。

2, 下载realsense-ros安装包和ddynamic_reconfigure包

git clone https://github.com/IntelRealSense/realsense-ros.git
git clone https://github.com/pal-robotics/ddynamic_reconfigure.git

   两个包都下载到 ~/catkin_ws/src 文件夹下

3,编译两个包

cd ~/catkin_ws
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
切记执行
source ~/.bashrc

在执行到catkin_make的时候出现错误

error: ‘find_if’ was not declared in this scope
texture_frame_itr = find_if(frameset.begin(), frameset.end(), [&texture_source_id, &available_formats] (rs2::frame f)

解决方法:是源码的问题,更改错误cpp中的内容即可

 4.测试

1)测试 rs_camera.launch

终端执行

roslaunch realsense2_camera rs_camera.launch

执行该命令出现如下的错误的话

解决方法为:

正常执行后,可以使用ros话题查看

rostopic list

 会发现没有imu的话题。进行下面的处理进行更改

//打开imu
<arg name="enable_gyro"         default="true"/>
<arg name="enable_accel"        default="true"/>
//联合方式copy或linear_interpolation
<arg name="unite_imu_method"          default="linear_interpolation"/>
//时间戳同步
<arg name="enable_sync"               default="true"/>

更改后执行命令

roslaunch realsense2_camera rs_camera.launch
rostopic list

展现的话题中出现imu相关的话题

/camera/accel/imu_info
/camera/accel/sample
/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/extrinsics/depth_to_infra1
/camera/extrinsics/depth_to_infra2
/camera/infra1/camera_info
/camera/infra1/image_rect_raw
/camera/infra1/image_rect_raw/compressed
/camera/infra1/image_rect_raw/compressed/parameter_descriptions
/camera/infra1/image_rect_raw/compressed/parameter_updates
/camera/infra1/image_rect_raw/compressedDepth
/camera/infra1/image_rect_raw/compressedDepth/parameter_descriptions
/camera/infra1/image_rect_raw/compressedDepth/parameter_updates
/camera/infra1/image_rect_raw/theora
/camera/infra1/image_rect_raw/theora/parameter_descriptions
/camera/infra1/image_rect_raw/theora/parameter_updates
/camera/infra2/camera_info
/camera/infra2/image_rect_raw
/camera/infra2/image_rect_raw/compressed
/camera/infra2/image_rect_raw/compressed/parameter_descriptions
/camera/infra2/image_rect_raw/compressed/parameter_updates
/camera/infra2/image_rect_raw/compressedDepth
/camera/infra2/image_rect_raw/compressedDepth/parameter_descriptions
/camera/infra2/image_rect_raw/compressedDepth/parameter_updates
/camera/infra2/image_rect_raw/theora
/camera/infra2/image_rect_raw/theora/parameter_descriptions
/camera/infra2/image_rect_raw/theora/parameter_updates
/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
/diagnostics
/rosout
/rosout_agg
/tf
/tf_static

2)测试 rs_rgbd.launch

roslaunch realsense2_camera rs_rgbd.launch

sudo apt-get install ros-melodic-rgbd-launch

对应的话题有: 

/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/color/image_rect_color
/camera/color/image_rect_color/compressed
/camera/color/image_rect_color/compressed/parameter_descriptions
/camera/color/image_rect_color/compressed/parameter_updates
/camera/color/image_rect_color/compressedDepth
/camera/color/image_rect_color/compressedDepth/parameter_descriptions
/camera/color/image_rect_color/compressedDepth/parameter_updates
/camera/color/image_rect_color/theora
/camera/color/image_rect_color/theora/parameter_descriptions
/camera/color/image_rect_color/theora/parameter_updates
/camera/color_rectify_color/parameter_descriptions
/camera/color_rectify_color/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/depth_registered/points
/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
/diagnostics
/rosout
/rosout_agg
/tf
/tf_static

3.2 命令安装

1.前提是先安装好realsense SDK
也就是终端输入:
realsense-viewer
可以打开相机的图像。


2.安装RGBD包:

sudo apt-get install ros-melodic-rgbd-launch

3.之后输入apt search melodic-realsense2

在这里插入图片描述

然后将找到的3个库都安装了就好了

sudo aptitude install ros-melodic-realsense2-camera
sudo aptitude install ros-melodic-realsense2-description
sudo aptitude install ros-melodic-realsense2-camera-dbgsym


 在这里插入图片描述

全部安装后,在终端打开相机并查看图像: 

  roslaunch realsense2_camera rs_camera.launch 
  rosrun rqt_image_view rqt_image_view

在这里插入图片描述

卸载realsense-ros命令使用:sudo apt-get remove ros-melodic-librealsense2
 

四、相机内参查看

roslaunch realsense2_camera rs_camera.launch
rostopic echo /camera/color/camera_info

注意内参的查看需要使用为更换的launch文件 

但是更换了的launch文件是可以获取imu的数据的

 使用rviz查看的方法为随着相机的移动,粉色的箭头也会进行移动:

下面的博文数可以一次性成功,但是博主由于网的原因,没有办法执行,有条件的可以尝试:

下面的博文指定的版本为:SDK 2.48.0   ros 2.3.1  

[解决方法]realsence D455 在jetson nano 无法正常读取imu数据(/camera/imu、/camera/accel/sample)_fikimi的博客-CSDN博客

1)SDK的安装

# Uninstall all realsense packages
sudo apt remove librealsense2 ros-melodic-realsense2-camera librealsense2-udev-rules ros-melodic-librealsense2 librealsense2-dev
 
# Reinstall librealsense2 at version 2.48.0 and place those packages on hold (to prevent
# automatic upgrades)
sudo apt install \
	librealsense2=2.48.0-5ubuntu5~1.gbp156c1b \
	librealsense2-udev-rules=2.48.0-5ubuntu5~1.gbp156c1b \
	librealsense2-utils=2.48.0-5ubuntu5~1.gbp156c1b \
	librealsense2-gl=2.48.0-5ubuntu5~1.gbp156c1b \
	librealsense2-net=2.48.0-5ubuntu5~1.gbp156c1b \
	librealsense2-dev=2.48.0-5ubuntu5~1.gbp156c1b
sudo apt-mark hold \
	librealsense2 \
	librealsense2-udev-rules \
	librealsense2-utils \
	librealsense2-gl \
	librealsense2-net \
	librealsense2-dev
	
# To remove the hold on the package versions, just run `sudo apt-mark unhold <package name>`

 2)ROS的安装

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout 2.3.1
cd ..
catkin_init_workspace
cd ..
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

五、数据的记录与播放

5.1 录制自己需要的数据

下面的例程是录制了两个话题包

 5.2 找到存放的位置并播放

在Linux 的主目录下,按ctrl+h。可以将影藏的文件夹显现出来,找到上面的bag文件

 

如果想将对应的数据保存为txt使用以下的命令 

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐