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 ()
 Re-subscribe to a topic. Only works if this subscriber has previously been subscribed to a topic. More...
 
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...
 
 Subscriber ()
 Empty constructor, use subscribe() to subscribe 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...
 
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 P >
Connection registerCallback (const boost::function< void(P)> &callback)
 Register a callback to be called when this filter has passed. 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 (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 127 of file subscriber.h.

Member Typedef Documentation

◆ EventType

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

Definition at line 131 of file subscriber.h.

◆ MConstPtr

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

Definition at line 130 of file subscriber.h.

Constructor & Destructor Documentation

◆ Subscriber() [1/2]

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 144 of file subscriber.h.

◆ Subscriber() [2/2]

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

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

Definition at line 152 of file subscriber.h.

◆ ~Subscriber()

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

Definition at line 156 of file subscriber.h.

Member Function Documentation

◆ add()

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 229 of file subscriber.h.

◆ cb()

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

Definition at line 236 of file subscriber.h.

◆ connectInput()

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 221 of file subscriber.h.

◆ getSubscriber()

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

Returns the internal ros::Subscriber object.

Definition at line 215 of file subscriber.h.

◆ getTopic()

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

Definition at line 207 of file subscriber.h.

◆ subscribe() [1/2]

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 189 of file subscriber.h.

◆ subscribe() [2/2]

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 172 of file subscriber.h.

◆ unsubscribe()

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 202 of file subscriber.h.

Member Data Documentation

◆ nh_

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

Definition at line 243 of file subscriber.h.

◆ ops_

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

Definition at line 242 of file subscriber.h.

◆ sub_

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

Definition at line 241 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 , Jacob Perron
autogenerated on Thu Nov 23 2023 04:01:54