Template Class SimpleSubscriberPlugin
Defined in File simple_subscriber_plugin.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public image_transport::SubscriberPlugin
(Class SubscriberPlugin)
Class Documentation
-
template<class M>
class SimpleSubscriberPlugin : public image_transport::SubscriberPlugin Base class to simplify implementing most plugins to Subscriber.
The base class simplifies implementing a SubscriberPlugin in the common case that all communication with the matching PublisherPlugin happens over a single ROS topic using a transport-specific message type. SimpleSubscriberPlugin is templated on the transport-specific message type.
A subclass need implement only two methods:
internalCallback() - processes a message and invoked the user Image callback if appropriate.
For access to the parameter server and name remappings, use nh().
getTopicToSubscribe() controls the name of the internal communication topic. It defaults to <base topic>/<transport name>.
Public Functions
-
inline virtual ~SimpleSubscriberPlugin()
-
inline virtual std::string getTopic() const override
Get the transport-specific communication topic.
-
inline virtual size_t getNumPublishers() const override
Returns the number of publishers this subscriber is connected to.
-
inline virtual void shutdown() override
Unsubscribe the callback associated with this SubscriberPlugin.
Protected Functions
Process a message. Must be implemented by the subclass.
- Parameters:
message – A message from the PublisherPlugin.
user_cb – The user Image callback to invoke, if appropriate.
-
inline virtual std::string getTopicToSubscribe(const std::string &base_topic) const
Return the communication topic name for a given base topic.
Defaults to <base topic>/<transport name>.
-
inline virtual void subscribeImpl(rclcpp::Node *node, const std::string &base_topic, const Callback &callback, rmw_qos_profile_t custom_qos) override
Subscribe to an image transport topic. Must be implemented by the subclass.
-
inline void subscribeImplWithOptions(rclcpp::Node *node, const std::string &base_topic, const Callback &callback, rmw_qos_profile_t custom_qos, rclcpp::SubscriptionOptions options)