vtp
ROS::多话题消息同步
ROS::多话题消息同步
#include<ros/ros.h>
#include"nsor_msgs/LarScan.h"
#include"geometry_msgs/PoWithCovarianceStamped.h"
#include<message_filters/subscriber.h>
战色
#include<message_filters/synchronizer.h>
horrible的反义词
#include<message_filters/sync_policies/approximate_time.h>
#include<message_filters/time_synchronizer.h>
#include<boost/thread/thread.hpp>
cocktailampere#include<iostream>
科学的英语
void multi_callback(const nsor_msgs::LarScanConstPtr& scan,const geometry_msgs::PoWithCovarianceStampedConstPtr& po)
{
std::cout <<"同步完成!"<< std::endl;dock是什么
}
int main(int argc,char** argv)
英语手抄报版面设计图
{
ros::init(argc, argv,"multi_receiver");
dataceros::NodeHandle n;
message_filters::Subscriber<nsor_msgs::LarScan>subscriber_lar(n,"scan",1000,ros::TransportHints().tcpNoDelay());
message_filters::Subscriber<geometry_msgs::PoWithCovarianceStamped>subscriber_po(n,"car_po",1000,ros::TransportHints().tcpNoDelay());
typedef message_filters::sync_policies::ApproximateTime<nsor_msgs::LarScan, geometry_msgs::PoWithCovarianceStamped> syncPolicy;
//message_filters::TimeSynchronizer<nsor_msgs::LarScan,geometry_msgs::PoWithCovarianceStamped> sync(subscriber_lar, subscriber_pos e, 10);
message_filters::Synchronizer<syncPolicy>sync(syncPolicy(10), subscriber_lar, subscriber_po);
resumestd::cout <<"hahah"<< std::endl;
ros::spin();
return0;
}