3#ifndef __BUS_LOAD_MONITOR_HPP__
4#define __BUS_LOAD_MONITOR_HPP__
8#include <yarp/os/Bottle.h>
9#include <yarp/os/PeriodicThread.h>
10#include <yarp/os/PortWriterBuffer.h>
12#include "ICanMessageNotifier.hpp"
31 std::atomic<unsigned int> bits;
39 public yarp::os::PortWriterBuffer<yarp::os::Bottle>
43 BusLoadMonitor(
double period) : yarp::os::PeriodicThread(period), bitrate(1.0)
46 void setBitrate(
unsigned int bitrate)
47 { this->bitrate = bitrate; }
49 ICanMessageNotifier * getReadMonitor()
50 {
return &readMonitor; }
52 ICanMessageNotifier * getWriteMonitor()
53 {
return &writeMonitor; }
62 OneWayMonitor readMonitor;
63 OneWayMonitor writeMonitor;
Periodically sends CAN bus load stats through a YARP port.
Definition BusLoadMonitor.hpp:40
void run() override
The thread will invoke this periodically.
Definition BusLoadMonitor.cpp:37
BusLoadMonitor(double period)
Constructor.
Definition BusLoadMonitor.hpp:43
Implementation-agnostic consumer for RX CAN transfers.
Definition ICanMessageNotifier.hpp:22
Registers load statistics per single CAN bus.
Definition BusLoadMonitor.hpp:22
unsigned int reset()
Return stored value and clear counter.
Definition BusLoadMonitor.cpp:30
bool notifyMessage(const can_message &msg) override
Tell observers a new CAN message has arrived.
Definition BusLoadMonitor.cpp:22
The main, catch-all namespace for Robotics Lab UC3M.
Definition groups.dox:6
Proxy CAN message structure.
Definition CanMessage.hpp:20