Drake
DrakeLcm Class Reference

A wrapper around a real LCM instance. More...

#include <drake/lcm/drake_lcm.h>

Inheritance diagram for DrakeLcm:
[legend]
Collaboration diagram for DrakeLcm:
[legend]

Public Member Functions

 DrakeLcm ()
 
 ~DrakeLcm () override
 A destructor that forces the receive thread to be stopped. More...
 
void StartReceiveThread () override
 Starts the receive thread. More...
 
void StopReceiveThread () override
 Stops the receive thread. More...
 
::lcm::LCM * get_lcm_instance ()
 An accessor to the real LCM instance encapsulated by this object. More...
 
void Publish (const std::string &channel, const void *data, int data_size, double time_sec=0) override
 Publishes an LCM message on channel channel. More...
 
void Subscribe (const std::string &channel, DrakeLcmMessageHandlerInterface *handler) override
 Subscribes to an LCM channel without automatic message decoding. More...
 
Does not allow copy, move, or assignment
 DrakeLcm (const DrakeLcm &)=delete
 
DrakeLcmoperator= (const DrakeLcm &)=delete
 
 DrakeLcm (DrakeLcm &&)=delete
 
DrakeLcmoperator= (DrakeLcm &&)=delete
 
- Public Member Functions inherited from DrakeLcmInterface
 DrakeLcmInterface ()=default
 
virtual ~DrakeLcmInterface ()=default
 
virtual void DispatchMessageAndAdvanceLog (double)
 Only used for supporting Lcm log playback. More...
 
virtual double GetNextMessageTime () const
 Only used for supporting Lcm log playback. More...
 
 DrakeLcmInterface (const DrakeLcmInterface &)=delete
 
DrakeLcmInterfaceoperator= (const DrakeLcmInterface &)=delete
 
 DrakeLcmInterface (DrakeLcmInterface &&)=delete
 
DrakeLcmInterfaceoperator= (DrakeLcmInterface &&)=delete
 

Detailed Description

A wrapper around a real LCM instance.

Constructor & Destructor Documentation

DrakeLcm ( const DrakeLcm )
delete
DrakeLcm ( DrakeLcm &&  )
delete
DrakeLcm ( )
~DrakeLcm ( )
override

A destructor that forces the receive thread to be stopped.

Member Function Documentation

lcm::LCM * get_lcm_instance ( )

An accessor to the real LCM instance encapsulated by this object.

The returned pointer is guaranteed to be valid for the duration of this object's lifetime.

DrakeLcm& operator= ( const DrakeLcm )
delete
DrakeLcm& operator= ( DrakeLcm &&  )
delete
void Publish ( const std::string &  channel,
const void *  data,
int  data_size,
double  time_sec = 0 
)
overridevirtual

Publishes an LCM message on channel channel.

Parameters
[in]channelThe channel on which to publish the message.
[in]dataA buffer containing the serialized bytes of the message to publish.
[in]data_sizeThe length of in bytes.
[in]time_secTime in seconds when the publish event occurred. Note that this argument is only used when generating a Lcm log.

Implements DrakeLcmInterface.

Here is the caller graph for this function:

void StartReceiveThread ( )
overridevirtual

Starts the receive thread.

This must be called for subscribers to receive any messages.

Precondition
StartReceiveThread() was not called.

Implements DrakeLcmInterface.

Here is the caller graph for this function:

void StopReceiveThread ( )
overridevirtual

Stops the receive thread.

This must be called prior to any subscribers being destroyed. Note that the receive thread will be automatically stopped by this class's destructor, so usage of this method will be extremely rare. It will only be needed if this class's instance and the subscribers to LCM channels are owned by different classes. In such a scenario, this method can be used to ensure the receive thread is destroyed before the subscribers are destroyed.

Precondition
StartReceiveThread() was called.

Implements DrakeLcmInterface.

void Subscribe ( const std::string &  channel,
DrakeLcmMessageHandlerInterface handler 
)
overridevirtual

Subscribes to an LCM channel without automatic message decoding.

The callback method within handler will be invoked when a message arrives on channel channel.

Parameters
[in]channelThe channel to subscribe to.
[in]handlerA class instance whose callback method will be invoked.

Implements DrakeLcmInterface.


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