Drake
drake::lcm Namespace Reference

Classes

class  DrakeLcm
 A wrapper around a real LCM instance. More...
 
class  DrakeLcmInterface
 A pure virtual interface that enables LCM to be mocked. More...
 
class  DrakeLcmLog
 A LCM interface for logging LCM messages to a file or playing back from a existing log. More...
 
class  DrakeMockLcm
 A mock LCM instance. More...
 
class  LcmReceiveThread
 Maintains a thread that receives LCM messages and dispatches the messages to the appropriate message handlers. More...
 
class  TranslatorBase
 Base API for a translator between arbitrary data of DataType and a Lcm message of MsgType. More...
 

Functions

template<typename Message >
void Publish (DrakeLcmInterface *lcm, const std::string &channel, const Message &message, optional< double > time_sec={})
 Publishes an LCM message on channel channel. More...
 
template<typename Message >
void Subscribe (DrakeLcmInterface *lcm, const std::string &channel, std::function< void(const Message &)> handler, std::function< void()> on_error={})
 Subscribes to an LCM channel named channel and decodes messages of type Message. More...
 
bool CompareLcmtDrakeSignalMessages (const lcmt_drake_signal &actual_message, const lcmt_drake_signal &expected_message)
 Compares two drake::lcmt_drake_signal messages are equal. More...
 

Function Documentation

bool CompareLcmtDrakeSignalMessages ( const lcmt_drake_signal &  actual_message,
const lcmt_drake_signal &  expected_message 
)

Compares two drake::lcmt_drake_signal messages are equal.

Parameters
[in]actual_messageThe actual message to be compared against expected_message.
[in]expected_messageThe expected message to be compared against actual message.
Returns
true if actual_message and expected_message are equal.

Here is the call graph for this function:

void drake::lcm::Publish ( DrakeLcmInterface lcm,
const std::string &  channel,
const Message &  message,
optional< double time_sec = {} 
)

Publishes an LCM message on channel channel.

Parameters
lcmThe LCM service on which to publish the message. Must not be null.
channelThe channel on which to publish the message. Must not be the empty string.
messageThe message to publish.
time_secTime in seconds when the publish event occurred. If unknown, use the default value of drake::nullopt.

Here is the call graph for this function:

Here is the caller graph for this function:

void drake::lcm::Subscribe ( DrakeLcmInterface lcm,
const std::string &  channel,
std::function< void(const Message &)>  handler,
std::function< void()>  on_error = {} 
)

Subscribes to an LCM channel named channel and decodes messages of type Message.

Parameters
lcmThe LCM service on which to subscribe. Must not be null.
channelThe channel on which to subscribe. Must not be the empty string.
handlerThe callback when a message is received and decoded without error.
on_errorThe callback when a message is received and cannot be decoded; if no error handler is given, an exception is thrown instead.
Note
Depending on the specific DrakeLcmInterface implementation, the handler might be invoked on a different thread than this function.

Here is the call graph for this function: