Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
message_filters::Subscriber< M > Class Template Reference

ROS subscription filter. More...

#include <subscriber.h>

Inheritance diagram for message_filters::Subscriber< M >:
Inheritance graph
[legend]

Public Types

typedef ros::MessageEvent< M const > EventType
 
typedef boost::shared_ptr< M const > MConstPtr
 
- Public Types inherited from message_filters::SimpleFilter< M >
typedef boost::function< void(const MConstPtr &)> Callback
 
typedef boost::function< void(const EventType &)> EventCallback
 
typedef ros::MessageEvent< M const > EventType
 
typedef boost::shared_ptr< M const > MConstPtr
 

Public Member Functions

void add (const EventType &e)
 Does nothing. Provided so that Subscriber may be used in a message_filters::Chain. More...
 
template<typename F >
void connectInput (F &f)
 Does nothing. Provided so that Subscriber may be used in a message_filters::Chain. More...
 
const ros::SubscribergetSubscriber () const
 Returns the internal ros::Subscriber object. More...
 
std::string getTopic () const
 
void subscribe (ros::NodeHandle &nh, const std::string &topic, uint32_t queue_size, const ros::TransportHints &transport_hints=ros::TransportHints(), ros::CallbackQueueInterface *callback_queue=0)
 Subscribe to a topic. More...
 
void subscribe ()
 Re-subscribe to a topic. Only works if this subscriber has previously been subscribed to a topic. More...
 
 Subscriber (ros::NodeHandle &nh, const std::string &topic, uint32_t queue_size, const ros::TransportHints &transport_hints=ros::TransportHints(), ros::CallbackQueueInterface *callback_queue=0)
 Constructor. More...
 
 Subscriber ()
 Empty constructor, use subscribe() to subscribe to a topic. More...
 
void unsubscribe ()
 Force immediate unsubscription of this subscriber from its topic. More...
 
 ~Subscriber ()
 
- Public Member Functions inherited from message_filters::SubscriberBase
virtual ~SubscriberBase ()
 
- Public Member Functions inherited from message_filters::SimpleFilter< M >
const std::string & getName ()
 Get the name of this filter. For debugging use. More...
 
template<typename C >
Connection registerCallback (const C &callback)
 Register a callback to be called when this filter has passed. More...
 
template<typename P >
Connection registerCallback (const boost::function< void(P)> &callback)
 Register a callback to be called when this filter has passed. More...
 
template<typename P >
Connection registerCallback (void(*callback)(P))
 Register a callback to be called when this filter has passed. More...
 
template<typename T , typename P >
Connection registerCallback (void(T::*callback)(P), T *t)
 Register a callback to be called when this filter has passed. More...
 
void setName (const std::string &name)
 Set the name of this filter. For debugging use. More...
 

Private Member Functions

void cb (const EventType &e)
 

Private Attributes

ros::NodeHandle nh_
 
ros::SubscribeOptions ops_
 
ros::Subscriber sub_
 

Additional Inherited Members

- Protected Member Functions inherited from message_filters::SimpleFilter< M >
void signalMessage (const MConstPtr &msg)
 Call all registered callbacks, passing them the specified message. More...
 
void signalMessage (const ros::MessageEvent< M const > &event)
 Call all registered callbacks, passing them the specified message. More...
 

Detailed Description

template<class M>
class message_filters::Subscriber< M >

ROS subscription filter.

This class acts as a highest-level filter, simply passing messages from a ROS subscription through to the filters which have connected to it.

When this object is destroyed it will unsubscribe from the ROS subscription.

The Subscriber object is templated on the type of message being subscribed to.

CONNECTIONS

Subscriber has no input connection.

The output connection for the Subscriber object is the same signature as for roscpp subscription callbacks, ie.

void callback(const boost::shared_ptr<M const>&);

Definition at line 95 of file subscriber.h.

Member Typedef Documentation

template<class M>
typedef ros::MessageEvent<M const> message_filters::Subscriber< M >::EventType

