有些小车车身比较长,如果是一个激光雷达,顾前不顾后,有比较大的视野盲区,这对小车导航定位避障来说都是一个问题,比如AGV小车,

所有想在小车前后各加一个雷达,那问题是ROS的建图或者定位导航都只是支持一个雷达,这个时候就需要我们做2个雷达的融合了。

方法比较简单:我的思路是先将两个激光雷达获得的laser_scan转成point_cloud也就是点云,利用pcl库将两个点云拼接在一起,然后在把拼接后的点云重新转成laser_scan。

这样ros里面建图导航都可以用了。

关键点是要把两个激光雷达的偏移量算好,以及雷达的时间同步。代码也比较简单,贴出部分关键代码:

//时间同步

message_filters::Subscriber<sensor_msgs::PointCloud2> points_sub_left(nh, left_topic, 10);
message_filters::Subscriber<sensor_msgs::PointCloud2> points_sub_right(nh, right_topic, 10);
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2> MySyncPolicy;
message_filters::Synchronizer<MySyncPolicy> sync(MySyncPolicy(100000), points_sub_left, points_sub_right);
sync.registerCallback(boost::bind(&callback, _1, _2));

g_left_right_point_pub = nh.advertise<sensor_msgs::PointCloud2>(fusion_topic, 10);

//ros回调函数,拼接点云

void callback(const sensor_msgs::PointCloud2::ConstPtr& left_input, const sensor_msgs::PointCloud2::ConstPtr& right_input)
{
pcl::PointCloud<pcl::PointXYZI>::Ptr left_local_laser(new pcl::PointCloud<pcl::PointXYZI>());
pcl::fromROSMsg(*left_input, *left_local_laser);

pcl::PointCloud<pcl::PointXYZI>::Ptr left_calibration_cloud(new pcl::PointCloud<pcl::PointXYZI>());
pcl::transformPointCloud(*left_local_laser, *left_calibration_cloud, g_left_calibration_matrix);

for(std::size_t i = 0; i < left_calibration_cloud->size(); ++i)
{
left_calibration_cloud->points[i].intensity = 64;
}

// publishCloudI(&g_left_calib_point_pub, *left_calibration_cloud);

pcl::PointCloud<pcl::PointXYZI>::Ptr right_local_laser(new pcl::PointCloud<pcl::PointXYZI>());
pcl::fromROSMsg(*right_input, *right_local_laser);

pcl::PointCloud<pcl::PointXYZI>::Ptr right_calibration_cloud(new pcl::PointCloud<pcl::PointXYZI>());
pcl::transformPointCloud(*right_local_laser, *right_calibration_cloud, g_right_calibration_matrix);
for(std::size_t i = 0; i < right_calibration_cloud->size(); ++i)
{
right_calibration_cloud->points[i].intensity = 128;
}

pcl::PointCloud<pcl::PointXYZI>::Ptr left_right_middle_calibration_cloud(new pcl::PointCloud<pcl::PointXYZI>());
*left_right_middle_calibration_cloud = *left_calibration_cloud + *right_calibration_cloud;

publishCloudI(&g_left_right_point_pub, *left_right_middle_calibration_cloud);
}

