yarp-devices
Loading...
Searching...
No Matches
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.
CanReaderThread * getReader () const
 Get handle of the CAN RX thread.
CanWriterThread * getWriter () 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
CanReaderThread * readerThread {nullptr}
CanWriterThread * writerThread {nullptr}
yarp::dev::ICanBus * iCanBus {nullptr}
yarp::dev::ICanBufferFactory * iCanBufferFactory {nullptr}
yarp::os::BufferedPort< yarp::os::Bottle > dumpPort
std::mutex dumpMutex
yarp::os::BufferedPort< yarp::os::Bottle > commandPort
yarp::os::RpcServer sdoPort
SdoReplier sdoReplier
yarp::os::BufferedPort< yarp::os::Bottle > busLoadPort
BusLoadMonitor * busLoadMonitor {nullptr}

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:
  • libraries/YarpPlugins/CanBusBroker/SingleBusBroker.hpp
  • libraries/YarpPlugins/CanBusBroker/SingleBusBroker.cpp