yarp-devices
Loading...
Searching...
No Matches
Jr3Mbed Class Reference

Implementation of a CAN node on an Mbed board that publishes data from a JR3 sensor.

#include <Jr3Mbed.hpp>

Inheritance diagram for Jr3Mbed:
roboticslab::ICanBusSharer Jr3Mbed_ParamsParser roboticslab::ICanMessageNotifier

Public Member Functions

bool open (yarp::os::Searchable &config) override
bool close () override
unsigned int getId () override
 Retrieve CAN node ID.
bool notifyMessage (const roboticslab::can_message &message) override
 Notify observers that a new CAN message has arrived.
bool initialize () override
 Perform CAN node initialization.
bool finalize () override
 Finalize CAN node communications.
bool registerSender (roboticslab::ICanSenderDelegate *sender) override
 Pass a handle to a CAN sender delegate instance.
bool synchronize (double timestamp) override
 Perform synchronized action on CAN master's request.
std::size_t getNrOfSixAxisForceTorqueSensors () const override
yarp::dev::MAS_status getSixAxisForceTorqueSensorStatus (std::size_t sens_index) const override
bool getSixAxisForceTorqueSensorName (std::size_t sens_index, std::string &name) const override
bool getSixAxisForceTorqueSensorFrameName (std::size_t sens_index, std::string &frameName) const override
bool getSixAxisForceTorqueSensorMeasure (std::size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Public Member Functions inherited from roboticslab::ICanBusSharer
virtual ~ICanBusSharer ()=default
 Destructor.
virtual std::vector< unsigned int > getAdditionalIds ()
 Retrieve more associated CAN node IDs, if any.
Public Member Functions inherited from roboticslab::ICanMessageNotifier
virtual ~ICanMessageNotifier ()=default
 Virtual destructor.
Public Member Functions inherited from Jr3Mbed_ParamsParser
bool parseParams (const yarp::os::Searchable &config) override
std::string getDeviceClassName () const override
std::string getDeviceName () const override
std::string getDocumentationOfDeviceParams () const override
std::vector< std::string > getListOfParams () const override
bool getParamValue (const std::string &paramName, std::string &paramValue) const override
std::string getConfiguration () const override

Private Types

enum class  can_ops : std::uint16_t {
  ACK = 0x100 , START_SYNC = 0x180 , START_ASYNC = 0x200 , STOP = 0x280 ,
  ZERO_OFFS = 0x300 , SET_FILTER = 0x380 , GET_STATE = 0x400 , GET_FS_FORCES = 0x480 ,
  GET_FS_MOMENTS = 0x500 , RESET = 0x580 , FORCES = 0x600 , MOMENTS = 0x680 ,
  BOOTUP = 0x700
}
enum class  jr3_state : std::uint8_t { READY = 0x00 , NOT_INITIALIZED = 0x01 }
enum class  jr3_mode { SYNC , ASYNC , INVALID }

Private Member Functions

constexpr unsigned int getCommandId (can_ops op) const
bool performRequest (const std::string &cmd, const roboticslab::can_message &msg, std::uint8_t *response, bool quiet=false)
bool sendStartSyncCommand (double filter)
bool sendStartAsyncCommand (double filter, double delay)
bool sendCommand (const std::string &cmd, can_ops op)
bool ping ()
bool queryFullScales ()
bool monitorWorker (const yarp::os::YarpTimerEvent &event)

Private Attributes

std::array< double, 6 > scales
bool shouldQueryFullScales {false}
jr3_mode mode {jr3_mode::INVALID}
roboticslab::ICanSenderDelegate * sender {nullptr}
roboticslab::TypedStateObserver< std::uint8_t[]> * ackStateObserver {nullptr}
std::mutex mtx
std::array< std::int16_t, 3 > buffer {}
std::array< std::int16_t, 6 > raw {}
std::atomic< yarp::dev::MAS_status > status {yarp::dev::MAS_UNKNOWN}
std::atomic_bool isBooting {false}
double timestamp {0.0}
std::uint16_t frameCounter {0}
double lastDiagnosticsTimestamp {0.0}
unsigned int lastFrameCounter {0}
yarp::os::Timer * monitorThread {nullptr}

Static Private Attributes

static constexpr unsigned int FULL_SCALE = 16384

Additional Inherited Members

Public Attributes inherited from Jr3Mbed_ParamsParser
const std::string m_device_classname = {"Jr3Mbed"}
const std::string m_device_name = {"Jr3Mbed"}
bool m_parser_is_strict = false
const parser_version_type m_parser_version = {}
std::string m_provided_configuration
const std::string m_canId_defaultValue = {"0"}
const std::string m_name_defaultValue = {""}
const std::string m_filter_defaultValue = {"0.0"}
const std::string m_ackTimeout_defaultValue = {"0.25"}
const std::string m_fullScales_defaultValue = {""}
const std::string m_asyncPeriod_defaultValue = {"0.0"}
const std::string m_monitorPeriod_defaultValue = {"0.1"}
const std::string m_diagnosticsPeriod_defaultValue = {"0.0"}
int m_canId = {0}
std::string m_name = {}
double m_filter = {0.0}
double m_ackTimeout = {0.25}
std::vector< int > m_fullScales = {}
double m_asyncPeriod = {0.0}
double m_monitorPeriod = {0.1}
double m_diagnosticsPeriod = {0.0}

Member Function Documentation

◆ finalize()

bool Jr3Mbed::finalize ( )
overridevirtual

◆ getId()

unsigned int Jr3Mbed::getId ( )
overridevirtual

◆ initialize()

bool Jr3Mbed::initialize ( )
overridevirtual

◆ notifyMessage()

bool Jr3Mbed::notifyMessage ( const roboticslab::can_message & msg)
overridevirtual

◆ registerSender()

bool Jr3Mbed::registerSender ( roboticslab::ICanSenderDelegate * sender)
overridevirtual

◆ synchronize()

bool Jr3Mbed::synchronize ( double timestamp)
overridevirtual

The documentation for this class was generated from the following files:
  • libraries/YarpPlugins/Jr3Mbed/Jr3Mbed.hpp
  • libraries/YarpPlugins/Jr3Mbed/DeviceDriverImpl.cpp
  • libraries/YarpPlugins/Jr3Mbed/ICanBusSharerImpl.cpp
  • libraries/YarpPlugins/Jr3Mbed/ISixAxisForceTorqueSensorsImpl.cpp
  • libraries/YarpPlugins/Jr3Mbed/Jr3Mbed.cpp