Definition at line 99 of file subscriber.h.

template<class M>
typedef boost::shared_ptr<M const> message_filters::Subscriber< M >::MConstPtr

Definition at line 98 of file subscriber.h.

Constructor & Destructor Documentation

template<class M>
message_filters::Subscriber< M >::Subscriber ( ros::NodeHandle nh,
const std::string &  topic,
uint32_t  queue_size,
const ros::TransportHints transport_hints = ros::TransportHints(),
ros::CallbackQueueInterface callback_queue = 0 
)
inline

Constructor.

See the ros::NodeHandle::subscribe() variants for more information on the parameters

Parameters
nhThe ros::NodeHandle to use to subscribe.
topicThe topic to subscribe to.
queue_sizeThe subscription queue size
transport_hintsThe transport hints to pass along
callback_queueThe callback queue to pass along

Definition at line 112 of file subscriber.h.

template<class M>
message_filters::Subscriber< M >::Subscriber ( )
inline

Empty constructor, use subscribe() to subscribe to a topic.

Definition at line 120 of file subscriber.h.

template<class M>
message_filters::Subscriber< M >::~Subscriber ( )
inline

Definition at line 124 of file subscriber.h.

Member Function Documentation

template<class M>
void message_filters::Subscriber< M >::add ( const EventType e)
inline

Does nothing. Provided so that Subscriber may be used in a message_filters::Chain.

Definition at line 197 of file subscriber.h.

template<class M>
void message_filters::Subscriber< M >::cb ( const EventType e)
inlineprivate

Definition at line 204 of file subscriber.h.

template<class M>
template<typename F >
void message_filters::Subscriber< M >::connectInput ( F &  f)
inline

Does nothing. Provided so that Subscriber may be used in a message_filters::Chain.

Definition at line 189 of file subscriber.h.

template<class M>
const ros::Subscriber& message_filters::Subscriber< M >::getSubscriber ( ) const
inline

Returns the internal ros::Subscriber object.

Definition at line 183 of file subscriber.h.

template<class M>
std::string message_filters::Subscriber< M >::getTopic ( ) const
inline

Definition at line 175 of file subscriber.h.

template<class M>
void message_filters::Subscriber< M >::subscribe ( ros::NodeHandle nh,
const std::string &  topic,
uint32_t  queue_size,
const ros::TransportHints transport_hints = ros::TransportHints(),
ros::CallbackQueueInterface callback_queue = 0 
)
inlinevirtual

Subscribe to a topic.

If this Subscriber is already subscribed to a topic, this function will first unsubscribe.

Parameters
nhThe ros::NodeHandle to use to subscribe.
topicThe topic to subscribe to.
queue_sizeThe subscription queue size
transport_hintsThe transport hints to pass along
callback_queueThe callback queue to pass along

Implements message_filters::SubscriberBase.

Definition at line 140 of file subscriber.h.

template<class M>
void message_filters::Subscriber< M >::subscribe ( )
inlinevirtual

Re-subscribe to a topic. Only works if this subscriber has previously been subscribed to a topic.

Implements message_filters::SubscriberBase.

Definition at line 157 of file subscriber.h.

template<class M>
void message_filters::Subscriber< M >::unsubscribe ( )
inlinevirtual

Force immediate unsubscription of this subscriber from its topic.

Implements message_filters::SubscriberBase.

Definition at line 170 of file subscriber.h.

Member Data Documentation

template<class M>
ros::NodeHandle message_filters::Subscriber< M >::nh_
private

Definition at line 211 of file subscriber.h.

template<class M>
ros::SubscribeOptions message_filters::Subscriber< M >::ops_
private

Definition at line 210 of file subscriber.h.

template<class M>
ros::Subscriber message_filters::Subscriber< M >::sub_
private

Definition at line 209 of file subscriber.h.


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


message_filters
Author(s): Josh Faust, Vijay Pradeep, Dirk Thomas
autogenerated on Mon Nov 2 2020 03:52:42