D435i相机-使用红外双目模式记录

此前,我已经尝试了使用单目和RGBD模式,但我在项目里需要用到的是双目模式,所以此篇仅作为学习记录,不作为教程。

一、红外双目参数了解

(1)首先,我需要了解红外双目相关的话题,分辨率,fps

默认参数启动相机:

复制代码
roslaunch realsense2_camera rs_camera.launch

和双目相关的话题:

复制代码
camera/extrinsics/depth_to_infra1
/camera/extrinsics/depth_to_infra2

/camera/infra1/camera_info
/camera/infra1/image_rect_raw  #这个话题会在slam中被订阅

/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/infra1/metadata

/camera/infra2/camera_info
/camera/infra2/image_rect_raw #这个话题会在slam中被订阅

/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/infra2/metadata

图像:可以看到目前还有光斑,在实际使用中需要关掉红外发射器

接着去查看一下左右相机的话题信息:

infra1:

复制代码
指令:rostopic echo -n 1 /camera/infra1/camera_info
header: 
  seq: 1827
  stamp: 
    secs: 1765423702
    nsecs: 445745230
  frame_id: "camera_infra1_optical_frame"
height: 480
width: 848
distortion_model: "plumb_bob"
D: [0.0, 0.0, 0.0, 0.0, 0.0]
K: [422.4416198730469, 0.0, 428.0201721191406, 0.0, 422.4416198730469, 243.25135803222656, 0.0, 0.0, 1.0]
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
P: [422.4416198730469, 0.0, 428.0201721191406, 0.0, 0.0, 422.4416198730469, 243.25135803222656, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 0
binning_y: 0
roi: 
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False

目前分辨率是848*480

infra2:

复制代码
 rostopic echo -n 1 /camera/infra2/camera_info
header: 
  seq: 0
  stamp: 
    secs: 1765423771
    nsecs: 258948326
  frame_id: "camera_infra1_optical_frame"
height: 480
width: 848
distortion_model: "plumb_bob"
D: [0.0, 0.0, 0.0, 0.0, 0.0]
K: [422.4416198730469, 0.0, 428.0201721191406, 0.0, 422.4416198730469, 243.25135803222656, 0.0, 0.0, 1.0]
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
P: [422.4416198730469, 0.0, 428.0201721191406, -21.109111785888672, 0.0, 422.4416198730469, 243.25135803222656, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 0
binning_y: 0
roi: 
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False

再查看infra1和2的外参:

复制代码
Extrinsic from "Infrared 1"	  To	  "Infrared 2" :
 Rotation Matrix:
   1   0   0
   0   1   0
   0   0   1
 
 Translation Vector: -0.0499693006277084  0  0 
------------------------------------------------
版权声明:本文为CSDN博主「努力的BigJiang」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_62948300/article/details/155751398

只有平移,从相机的说明书里也得知两个相机的距离为50mm,与这个结果相符。


查看完毕后,我需要的应该是640*360的分辨率,30fps,所以修改启动命令(也可以改launch的参数):

复制代码
roslaunch realsense2_camera rs_camera.launch infra_width:=640  infra_height:=360 infra_fps:=30

再次查看话题信息:

复制代码
 rostopic echo -n 1 /camera/infra2/camera_info
header: 
  seq: 0
  stamp: 
    secs: 1765424268
    nsecs: 830939293
  frame_id: "camera_infra1_optical_frame"
height: 360
width: 640
distortion_model: "plumb_bob"
D: [0.0, 0.0, 0.0, 0.0, 0.0]
K: [318.8238525390625, 0.0, 323.0340881347656, 0.0, 318.8238525390625, 182.453857421875, 0.0, 0.0, 1.0]
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
P: [318.8238525390625, 0.0, 323.0340881347656, -15.931405067443848, 0.0, 318.8238525390625, 182.453857421875, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 0
binning_y: 0
roi: 
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False
---

#查看发布频率
指令:rostopic hz /camera/infra2/camera_info
subscribed to [/camera/infra2/camera_info]
average rate: 29.971
	min: 0.015s max: 0.059s std dev: 0.00605s window: 30
average rate: 29.964
	min: 0.015s max: 0.060s std dev: 0.00644s window: 60
average rate: 29.862
	min: 0.015s max: 0.060s std dev: 0.00537s window: 90

修改后,分辨率改变,k矩阵也改变了,查看频率发现hz一致。(这里还要记得在launch文件里修改参数确保时间同步):

时间戳对比:

复制代码
rostopic echo -n1 /camera/infra1/image_rect_raw/header/stamp
rostopic echo -n1 /camera/infra2/image_rect_raw/header/stamp

二、红外双目的标定

暂时先不标,使用默认参数,先把代码跑通

三、红外双目模式运行ORBSLAM2

这里需要关掉红外发射器,不然效果很差

https://github.com/appliedAI-Initiative/orb_slam_2_ros?tab=readme-ov-file

官方没给适配d435i双目模式的启动文件,我仿照着别的写了一个,并加入了静态TF的发布

1. 单独运行相机:

查看一下节点图:

TF树:

2. 启动相机,运行slam

节点图:

这个节点图不对,没有输出的点云和位姿,移动一下相机,这个才对嘛:

TF:

打开rviz:

调下颜色:

比单目效果好,但是怎么还是这么容易跟丢呢。唉ε=(´ο`*)))唉

但此时出现警告:

唉 还是绕不过这个问题,不过问了师兄,说是影响不大,相信前人的智慧吧,或者有大佬解决的可以说一下。

到这里就基本完成了使用d435i双目模式运行orbslam2

相关推荐
专注仿真15 分钟前
仿真智能体训练:强化学习中的生存、任务、杀伤、能耗与规则惩罚算法详解与实战
python·算法·afsim智能体·仿真训练·afsim智能体训练
cpolar技术支持1 小时前
datetime.now() 和 datetime.now(timezone.utc) 混进 SQLite:零报错,读出来差 8 小时
python·sqlite·时间戳·datetime·时区
维爱智VR认知学能2 小时前
Python SQLite本地训练记录表迁移失败回滚与事务验证
数据库·python·单元测试·sqlite·软件工程
用户298698530142 小时前
使用 Python 替换 Word 文档文字:从全文到指定范围
python·api
Thanks_ks3 小时前
手写一个 LRU 缓存:哈希表与双向链表的组合设计
python·哈希表·lru·双向链表·ordereddict·命中率·哨兵节点
AI创界者14 小时前
Python 进阶实战(七十一章):研发效能度量、自动化质量门禁与工程规范落地实战
人工智能·python·aigc
yingjie11015 小时前
快榜GEO|官网 AI 可读性自查 12 项(附 Python 检测脚本)
开发语言·人工智能·python
tryCbest15 小时前
Python 爬虫扩展篇(二):验证码的检测与人工介入——把“拦路虎”当作信号,而不是要征服的对手
开发语言·爬虫·python
@陈小鱼18 小时前
基于InceptionTime网络的PPG无创血压估计算法研究
人工智能·python·算法·回归·开源·ppg·血压估计
谙弆悕博士18 小时前
动态自适应多智能体架构的 LangGraph 实现:从元调度器到可运行原型
人工智能·python·神经网络·机器学习·架构·多智能体·智能体