25 #ifndef MESSAGE_RELAY_RELAY_TOPIC_RELAY_H 26 #define MESSAGE_RELAY_RELAY_TOPIC_RELAY_H 53 : type(), topic(), origin(), target(), frame_id_processor(), time_processor(), latch(false),
54 throttle_frequency(0.0), queue_size(100), callback_queue(), unreliable(false)
71 template<
typename MessageType>
86 pub_options_ = ros::AdvertiseOptions::create<MessageType>(
93 pub_options_.latch = params.
latch;
95 sub_options_ = ros::SubscribeOptions::create<MessageType>(
97 pub_options_.queue_size,
103 sub_ = boost::make_shared<ros::Subscriber>(origin_->subscribe(sub_options_));
104 pub_ = boost::make_shared<ros::Publisher>(target_->advertise(pub_options_));
107 void topicCb(
const typename MessageType::ConstPtr &input)
109 if (!throttle_duration_.isZero())
123 typename MessageType::ConstPtr output;
125 if (frame_id_processor_ || time_processor_)
127 typename MessageType::Ptr
msg = boost::make_shared<MessageType>(*input);
128 if (frame_id_processor_)
136 output = boost::static_pointer_cast<MessageType
const>(msg);
142 pub_->publish(output);
160 #endif // MESSAGE_RELAY_RELAY_TOPIC_RELAY_H boost::shared_ptr< ros::CallbackQueue > callback_queue
TopicRelayImpl(const TopicRelayParams ¶ms)
boost::shared_ptr< void const > VoidConstPtr
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
double throttle_frequency
ros::SubscribeOptions sub_options_
boost::shared_ptr< ros::NodeHandle > target
TimeProcessor::ConstPtr time_processor
TimeProcessor::ConstPtr time_processor_
boost::shared_ptr< TopicRelay > Ptr
FrameIdProcessor::ConstPtr frame_id_processor_
boost::shared_ptr< ros::Subscriber > sub_
FrameIdProcessor::ConstPtr frame_id_processor
TransportHints & unreliable()
ros::Duration throttle_duration_
boost::shared_ptr< ros::Publisher > pub_
TopicRelay::Ptr createTopicRelay(const TopicRelayParams ¶ms)
ros::AdvertiseOptions pub_options_
boost::shared_ptr< ros::NodeHandle > target_
static void processMessage(typename Message::Ptr &msg, typename Processor::ConstPtr &processor)
void topicCb(const typename MessageType::ConstPtr &input)
boost::shared_ptr< ros::NodeHandle > origin