Template Class Subscriber

Class Documentation

template<typename SyncT, typename T>
class Subscriber

This class is used by the LiveSync as the glue between the ROS messaging framework and the Sync classes. Replace or specialize this default template to handle subscriptions to your liking.

Public Types

using TConstSharedPtr = typename T::ConstSharedPtr

Public Functions

inline Subscriber(const std::string &topic, rclcpp::Node *node, const rclcpp::QoS &qos, const std::shared_ptr<SyncT> &sync)

Constructor for a subscriber. Specialize this template if you need to do something special here. The default template will use a standard ROS2 subscriber, but one could also subscribe to e.g. an image transport at this point.

Parameters:
  • topic – obvious

  • node – pointer to parent node

  • qos – quality of service for subscription

  • sync – shared pointer to sync pertaining to the life sync. Should be stored and later used to feed ROS messages into the sync.

inline void callback(TConstSharedPtr msg)

This function is invoked when a message arrives from ROS. Replace this with a specialization if you want to do anything special.

Parameters:

msg – shared pointer to the message delivered by the ROS framework.