Drake
Drake C++ Documentation
drake::systems::lcm Namespace Reference

Classes

class  LcmBuses
 A mapping from {bus_name: interface} with sugar for error checking with nice error messages during access. More...
 
class  LcmInterfaceSystem
 LcmInterfaceSystem acts within a Diagram to allow LcmSubscriberSystem instances to receive data from the network during a simulation. More...
 
class  LcmLogPlaybackSystem
 Advances the cursor of a drake::lcm::DrakeLcmLog based on the timestamps seen the Context that is used to simulate this System. More...
 
class  LcmPublisherSystem
 Publishes an LCM message containing information from its input port. More...
 
class  LcmScopeSystem
 LcmScopeSystem provides the ability to convert any vector output port to a simple LCM message and publish that message periodically. More...
 
class  LcmSubscriberSystem
 Receives LCM messages from a given channel and outputs them to a System<double>'s port. More...
 
class  Serializer
 Serializer is specific to a single LcmMessage type, and translates between LCM message bytes and drake::Value<LcmMessage> objects. More...
 
class  SerializerInterface
 SerializerInterface translates between LCM message bytes and drake::AbstractValue objects that contain LCM messages, e.g., a Value<lcmt_drake_signal>. More...
 

Functions

LcmBuses ApplyLcmBusConfig (const std::map< std::string, drake::lcm::DrakeLcmParams > &lcm_buses, systems::DiagramBuilder< double > *builder)
 Given LCM bus names and parameters, adds an LcmInterfaceSystem within the given diagram builder for each bus, and returns an LcmBuses object that provides access to the drake::lcm::DrakeLcmInterface objects that were created. More...
 
LcmBuses ApplyLcmBusConfig (const std::map< std::string, std::optional< drake::lcm::DrakeLcmParams >> &lcm_buses, systems::DiagramBuilder< double > *builder)
 Given LCM bus names and (nullable) parameters, adds an LcmInterfaceSystem within the given diagram builder for each bus, and returns an LcmBuses object that provides access to the drake::lcm::DrakeLcmInterface objects that were created. More...
 
drake::lcm::DrakeLcmInterfaceFindOrCreateLcmBus (drake::lcm::DrakeLcmInterface *forced_result, const LcmBuses *lcm_buses, DiagramBuilder< double > *builder, std::string_view description_of_caller, const std::string &bus_name)
 (Advanced) Returns an LCM interface based on a convenient set of heuristics. More...
 

Function Documentation

◆ ApplyLcmBusConfig() [1/2]

LcmBuses drake::systems::lcm::ApplyLcmBusConfig ( const std::map< std::string, drake::lcm::DrakeLcmParams > &  lcm_buses,
systems::DiagramBuilder< double > *  builder 
)

Given LCM bus names and parameters, adds an LcmInterfaceSystem within the given diagram builder for each bus, and returns an LcmBuses object that provides access to the drake::lcm::DrakeLcmInterface objects that were created.

Because the interfaces live within the builder (and so eventually, the diagram), the diagram will pump the interfaces when it's used with a simulator. Refer to the LcmInterfaceSystem documentation for details.

The interface pointers remain owned by the builder; the LcmBuses object merely aliases into the builder (and then eventually, the diagram).

Parameters
lcm_busesA map of {bus_name: params} for LCM transceivers, to be used by drivers, sensors, etc.

◆ ApplyLcmBusConfig() [2/2]

LcmBuses drake::systems::lcm::ApplyLcmBusConfig ( const std::map< std::string, std::optional< drake::lcm::DrakeLcmParams >> &  lcm_buses,
systems::DiagramBuilder< double > *  builder 
)

Given LCM bus names and (nullable) parameters, adds an LcmInterfaceSystem within the given diagram builder for each bus, and returns an LcmBuses object that provides access to the drake::lcm::DrakeLcmInterface objects that were created.

Because the interfaces live within the builder (and so eventually, the diagram), the diagram will pump the interfaces when it's used with a simulator. Refer to the LcmInterfaceSystem documentation for details.

The interface pointers remain owned by the builder; the LcmBuses object merely aliases into the builder (and then eventually, the diagram).

As a special case, the user can opt-out of LCM either by passing nullopt as the drake::lcm::DrakeLcmParams, or by setting the URL within the DrakeLcmParams to LcmBuses::kLcmUrlMemqNull. In that case, only a drake::lcm::DrakeLcmInterface object will be created (not a full LcmInterfaceSystem), and the LCM messages will not be pumped.

Parameters
lcm_busesA map of {bus_name: params} for LCM transceivers, to be used by drivers, sensors, etc.

◆ FindOrCreateLcmBus()

drake::lcm::DrakeLcmInterface* drake::systems::lcm::FindOrCreateLcmBus ( drake::lcm::DrakeLcmInterface forced_result,
const LcmBuses lcm_buses,
DiagramBuilder< double > *  builder,
std::string_view  description_of_caller,
const std::string &  bus_name 
)

(Advanced) Returns an LCM interface based on a convenient set of heuristics.

If the forced_result is non-null, then returns forced_result and does nothing else.

Otherwise, if lcm_buses is null and bus_name is "default", then creates a new DrakeLcm object owned by the builder and returns a pointer to it.

Otherwise, if lcm_buses is null, then throws an exception.

Otherwise, returns the lcm_buses->Find(description_of_caller, bus_name) which might throw if there is so such bus_name.

The return value is an alias into memory owned elsewhere (typically by a DiagramBuilder or a Diagram) and is never nullptr.

Parameters
forced_resultcan be null
lcm_busescan be null
buildermust not be null