mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
mrs_lib::SubscribeHandler< MessageType >::Impl< MessageType > Class Template Reference
+ Inheritance diagram for mrs_lib::SubscribeHandler< MessageType >::Impl< MessageType >:

Public Types

using timeout_callback_t = typename SubscribeHandler< MessageType >::timeout_callback_t
 
using message_callback_t = typename SubscribeHandler< MessageType >::message_callback_t
 
using data_callback_t = std::function< void(const typename MessageType::ConstPtr &)>
 

Public Member Functions

 Impl (const SubscribeHandlerOptions &options, const message_callback_t &message_callback=message_callback_t())
 
virtual MessageType::ConstPtr getMsg ()
 
virtual MessageType::ConstPtr peekMsg () const
 
virtual bool hasMsg () const
 
virtual bool newMsg () const
 
virtual bool usedMsg () const
 
virtual MessageType::ConstPtr waitForNew (const ros::WallDuration &timeout)
 
virtual ros::Time lastMsgTime () const
 
virtual std::string topicName () const
 
virtual uint32_t getNumPublishers () const
 
virtual void setNoMessageTimeout (const ros::Duration &timeout)
 
virtual void start ()
 
virtual void stop ()
 

Protected Member Functions

void default_timeout_callback (const std::string &topic_name, const ros::Time &last_msg)
 
void process_new_message (const typename MessageType::ConstPtr &msg)
 
virtual void data_callback (const typename MessageType::ConstPtr &msg)
 

Protected Attributes

ros::NodeHandle m_nh
 
ros::Subscriber m_sub
 
std::string m_topic_name
 
std::string m_node_name
 
bool m_got_data
 
std::mutex m_new_data_mtx
 
std::condition_variable m_new_data_cv
 
bool m_new_data
 
bool m_used_data
 
std::shared_ptr< mrs_lib::TimeoutManagerm_timeout_manager
 
std::optional< mrs_lib::TimeoutManager::timeout_id_t > m_timeout_id
 
mrs_lib::TimeoutManager::callback_t m_timeout_mgr_callback
 
ros::Time m_latest_message_time
 
MessageType::ConstPtr m_latest_message
 
message_callback_t m_message_callback
 

Friends

class SubscribeHandler< MessageType >
 

The documentation for this class was generated from the following file: