用RGBD投影激光雷达数据:depthimage_to_laserscan
转载自知乎上:https://zhuanlan.zhihu.com/p/56559798
参考:
http://wiki.ros.org/depthimage_to_laserscan
https://github.com/ros-perception/depthimage_to_laserscan
http://blog.csdn.net/Jasmine_shine/article/details/46530143
原创博主的github 下载的话记得给颗五角星(kinetic版本) https://github.com/hiramzhang/gridmap_laser_rgbd_fusion
1.功能描述
将asus_xtion_pro获取到的深度图像depthimage进行外点、无效点剔除和图像有效区域筛选后得到待处理的深度图像{u,v};
通过深度图像{u,v}和相机模型参数cam_modle,可以求出深度图像每个像素点对应的空间点云{x,y,z};
将空间点云{x,y,z}投影到xz平面,同时用ythresh_min<y<ythresh_max进行条件约束。
2.代码修改
在https://github.com/ros-perception/depthimage_to_laserscan代码基础上,做如下修改:
(1)修改:在Depth.cfg中添加:
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)
位置:art_ws/src/depthimage_to_laserscan/cfg/Depth.cfg
目的:保存参数,为(3)(4)做准备
(2)修改:在DepthImageToLaserScanROS类的reconfigureCb()函数中添加调用:
dtl_.set_y_thresh(config.ythresh_min, config.ythresh_max);
位置:art_ws/src/depthimage_to_laserscan/src/DepthImageToLaserScanROS.cpp
(3)修改:在DepthImageToLaserScan类中添加成员函数和成员变量:
void set_y_thresh(const float ythresh_min, const float ythresh_max);
float ythresh_min_;
float ythresh_max_;
同时对set_y_thresh()进行具体实现。
实现添加内容:
void DepthImageToLaserScan::set_y_thresh(const float ythresh_min, const float ythresh_max){
ythresh_min_ = ythresh_min;
ythresh_max_ = ythresh_max;
}
位置:art_ws/src/depthimage_to_laserscan/src/DepthImageToLaserScan.cpp
目的:为(4)调用做准备
(4)修改:在DepthImageToLaserScan类的convert()方法实现中添加 :
void set_y_thresh(const float ythresh_min, const float ythresh_max);
double y = (v - center_y) * depth * constant_y;
if(y<ythresh_min_||y>ythresh_max_)
{
r = std::numeric_limits<float>::quiet_NaN();
continue;
}
float ythresh_min_;
float ythresh_max_;
目的:设置y的筛选条件
位置:/home/w/art_ws/src/depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScan.h
由于摄像头有区别,去掉dtl.launch 中的<include file="$(find astra_launch)/launch/astra.launch"/>
catkin_make 编译一遍
3.启动文件
roslaunch astra_launch astra.launch
//rosrun depthimage_to_laserscan depthimage_to_laserscan image:=/camera/depth/image_raw 这条命令不行
roslaunch depthimage_to_laserscan dtl.launch
rosrun tf static_transform_publisher 0 0 0 0 0 0 1 map camera_depth_frame 10
rosrun tf static_transform_publisher 0 0 0 0 0 0 1 map xtion_scan_frame 10
rosrun rviz rviz
rosparam get /depthimage_to_laserscan/ythresh_max
注:dtl.launch 中改参数,改后编译
4 主要内容
主要改的内容:(4)部
for(int v = offset; v < offset+scan_height_; v++, depth_row += row_step){
for (int u = 0; u < (int)depth_msg->width; u++) // Loop over each pixel in row
//像素点遍历
{
T depth = depth_row[u];
double r = depth; // Assign to pass through NaNs and Infs
double th = -atan2((double)(u - center_x) * constant_x, unit_scaling);
int index = (th - scan_msg->angle_min) / scan_msg->angle_increment;
if (depthimage_to_laserscan::DepthTraits<T>::valid(depth)){ /
double x = (u - center_x) * depth * constant_x;
double z = depthimage_to_laserscan::DepthTraits<T>::toMeters(depth);
double y = (v - center_y) * depth * constant_y;//定义y数值
if(y<-0.3||y>0.3)//如果y不符合条件就把他忽略
{
r = std::numeric_limits<float>::quiet_NaN();//精髓在这一步,没看懂
continue;
}
// Calculate actual distance
r = sqrt(pow(x, 2.0) + pow(z, 2.0));
}
// Determine if this point should be used.
if(use_point(r, scan_msg->ranges[index], scan_msg->range_min, scan_msg->range_max)){
scan_msg->ranges[index] = r;
}
}
}
}
5 各个文件之间的调用关系
1
用RGBD投影激光雷达数据:depthimage_to_laserscan相关推荐
- 值得收藏!基于激光雷达数据的深度学习目标检测方法大合集(下)
作者 | 黄浴 来源 | 转载自知乎专栏自动驾驶的挑战和发展 [导读]在近日发布的<值得收藏!基于激光雷达数据的深度学习目标检测方法大合集(上)>一文中,作者介绍了一部分各大公司和机构基于 ...
- 激光雷达数据到云cloud
激光雷达数据到云cloud 在美国地质调查局的3D提升计划(3DEP)被激发到一个新的方式可用性宣布从3DEP仓库的访问和处理激光雷达点云数据. 3DEP一直在美国使用光检测和测距(激光)技术获取三维 ...
- MeteoInfoLab脚本示例:MODIS Sinusoidal投影HDF数据
MODIS卫星很多陆面数据都是Sinusoidal投影,数据被分为一个个10*10度(赤道地区)的瓦片(http://modis-land.gsfc.nasa.gov/MODLAND_grid.htm ...
- Python+Open3D 解析Velodyne VLP-16激光雷达数据
Python+Open3D 解析Velodyne VLP-16激光雷达数据 参数简介 数据包介绍 实际数据介绍 坐标转换关系 补偿半径 运行结果 代码 最近在公司搞了搞激光雷达,把代码写一写. 参数简 ...
- 使用卡尔曼滤波和扩展卡尔曼滤波进行毫米波雷达和激光雷达数据融合示例
前言 在<无人驾驶技术入门(十三)| 手把手教你写卡尔曼滤波器>的分享中,我以激光雷达的数据为例介绍了卡尔曼滤波器(KF)的七个公式,并用C++代码实现了激光雷达障碍物的跟踪问题:在< ...
- 第一次在我的P200上自己用rviz展现激光雷达数据
第一次在我的P200上自己用rviz展现激光雷达数据 A1 A2激光雷达可以用下面这个命令启动 roslaunch rplidar_ros rplidar.launch S1激光雷达可以用下面这个命 ...
- python解析雷达数据_激光雷达数据解析(Python-lidar-data-analysis_V1.0)
2017年9月3号,杭州天气燥热,跑这来读研了,换专业了,一切从头开始. 上手的第一件事,解析激光雷达数据.(这是个半残废的小代码工程,最后不了了之,当做经验,也来写个半残废的博客) 语言: pyth ...
- 处理激光雷达数据实现目标检测的方法
处理激光雷达数据实现目标检测的方法 1.三维数据的精确性和匿名性 1.音乐节现场人数如何检测? 2.需要考虑哪些方面? 4.关于点云对象的壳体与边框 5.人们会怎么移动? 6.结果:以列表形式呈现 7 ...
- 【虹科】处理激光雷达数据实现目标检测
激光雷达传感器获取的点云可以绘制三维环境图.这种由距离点组成的"云"提供了大量有价值的环境信息.然而,对于某些应用来说,这些信息过于复杂,无法进一步处理.例如,自动驾驶功能.交通监 ...
最新文章
- 2021年大数据Spark(五十):Structured Streaming 案例一实时数据ETL架构
- php从数据库中读取特定的行
- 高项的项目管理ITTO(PMP第五版)
- Tips:重装系统后Anaconda目录在开始菜单消失问题
- php 父子进程通信,PHP 进程及进程间通信
- 软通动力华为java机考题库_华为机考笔试刷题-java-1
- fcpx插件Title Pop:78个可自定义的Final Cut Pro X动画标题+ 2个额外背景
- Redis数据类型使用场景及有序集合SortedSet底层实现详解
- svn的使用--解决commit冲突问题
- #WP7 GPS# 如何判断GPS设备可用或者用户是否开启了GPS
- Tabulator PDF下载中文字体设置
- Windows电脑上最好的3个txt阅读器
- Power bi_商品销售案例分析
- 如何在图片上快速添加文字水印?
- NmRF:从RNA序列中鉴定多物种RNA2‘-o-甲基化修饰位点(假尿苷位点)
- mysql水仙花数,水仙花数_水仙花数c语言程序
- java 开源esb_五大开源ESB项目
- 华为畅享8plus停产了吗_畅享和畅玩的区别_华为畅享8plus买完后悔了
- python画图方法_python画图的两种方法
- SQL Server 索引(index) 和 视图(view) 的简单介绍和操作