![]() |
mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
|
A helper class to simplify setup of SubscriberHandler construction. This class is passed to the SubscriberHandler constructor and specifies its common options. More...
#include <subscriber_handler.h>
Public Member Functions | |
SubscriberHandlerOptions (const rclcpp::Node::SharedPtr &node) | |
Public Attributes | |
rclcpp::Node::SharedPtr | node |
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::TimeoutManager > | timeout_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 . | |
rclcpp::Duration | no_message_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 rclcpp::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 SubscriberHandler will be mutexed (using a recursive mutex) to avoid data races. | |
bool | autostart |
If true, the SubscriberHandler will be started after construction. Otherwise it has to be started using the start() method. | |
rclcpp::QoS | qos = rclcpp::SystemDefaultsQoS() |
rclcpp::SubscriptionOptions | subscription_options = rclcpp::SubscriptionOptions() |
A helper class to simplify setup of SubscriberHandler construction. This class is passed to the SubscriberHandler constructor and specifies its common options.
bool mrs_lib::SubscriberHandlerOptions::autostart |
If true, the SubscriberHandler will be started after construction. Otherwise it has to be started using the start() method.
rclcpp::Duration mrs_lib::SubscriberHandlerOptions::no_message_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 rclcpp::Time& last_msg)> mrs_lib::SubscriberHandlerOptions::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.