1 #ifndef SLAM_CTOR_ROS_TOPIC_WITH_TRANSFORM_H 2 #define SLAM_CTOR_ROS_TOPIC_WITH_TRANSFORM_H 10 #include <boost/shared_ptr.hpp> 13 template <
typename MType>
21 template <
typename MsgType>
31 const std::string& topic_name,
32 const std::string& target_frame,
33 const double buffer_duration = 5.0,
34 const uint32_t tf_filter_queue_size = 1000,
35 const uint32_t subscribers_queue_size = 1000):
36 _target_frame{target_frame},
37 _subscr{nh, topic_name, subscribers_queue_size},
40 _subscr, _tf_lsnr, _target_frame, tf_filter_queue_size}} {
46 _observers.push_back(obs);
51 std::string msg_frame_id =
59 _tf_lsnr.lookupTransform(_target_frame, msg_frame_id,
63 ROS_ERROR(
"Transform retrieval failed. %s",ex.what());
67 for (
auto obs : _observers) {
68 if (
auto obs_ptr = obs.lock()) {
69 obs_ptr->handle_transformed_msg(msg, transform);
77 std::unique_ptr<tf::MessageFilter<MsgType>>
_msg_flt;
78 std::vector<std::weak_ptr<TopicObserver<MsgType>>>
_observers;
virtual void handle_transformed_msg(const boost::shared_ptr< MType >, const tf::StampedTransform &)=0
Connection registerCallback(const C &callback)