使用IntelRealsenseD435i深度相机模拟激光雷达数据
创始人
2025-06-01 13:58:10
0

目录

  • 前言
  • 1.下载并编译ros自带的功能包`depthimage_to_lasersca`
  • 2.新建一个launch文件
  • 3.转化为激光雷达数据
    • 1.启动相机节点
    • 2.启动`depthimage_to_lasersca`
    • 3.查看结果
  • 4.添加Y上的阈值
    • 1.
    • 2.
    • 3.
    • 4.
    • 5.用上面同样的方法查看结果


前言

参考链接
Ubuntu系统为18.04,并且安装了对应的ROS以及realsense-ros
realsense-ros/realsense2_camera/launch/rs_camera.launch中的align_depth设置为true,才会出现/camera/aligned_depth_to_color/image_raw/camera/aligned_depth_to_color/camera_info话题
在这里插入图片描述

1.下载并编译ros自带的功能包depthimage_to_lasersca

https://github.com/ros-perception/depthimage_to_laserscan注意下载自己ORS版本的功能包

mkdir -p depthimage_to_laserscan_ws/src && cd depthimage_to_laserscan_ws/src
git clone https://github.com/ros-perception/depthimage_to_laserscan.git
cd ..
catkin_make

2.新建一个launch文件

depthimage_to_laserscan_ws/src/depthimage_to_laserscan/launch/路径下新建use_my_D435i.launch

\ 


3.转化为激光雷达数据

1.启动相机节点

连接上相机,在安装realsense-ros的工作空间下打开终端

source devel/setup.bash
roslaunch realsense2_camera rs_camera.launch

2.启动depthimage_to_lasersca

depthimage_to_laserscan_ws文件夹下面打开

source devel/setup.bash
roslaunch depthimage_to_laserscan  use_my_D435i.launch

3.查看结果

新建终端,打开rvizFixed Frame选择camera_link,并且添加LaserScan,图像如下
在这里插入图片描述

4.添加Y上的阈值

1.

depthimage_to_laserscan/cfg/Depth.cfg中17-18行添加

gen.add("ythresh_min", double_t, 0, "Minimum y thresh (in meters).", -0.30, -1.0, 1.0)
gen.add("ythresh_max", double_t, 0, "Maximum y thresh (in meters).", 0.30, -1.0, 1.0)

2.

depthimage_to_laserscan/src/DepthImageToLaserScanROS.cpp中的reconfigureCb()函数中添加调用(第91行)

dtl_.set_y_thresh(config.ythresh_min, config.ythresh_max);

3.

depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScan.h中添加成员函数和成员变量:

void set_y_thresh(const float ythresh_min, const float ythresh_max); //第116行
float ythresh_min_; //第228行
float ythresh_max_;

同时在depthimage_to_laserscan/src/DepthImageToLaserScan.cpp中169-172行添加set_y_thresh()具体实现

void DepthImageToLaserScan::set_y_thresh(const float ythresh_min, const float ythresh_max){ythresh_min_ = ythresh_min;ythresh_max_ = ythresh_max;
}

4.

depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScan.h中添加

const float constant_y = unit_scaling / cam_model.fy(); // line 181double y = (v - center_y) * depth * constant_y; //line 206
if(yythresh_max_)
{r = std::numeric_limits::quiet_NaN();continue;
}

在使用y阈值之前,首先要将scan_height调大,由于realsense分辨率为640*480,因此设置scan_height:320。
直接将参数添加至depthimage_to_laserscan/launch/use_my_D435i.launch文件中。

\ 

5.用上面同样的方法查看结果

在这里插入图片描述

相关内容

热门资讯

无地自容!公开喊冤刚半个月,证... 打脸来得太快,让人无地自容!近日,上市公司贵州百灵实控人姜伟收到证监会出局的行政处罚告知书,因涉嫌组...
54岁芦苇擢升履新!“老中信”... 出品|达摩财经12月23日,中国邮政集团官网发布消息显示,集团召开党组会议,宣布了中共中央组织部关于...
亿纬锂能双线出击:钠电补位锂电... 近日,广东惠州仲恺高新区,亿纬锂能惠州总部D区的一块空地上,铲车启动的轰鸣声宣告了“亿纬钠能总部和金...
IPO观察|龙旗科技15个月完... 红星资本局12月23日消息 日前,龙旗科技(603341.SH)公告H股发行进展,香港联交所上市委员...
国民养老再引4家地方国资股东入... 专为保险业 打造的垂直新媒体平台继引入外资股东后,“不差钱”的国民养老保险股份有限公司(下称“国民养...
北交所首例!生物谷原实控人获刑... 本文来源:时代周报 作者:周松清北交所首例背信损害上市公司利益案二审落定。12月22日晚间,生物谷(...
电子产品涨价潮,才刚刚开始..... 订阅 快刀财经 ▲ 做您的私人商学院内存涨价的蝴蝶翅膀一扇,将压力传导给整个科技行业。作者 :张哲来...
天味食品募资扩张迷局 中经记者 蒋政 北京报道一边积极布局登陆港股,筹划募资投建营销网络及数字化等项目;另一边则继续将5年...
A股回购规模超1400亿元,真... 2025年回购金额排名前十上市公司,数据截至12月23日本报(chinatimes.net.cn)记...
快手为何“失守”? 快手的危机真的过去了吗?12月23日中午,快手发布公告称,快手的直播功能于2025年12月22日22...