当前位置:网站首页>ROS知识点——消息过滤器 ( message_filters)
ROS知识点——消息过滤器 ( message_filters)
2022-07-02 14:49:00 【Jerry_Sea】
参考:
1)时间同步器
https://blog.csdn.net/u012700322/article/details/51784412
https://blog.csdn.net/fana8010/article/details/23880067(这篇文章是上一篇的原文)
2)基于策略的同步器
https://blog.csdn.net/muyiyushan/article/details/118418040(官网翻译,第7部分)
http://wiki.ros.org/message_filters#Policy-Based_Synchronizer_.5BROS_1.1.2B-.5D(官网,第7部分)
以下是针对参考1)中的第一篇内容:
bug1:3.1 连接
两句等价成一句,但为什么要分开成两句呢?因为只使用一句只能读取一个输入传给回调函数,所以需要使用两句,先用一句分开将多个数据封装好,然后再用一句将多个数据传给回调函数。
boost bind
bug2:4 时间一致器
The TimeSynchronizer filter synchronizes incoming channels by the timestamps contained in their headers
PointCloud2ROS点云数据消息结构:header里面有个stamp,比较不同数据源的stamp来进行时间同步。
以下是针对参考2)中的解释:
bug3:对“自己”代码的理解
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::PointCloud2, sensor_msgs::PointCloud2> SyncPolicyT;
//定义策略,message_filters::sync_policies::ApproximateTime策略使用一个基于时间戳的自适应算法匹配消息,匹配两个点云
void DualLidarCalib::start()
{
// 订阅器 sub and pub
parent_cloud_sub_ = new message_filters::Subscriber<sensor_msgs::PointCloud2>(nh_, parent_cloud_topic_, 10);
child_cloud_sub_ = new message_filters::Subscriber<sensor_msgs::PointCloud2>(nh_, child_cloud_topic_, 10);
//点云同步器 ApproximateTime takes a queue size as its constructor argument, hence MySyncPolicy(100)
cloud_synchronizer_ = new message_filters::Synchronizer<SyncPolicyT>(SyncPolicyT(100), *parent_cloud_sub_, *child_cloud_sub_);
//调用回调函数
cloud_synchronizer_->registerCallback(boost::bind(&DualLidarCalib::cloudCallback, this, _1, _2));
//registerCallback()输入为const boost::shared_ptr<M const>&
}
void DualLidarCalib::cloudCallback(const sensor_msgs::PointCloud2::ConstPtr& in_parent_cloud_msg,
const sensor_msgs::PointCloud2::ConstPtr& in_child_cloud_msg)
{
...
}
boost::bind()理解:
1)https://blog.csdn.net/holyjw/article/details/89883363(只用看“1. 通过functions和function pointers使用bind”)
2)https://blog.csdn.net/bj318318/article/details/116200356(只用看“1介绍”)
边栏推荐
- linux安装postgresql + patroni 集群问题
- Leetcode question brushing record | 933_ Recent requests
- 智能垃圾桶(五)——点亮OLED
- Ap和F107数据来源及处理
- IP address translation address segment
- Just a coincidence? The mysterious technology of apple ios16 is even consistent with the products of Chinese enterprises five years ago!
- OpenHarmony如何启动远程设备的FA
- 871. 最低加油次数
- Green bamboo biological sprint Hong Kong stocks: loss of more than 500million during the year, tiger medicine and Beijing Yizhuang are shareholders
- Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion
猜你喜欢

Use the API port of the bridge of knowledge and action to provide resources for partners to access

博客主题 “Text“ 夏日清新特别版

Linux Installation PostgreSQL + Patroni cluster problem

Believe in yourself and finish the JVM interview this time

Notice on holding a salon for young editors of scientific and Technological Journals -- the abilities and promotion strategies that young editors should have in the new era

Soul, a social meta universe platform, rushed to Hong Kong stocks: Tencent is a shareholder with an annual revenue of 1.28 billion

TCP congestion control details | 2 background

Smart trash can (V) - light up OLED

QWebEngineView崩溃及替代方案

Eth data set download and related problems
随机推荐
Experience home office, feel the completion of the project | community essay solicitation
【Leetcode】14. Longest Common Prefix
详细介绍scrollIntoView()方法属性
Changwan group rushed to Hong Kong stocks: the annual revenue was 289million, and Liu Hui had 53.46% voting rights
Configure MySQL under Linux to authorize a user to access remotely, which is not restricted by IP
Eth data set download and related problems
一年顶十年
深度之眼(三)——矩阵的行列式
2322. Remove the minimum fraction of edges from the tree (XOR and & Simulation)
What is agile development process
Timing / counter of 32 and 51 single chip microcomputer
Detailed explanation of @accessories annotation of Lombok plug-in
871. Minimum refueling times
Understand one article: four types of data index system
[shutter] dart data type (dynamic data type)
Youzan won the "top 50 Chinese enterprise cloud technology service providers" together with Tencent cloud and Alibaba cloud [easy to understand]
Sword finger offer 25 Merge two sorted linked lists
How openharmony starts FA of remote devices
IP address translation address segment
剑指 Offer 22. 链表中倒数第k个节点