yarp-devices
Public Member Functions | Private Member Functions | Private Attributes | List of all members
roboticslab::SingleBusBroker Class Referencefinal

Message broker of a CAN bus with YARP port interfaces. More...

#include <SingleBusBroker.hpp>

Inheritance diagram for roboticslab::SingleBusBroker:

Public Member Functions

 SingleBusBroker (const std::string &name)
 Constructor, passes string identifier of the CAN bus.
 
 ~SingleBusBroker () override
 Destructor.
 
bool configure (const yarp::os::Searchable &config)
 Configure this CAN bus.
 
bool registerDevice (yarp::dev::PolyDriver *driver)
 Register CAN handles associated to the input device driver.
 
bool clearFilters ()
 Clear CAN acceptance filters.
 
bool startThreads ()
 Start CAN read/write threads.
 
bool stopThreads ()
 Stop CAN read/write threads.
 
CanReaderThreadgetReader () const
 Get handle of the CAN RX thread.
 
CanWriterThreadgetWriter () const
 Get handle.
 
std::string getName () const
 Retrieve string identifier for this CAN bus.
 
void onRead (yarp::os::Bottle &b) override
 Callback on incoming remote CAN commands.
 

Private Member Functions

bool createPorts (const std::string &prefix)
 Open remote CAN interface ports.
 

Private Attributes

std::string name
 
CanReaderThreadreaderThread
 
CanWriterThreadwriterThread
 
yarp::dev::ICanBus * iCanBus
 
yarp::dev::ICanBufferFactory * iCanBufferFactory
 
yarp::os::Port dumpPort
 
yarp::os::PortWriterBuffer< yarp::os::Bottle > dumpWriter
 
std::mutex dumpMutex
 
yarp::os::Port sendPort
 
yarp::os::PortReaderBuffer< yarp::os::Bottle > commandReader
 
yarp::os::RpcServer sdoPort
 
SdoReplier sdoReplier
 
yarp::os::Port busLoadPort
 
BusLoadMonitorbusLoadMonitor
 

Detailed Description

Instantiates and orchestrates independent CAN read/write threads and manages message buffers. Outgoing messages are loaded into a queue and processed in batches, incoming messages are forwarded to registered listeners.

CAN traffic is interfaced via optional YARP ports to allow remote access. This includes an output dump port, an input command port, and an RPC service for confirmed SDO transfers.


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