mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
mrs_lib::SubscribeHandlerOptions Struct Reference

A helper class to simplify setup of SubscribeHandler construction. This class is passed to the SubscribeHandler constructor and specifies its common options. More...

#include <subscribe_handler.h>

Public Member Functions

 SubscribeHandlerOptions (const ros::NodeHandle &nh)
 

Public Attributes

ros::NodeHandle nh
 The ROS NodeHandle to be used for subscription.
 
std::string node_name = {}
 Name of the ROS node, using this handle (used for messages printed to console).
 
std::string topic_name = {}
 Name of the ROS topic to be handled.
 
std::shared_ptr< mrs_lib::TimeoutManagertimeout_manager = nullptr
 Will be used for handling message timouts if necessary. If no manager is specified, it will be created with rate equal to half of no_message_timeout.
 
ros::Duration no_message_timeout = mrs_lib::no_timeout
 If no new message is received for this duration, the timeout_callback function will be called. If timeout_callback is empty, an error message will be printed to the console.
 
std::function< void(const std::string &topic_name, const ros::Time &last_msg)> timeout_callback = {}
 This function will be called if no new message is received for the no_message_timeout duration. If this variable is empty, an error message will be printed to the console.
 
bool threadsafe = true
 If true, all methods of the SubscribeHandler will be mutexed (using a recursive mutex) to avoid data races.
 
bool autostart = true
 If true, the SubscribeHandler will be started after construction. Otherwise it has to be started using the start() method.
 
uint32_t queue_size = 3
 This parameter is passed to the NodeHandle when subscribing to the topic.
 
ros::TransportHints transport_hints = ros::TransportHints()
 This parameter is passed to the NodeHandle when subscribing to the topic.
 

Detailed Description

A helper class to simplify setup of SubscribeHandler construction. This class is passed to the SubscribeHandler constructor and specifies its common options.

Note
Any option, passed directly to the SubscribeHandler constructor outside this structure, OVERRIDES values in this structure. The values in this structure can be thought of as default common values for all SubscribeHandler objects you want to create, and values passed directly to the constructor as specific options for the concrete handler.
Examples
subscribe_handler/example.cpp, and subscribe_handler/simple_example.cpp.

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