ROS下多雷达融合算法的更多相关文章

  1. Rplidar学习(四)—— ROS下进行rplidar雷达数据采集源码分析

    一.子函数分析 1.发布数据子函数 (1)雷达数据数据类型 Header header # timestamp in the header is the acquisition time of # t ...

  2. LSD-SLAM深入学习(1)-基本介绍与ros下的安装

    前言 借鉴来自RGB-D数据处理的两种方法-基于特征与基于整体的,同样可以考虑整个图片的匹配,而不是只考虑特征点的…… 一般这种稠密的方法需要很大的计算量,DTAM: Dense tracking a ...

  3. Google Cardboard的九轴融合算法——基于李群的扩展卡尔曼滤波

    Google Cardboard的九轴融合算法 --基于李群的扩展卡尔曼滤波 极品巧克力 前言 九轴融合算法是指通过融合IMU中的加速度计(三轴).陀螺仪(三轴).磁场计(三轴),来获取物体姿态的方法 ...

  4. pl-svo在ROS下运行笔记

    一.程序更改的思路(参考svo_ros的做法): 1.在ROS下将pl-svo链接成库需要更改相应的CMakeLists.txt文件,添加package.xml文件: 2.注册一个ROS节点使用svo ...

  5. 基于均值坐标(Mean-Value Coordinates)的图像融合算法的具体实现

    目录 1. 概述 2. 实现 2.1. 准备 2.2. 核心 2.2.1. 均值坐标(Mean-Value Coordinates) 2.2.2. ROI边界栅格化 2.2.3. 核心实现 2.2.4 ...

  6. ros下多机器人系统(1)

    multi-robot system 经过两个多月的ros学习,对ros的认识有了比较深入的了解,本篇博客主要记录在ros下开发多机器人系统以及对ros更深入的开发.本篇博客是假定读者已经学习完了全部 ...

  7. [stm32] MPU6050 HMC5883 Kalman 融合算法移植

    一.卡尔曼滤波九轴融合算法stm32尝试 1.Kalman滤波文件[.h已经封装为结构体] /* Copyright (C) 2012 Kristian Lauszus, TKJ Electronic ...

  8. ZED 相机 && ORB-SLAM2安装环境配置与ROS下的调试

    注:1. 对某些地方进行了更新(红色标注),以方便进行配置. 2. ZED ROS Wrapper官方github已经更新,根据描述新的Wrapper可能已经不适用与Ros Indigo了,如果大家想 ...

  9. ORB-SLAM2(2) ROS下配置和编译

    1配置USB相机 1.1网友参考: http://www.liuxiao.org/2016/07/ubuntu-orb-slam2-%E5%9C%A8-ros-%E4%B8%8A%E7%BC%96%E ...

随机推荐

  1. avd manger创建的虚拟机启动不起来,或者启动起来后黑屏

    最近鼓捣安卓虚拟机,整的都差点重装系统,刚开始下载了genymotion_vbox,装完以后要在vbox中导入一个虚拟机,结果我导入完,虚拟机怎么也启动不了,然后各种找办法无果,最后重启电脑发现电脑也 ...

  2. 如何使用终端默认情况下阻止Mac应用保存到iCloud

    当您保存要在Mac上的Pages,Numbers,TextEdit或其他基于云的应用程序中处理的文档时,该保存的默认位置是iCloud.尽管这对某些人或某些文档来说可能是一件好事,但您可能会厌倦每次更 ...

  3. 用Python代码写的计算器

    1.极限压缩版 import re, functools def cal(formula): while re.search('(?:\d+\.?\d+|\d+)[+\-*/]', formula): ...

  4. Java学习关于setContentPane()和getContentPane()的应用

    http://www.java-gaming.org/topics/active-rendering-in-j2me/25240/view.html

  5. IntersectionObserver API,观察元素是否进入了可视区域

    网页开发时,常常需要了解某个元素是否进入了"视口"(viewport),即用户能不能看到它. 上图的绿色方块不断滚动,顶部会提示它的可见性. 传统的实现方法是,监听到scroll事 ...

  6. SpringMVC参数绑定,这篇就够了!

    SpringMVC参数绑定,简单来说就是将客户端请求的key/value数据绑定到controller方法的形参上,然后就可以在controller中使用该参数了 下面通过5个常用的注解演示下如何进行 ...

  7. 一起学Android之Handler

    概述 在Android开发中,有主线程(UI线程)和工作线程(Worker线程)之分,两个线程是相互独立的,并不能相互访问(主线程主要负责UI的更新,不能进行耗时的操作,工作线程主要负责耗时的操作,但 ...

  8. llinux/重启/用户切换/注销

    一.指令 shutdown命令 shutdown -h now //立即关机 shutdown -h 2 //分钟后关机 shutdown -r now //立即重启 shutdown -r 1 // ...

  9. 由浅入深了解RabbitMQ

    简介 RabbitMQ是流行的开源消息队列系统.RabbitMQ是AMQP(高级消息队列协议)的标准实现.支持多种客户端,如:Python.Ruby..NET.Java.JMS.C.PHP.Actio ...

  10. Implement Property Value Validation in Code 在代码中实现属性值验证(XPO)

    This lesson explains how to set rules for business classes and their properties. These rules are val ...