6 #include <pcl/point_cloud.h> 7 #include <pcl/point_types.h> 14 #include <sensor_msgs/PointCloud2.h> 69 pnh.
param(
"queue_size", queueSize, queueSize);
71 pnh.
param(
"approx_sync", approx, approx);
72 pnh.
param(
"count", count, count);
77 std::string subscribedTopicsMsg;
92 subscribedTopicsMsg =
uFormat(
"\n%s subscribed to (%s sync):\n %s,\n %s,\n %s,\n %s",
94 approx?
"approx":
"exact",
113 subscribedTopicsMsg =
uFormat(
"\n%s subscribed to (%s sync):\n %s,\n %s,\n %s",
115 approx?
"approx":
"exact",
132 subscribedTopicsMsg =
uFormat(
"\n%s subscribed to (%s sync):\n %s,\n %s",
134 approx?
"approx":
"exact",
146 const sensor_msgs::PointCloud2ConstPtr & cloudMsg_2,
147 const sensor_msgs::PointCloud2ConstPtr & cloudMsg_3,
148 const sensor_msgs::PointCloud2ConstPtr & cloudMsg_4)
150 std::vector<sensor_msgs::PointCloud2ConstPtr> clouds;
151 clouds.push_back(cloudMsg_1);
152 clouds.push_back(cloudMsg_2);
153 clouds.push_back(cloudMsg_3);
154 clouds.push_back(cloudMsg_4);
159 const sensor_msgs::PointCloud2ConstPtr & cloudMsg_2,
160 const sensor_msgs::PointCloud2ConstPtr & cloudMsg_3)
162 std::vector<sensor_msgs::PointCloud2ConstPtr> clouds;
163 clouds.push_back(cloudMsg_1);
164 clouds.push_back(cloudMsg_2);
165 clouds.push_back(cloudMsg_3);
170 const sensor_msgs::PointCloud2ConstPtr & cloudMsg_2)
172 std::vector<sensor_msgs::PointCloud2ConstPtr> clouds;
173 clouds.push_back(cloudMsg_1);
174 clouds.push_back(cloudMsg_2);
178 void combineClouds(
const std::vector<sensor_msgs::PointCloud2ConstPtr> & cloudMsgs)
184 pcl::PCLPointCloud2 output;
187 if(!frameId.empty() && frameId.compare(cloudMsgs[0]->
header.frame_id) != 0)
189 sensor_msgs::PointCloud2 tmp;
196 frameId = cloudMsgs[0]->header.frame_id;
199 for(
unsigned int i=1; i<cloudMsgs.size(); ++i)
201 pcl::PCLPointCloud2 cloud2;
202 if(frameId.compare(cloudMsgs[i]->header.frame_id) != 0)
204 sensor_msgs::PointCloud2 tmp;
211 frameId = cloudMsgs[i]->header.frame_id;
214 pcl::PCLPointCloud2 tmp_output;
219 sensor_msgs::PointCloud2 rosCloud;
221 rosCloud.header.stamp = cloudMsgs[0]->header.stamp;
222 rosCloud.header.frame_id = frameId;
227 void warningLoop(
const std::string & subscribedTopicsMsg,
bool approxSync)
235 ROS_WARN(
"%s: Did not receive data since 5 seconds! Make sure the input topics are " 236 "published (\"$ rostopic hz my_topic\") and the timestamps in their " 237 "header are set. %s%s",
239 approxSync?
"":
"Parameter \"approx_sync\" is false, which means that input " 240 "topics should have all the exact timestamp for the callback to be called.",
241 subscribedTopicsMsg.c_str());
message_filters::Synchronizer< ExactSync4Policy > * exactSync4_
std::string getTopic() const
message_filters::Subscriber< sensor_msgs::PointCloud2 > cloudSub_2_
std::string uFormat(const char *fmt,...)
void publish(const boost::shared_ptr< M > &message) const
message_filters::Subscriber< sensor_msgs::PointCloud2 > cloudSub_3_
message_filters::sync_policies::ExactTime< sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2 > ExactSync3Policy
const std::string & getName() const
message_filters::Synchronizer< ExactSync2Policy > * exactSync2_
void clouds3_callback(const sensor_msgs::PointCloud2ConstPtr &cloudMsg_1, const sensor_msgs::PointCloud2ConstPtr &cloudMsg_2, const sensor_msgs::PointCloud2ConstPtr &cloudMsg_3)
message_filters::Synchronizer< ApproxSync3Policy > * approxSync3_
boost::thread * warningThread_
ros::NodeHandle & getPrivateNodeHandle() const
void combineClouds(const std::vector< sensor_msgs::PointCloud2ConstPtr > &cloudMsgs)
void clouds4_callback(const sensor_msgs::PointCloud2ConstPtr &cloudMsg_1, const sensor_msgs::PointCloud2ConstPtr &cloudMsg_2, const sensor_msgs::PointCloud2ConstPtr &cloudMsg_3, const sensor_msgs::PointCloud2ConstPtr &cloudMsg_4)
virtual ~PointCloudAggregator()
message_filters::sync_policies::ApproximateTime< sensor_msgs::PointCloud2, sensor_msgs::PointCloud2 > ApproxSync2Policy
message_filters::Synchronizer< ExactSync3Policy > * exactSync3_
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::NodeHandle & getNodeHandle() const
message_filters::sync_policies::ExactTime< sensor_msgs::PointCloud2, sensor_msgs::PointCloud2 > ExactSync2Policy
bool concatenatePointCloud(const sensor_msgs::PointCloud2 &cloud1, const sensor_msgs::PointCloud2 &cloud2, sensor_msgs::PointCloud2 &cloud_out)
#define NODELET_INFO(...)
uint32_t getNumSubscribers() const
void subscribe(ros::NodeHandle &nh, const std::string &topic, uint32_t queue_size, const ros::TransportHints &transport_hints=ros::TransportHints(), ros::CallbackQueueInterface *callback_queue=0)
tf::TransformListener tfListener_
void transformPointCloud(const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, const tf::Transform &transform)
message_filters::sync_policies::ApproximateTime< sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2 > ApproxSync3Policy
message_filters::sync_policies::ExactTime< sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2 > ExactSync4Policy
PLUGINLIB_EXPORT_CLASS(rtabmap_ros::CoreWrapper, nodelet::Nodelet)
void moveFromPCL(pcl::PCLImage &pcl_image, sensor_msgs::Image &image)
void clouds2_callback(const sensor_msgs::PointCloud2ConstPtr &cloudMsg_1, const sensor_msgs::PointCloud2ConstPtr &cloudMsg_2)
message_filters::Synchronizer< ApproxSync2Policy > * approxSync2_
message_filters::sync_policies::ApproximateTime< sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2, sensor_msgs::PointCloud2 > ApproxSync4Policy
void warningLoop(const std::string &subscribedTopicsMsg, bool approxSync)
message_filters::Subscriber< sensor_msgs::PointCloud2 > cloudSub_4_
void toPCL(const ros::Time &stamp, pcl::uint64_t &pcl_stamp)
message_filters::Subscriber< sensor_msgs::PointCloud2 > cloudSub_1_
message_filters::Synchronizer< ApproxSync4Policy > * approxSync4_