35 #define IMAGE_CONVERSION() \ 37 std::vector<cv_bridge::CvImageConstPtr> imageMsgs(3); \ 38 std::vector<cv_bridge::CvImageConstPtr> depthMsgs(3); \ 39 rtabmap_ros::toCvShare(image1Msg, imageMsgs[0], depthMsgs[0]); \ 40 rtabmap_ros::toCvShare(image2Msg, imageMsgs[1], depthMsgs[1]); \ 41 rtabmap_ros::toCvShare(image3Msg, imageMsgs[2], depthMsgs[2]); \ 42 std::vector<sensor_msgs::CameraInfo> cameraInfoMsgs; \ 43 cameraInfoMsgs.push_back(image1Msg->rgbCameraInfo); \ 44 cameraInfoMsgs.push_back(image2Msg->rgbCameraInfo); \ 45 cameraInfoMsgs.push_back(image3Msg->rgbCameraInfo); 48 void CommonDataSubscriber::rgbd3Callback(
49 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
50 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
51 const rtabmap_ros::RGBDImageConstPtr& image3Msg)
55 nav_msgs::OdometryConstPtr odomMsg;
56 rtabmap_ros::UserDataConstPtr userDataMsg;
57 sensor_msgs::LaserScanConstPtr scanMsg;
58 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
59 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
60 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
62 void CommonDataSubscriber::rgbd3Scan2dCallback(
63 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
64 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
65 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
66 const sensor_msgs::LaserScanConstPtr& scanMsg)
70 nav_msgs::OdometryConstPtr odomMsg;
71 rtabmap_ros::UserDataConstPtr userDataMsg;
72 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
73 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
74 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
76 void CommonDataSubscriber::rgbd3Scan3dCallback(
77 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
78 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
79 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
80 const sensor_msgs::PointCloud2ConstPtr& scan3dMsg)
84 nav_msgs::OdometryConstPtr odomMsg;
85 rtabmap_ros::UserDataConstPtr userDataMsg;
86 sensor_msgs::LaserScanConstPtr scanMsg;
87 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
88 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
90 void CommonDataSubscriber::rgbd3InfoCallback(
91 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
92 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
93 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
94 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
98 nav_msgs::OdometryConstPtr odomMsg;
99 rtabmap_ros::UserDataConstPtr userDataMsg;
100 sensor_msgs::LaserScanConstPtr scanMsg;
101 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
102 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
104 void CommonDataSubscriber::rgbd3Scan2dInfoCallback(
105 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
106 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
107 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
108 const sensor_msgs::LaserScanConstPtr& scanMsg,
109 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
113 nav_msgs::OdometryConstPtr odomMsg;
114 rtabmap_ros::UserDataConstPtr userDataMsg;
115 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
116 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
118 void CommonDataSubscriber::rgbd3Scan3dInfoCallback(
119 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
120 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
121 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
122 const sensor_msgs::PointCloud2ConstPtr& scan3dMsg,
123 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
127 nav_msgs::OdometryConstPtr odomMsg;
128 rtabmap_ros::UserDataConstPtr userDataMsg;
129 sensor_msgs::LaserScanConstPtr scanMsg;
130 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
134 void CommonDataSubscriber::rgbd3OdomCallback(
135 const nav_msgs::OdometryConstPtr & odomMsg,
136 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
137 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
138 const rtabmap_ros::RGBDImageConstPtr& image3Msg)
142 rtabmap_ros::UserDataConstPtr userDataMsg;
143 sensor_msgs::LaserScanConstPtr scanMsg;
144 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
145 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
146 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
148 void CommonDataSubscriber::rgbd3OdomScan2dCallback(
149 const nav_msgs::OdometryConstPtr & odomMsg,
150 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
151 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
152 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
153 const sensor_msgs::LaserScanConstPtr& scanMsg)
157 rtabmap_ros::UserDataConstPtr userDataMsg;
158 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
159 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
160 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
162 void CommonDataSubscriber::rgbd3OdomScan3dCallback(
163 const nav_msgs::OdometryConstPtr & odomMsg,
164 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
165 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
166 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
167 const sensor_msgs::PointCloud2ConstPtr& scan3dMsg)
171 rtabmap_ros::UserDataConstPtr userDataMsg;
172 sensor_msgs::LaserScanConstPtr scanMsg;
173 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
174 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
176 void CommonDataSubscriber::rgbd3OdomInfoCallback(
177 const nav_msgs::OdometryConstPtr & odomMsg,
178 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
179 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
180 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
181 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
185 rtabmap_ros::UserDataConstPtr userDataMsg;
186 sensor_msgs::LaserScanConstPtr scanMsg;
187 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
188 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
190 void CommonDataSubscriber::rgbd3OdomScan2dInfoCallback(
191 const nav_msgs::OdometryConstPtr & odomMsg,
192 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
193 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
194 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
195 const sensor_msgs::LaserScanConstPtr& scanMsg,
196 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
200 rtabmap_ros::UserDataConstPtr userDataMsg;
201 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
202 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
204 void CommonDataSubscriber::rgbd3OdomScan3dInfoCallback(
205 const nav_msgs::OdometryConstPtr & odomMsg,
206 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
207 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
208 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
209 const sensor_msgs::PointCloud2ConstPtr& scan3dMsg,
210 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
214 rtabmap_ros::UserDataConstPtr userDataMsg;
215 sensor_msgs::LaserScanConstPtr scanMsg;
216 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
220 void CommonDataSubscriber::rgbd3DataCallback(
221 const rtabmap_ros::UserDataConstPtr& userDataMsg,
222 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
223 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
224 const rtabmap_ros::RGBDImageConstPtr& image3Msg)
228 nav_msgs::OdometryConstPtr odomMsg;
229 sensor_msgs::LaserScanConstPtr scanMsg;
230 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
231 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
232 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
234 void CommonDataSubscriber::rgbd3DataScan2dCallback(
235 const rtabmap_ros::UserDataConstPtr& userDataMsg,
236 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
237 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
238 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
239 const sensor_msgs::LaserScanConstPtr& scanMsg)
243 nav_msgs::OdometryConstPtr odomMsg;
244 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
245 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
246 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
248 void CommonDataSubscriber::rgbd3DataScan3dCallback(
249 const rtabmap_ros::UserDataConstPtr& userDataMsg,
250 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
251 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
252 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
253 const sensor_msgs::PointCloud2ConstPtr& scan3dMsg)
257 nav_msgs::OdometryConstPtr odomMsg;
258 sensor_msgs::LaserScanConstPtr scanMsg;
259 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
260 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
262 void CommonDataSubscriber::rgbd3DataInfoCallback(
263 const rtabmap_ros::UserDataConstPtr& userDataMsg,
264 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
265 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
266 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
267 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
271 nav_msgs::OdometryConstPtr odomMsg;
272 sensor_msgs::LaserScanConstPtr scanMsg;
273 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
274 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
276 void CommonDataSubscriber::rgbd3DataScan2dInfoCallback(
277 const rtabmap_ros::UserDataConstPtr& userDataMsg,
278 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
279 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
280 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
281 const sensor_msgs::LaserScanConstPtr& scanMsg,
282 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
286 nav_msgs::OdometryConstPtr odomMsg;
287 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
288 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
290 void CommonDataSubscriber::rgbd3DataScan3dInfoCallback(
291 const rtabmap_ros::UserDataConstPtr& userDataMsg,
292 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
293 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
294 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
295 const sensor_msgs::PointCloud2ConstPtr& scan3dMsg,
296 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
300 nav_msgs::OdometryConstPtr odomMsg;
301 sensor_msgs::LaserScanConstPtr scanMsg;
302 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
306 void CommonDataSubscriber::rgbd3OdomDataCallback(
307 const nav_msgs::OdometryConstPtr& odomMsg,
308 const rtabmap_ros::UserDataConstPtr& userDataMsg,
309 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
310 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
311 const rtabmap_ros::RGBDImageConstPtr& image3Msg)
315 sensor_msgs::LaserScanConstPtr scanMsg;
316 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
317 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
318 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
320 void CommonDataSubscriber::rgbd3OdomDataScan2dCallback(
321 const nav_msgs::OdometryConstPtr& odomMsg,
322 const rtabmap_ros::UserDataConstPtr& userDataMsg,
323 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
324 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
325 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
326 const sensor_msgs::LaserScanConstPtr& scanMsg)
330 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
331 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
332 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
334 void CommonDataSubscriber::rgbd3OdomDataScan3dCallback(
335 const nav_msgs::OdometryConstPtr& odomMsg,
336 const rtabmap_ros::UserDataConstPtr& userDataMsg,
337 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
338 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
339 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
340 const sensor_msgs::PointCloud2ConstPtr& scan3dMsg)
344 sensor_msgs::LaserScanConstPtr scanMsg;
345 rtabmap_ros::OdomInfoConstPtr odomInfoMsg;
346 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
348 void CommonDataSubscriber::rgbd3OdomDataInfoCallback(
349 const nav_msgs::OdometryConstPtr& odomMsg,
350 const rtabmap_ros::UserDataConstPtr& userDataMsg,
351 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
352 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
353 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
354 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
358 sensor_msgs::LaserScanConstPtr scanMsg;
359 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
360 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
362 void CommonDataSubscriber::rgbd3OdomDataScan2dInfoCallback(
363 const nav_msgs::OdometryConstPtr& odomMsg,
364 const rtabmap_ros::UserDataConstPtr& userDataMsg,
365 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
366 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
367 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
368 const sensor_msgs::LaserScanConstPtr& scanMsg,
369 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
373 sensor_msgs::PointCloud2ConstPtr scan3dMsg;
374 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
376 void CommonDataSubscriber::rgbd3OdomDataScan3dInfoCallback(
377 const nav_msgs::OdometryConstPtr& odomMsg,
378 const rtabmap_ros::UserDataConstPtr& userDataMsg,
379 const rtabmap_ros::RGBDImageConstPtr& image1Msg,
380 const rtabmap_ros::RGBDImageConstPtr& image2Msg,
381 const rtabmap_ros::RGBDImageConstPtr& image3Msg,
382 const sensor_msgs::PointCloud2ConstPtr& scan3dMsg,
383 const rtabmap_ros::OdomInfoConstPtr& odomInfoMsg)
387 sensor_msgs::LaserScanConstPtr scanMsg;
388 commonDepthCallback(odomMsg, userDataMsg, imageMsgs, depthMsgs, cameraInfoMsgs, scanMsg, scan3dMsg, odomInfoMsg);
395 bool subscribeUserData,
396 bool subscribeScan2d,
397 bool subscribeScan3d,
398 bool subscribeOdomInfo,
405 for(
int i=0; i<3; ++i)
410 if(subscribeOdom && subscribeUserData)
418 if(subscribeOdomInfo)
429 else if(subscribeScan3d)
433 if(subscribeOdomInfo)
444 else if(subscribeOdomInfo)
455 else if(subscribeOdom)
462 if(subscribeOdomInfo)
473 else if(subscribeScan3d)
477 if(subscribeOdomInfo)
488 else if(subscribeOdomInfo)
499 else if(subscribeUserData)
506 if(subscribeOdomInfo)
517 else if(subscribeScan3d)
521 if(subscribeOdomInfo)
532 else if(subscribeOdomInfo)
549 if(subscribeOdomInfo)
560 else if(subscribeScan3d)
564 if(subscribeOdomInfo)
575 else if(subscribeOdomInfo)
std::string uFormat(const char *fmt,...)
#define SYNC_DECL7(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4, SUB5, SUB6)
#define SYNC_DECL5(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4)
virtual void commonDepthCallback(const nav_msgs::OdometryConstPtr &odomMsg, const rtabmap_ros::UserDataConstPtr &userDataMsg, const std::vector< cv_bridge::CvImageConstPtr > &imageMsgs, const std::vector< cv_bridge::CvImageConstPtr > &depthMsgs, const std::vector< sensor_msgs::CameraInfo > &cameraInfoMsgs, const sensor_msgs::LaserScanConstPtr &scanMsg, const sensor_msgs::PointCloud2ConstPtr &scan3dMsg, const rtabmap_ros::OdomInfoConstPtr &odomInfoMsg)=0
#define SYNC_DECL3(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2)
message_filters::Subscriber< rtabmap_ros::UserData > userDataSub_
bool subscribedToOdomInfo_
void setupRGBD3Callbacks(ros::NodeHandle &nh, ros::NodeHandle &pnh, bool subscribeOdom, bool subscribeUserData, bool subscribeScan2d, bool subscribeScan3d, bool subscribeOdomInfo, int queueSize, bool approxSync)
#define SYNC_DECL6(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3, SUB4, SUB5)
message_filters::Subscriber< rtabmap_ros::OdomInfo > odomInfoSub_
#define IMAGE_CONVERSION()
message_filters::Subscriber< sensor_msgs::LaserScan > scanSub_
#define SYNC_DECL4(PREFIX, APPROX, QUEUE_SIZE, SUB0, SUB1, SUB2, SUB3)
message_filters::Subscriber< nav_msgs::Odometry > odomSub_
message_filters::Subscriber< sensor_msgs::PointCloud2 > scan3dSub_
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)
std::vector< message_filters::Subscriber< rtabmap_ros::RGBDImage > * > rgbdSubs_