EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
eduart::sensorring::device::Device Class Referenceabstract

Base class for all devices in the SensorRing. More...

#include <Device.hpp>

Inheritance diagram for eduart::sensorring::device::Device:
[legend]
Collaboration diagram for eduart::sensorring::device::Device:
[legend]

Public Member Functions

 Device (DeviceID id, com::ComInterface *interface, com::ComEndpoint target)
 Construct the device with identity and communication link.
DeviceID getDeviceID () const
 Return the full device identifier (type + index).
unsigned int getHwIdx () const
 Return the zero-based hardware board index on its bus (used for CAN addressing and protocol bitmasks).
void setDeviceIndex (unsigned int index)
 Reassign the logical device index (DeviceID.index) without changing the hardware index.
virtual bool configure ()
 Apply post-reset runtime configuration for this device.
void setBoardContext (const board::SensorBoardParams *board_params)
 Initialize board-level context pointer (non-owning).
const board::SensorBoardParams * getBoardContext () const
 Return the board-level context pointer (non-owning).
void setPoseOffset (const math::Pose &offset)
 Store a pose offset relative to the board centre.
math::Pose getPoseOffset () const
 Return the stored pose offset relative to the board centre.
math::Pose getGlobalPose () const
 Compute and return the global pose in the ring coordinate frame.
Public Member Functions inherited from eduart::sensorring::ActionDispatcher
void setQueue (ActionQueue *queue)
void clearQueue ()
bool isManaged () const
void execute (Action action)
void execute (std::string_view key, Action action)

Protected Member Functions

virtual void comCallback (const com::ComEndpoint source, std::uint8_t command, const std::vector< std::uint8_t > &data)=0

Protected Attributes

DeviceID _id
unsigned int _hw_idx
com::ComInterface * _interface
const board::SensorBoardParams * _board_params = nullptr
math::Pose _offset
subscription::Subscription _com_subscription

Additional Inherited Members

Static Public Member Functions inherited from eduart::sensorring::ActionDispatcher
static void globalExecute (Action action)

Detailed Description

Base class for all devices in the SensorRing.

Provides identity, communication, state tracking, pose handling and the action queue used by the state machine.

Constructor & Destructor Documentation

◆ Device()

eduart::sensorring::device::Device::Device ( DeviceID id,
com::ComInterface * interface,
com::ComEndpoint target )

Construct the device with identity and communication link.

Parameters
[in]idDevice identifier.
[in]interfaceCommunication interface.
[in]targetCommunication endpoint this device listens to.

Member Function Documentation

◆ configure()

virtual bool eduart::sensorring::device::Device::configure ( )
virtual

Apply post-reset runtime configuration for this device.

Returns
true on success.

Reimplemented in eduart::sensorring::device::HTPA32_Device, eduart::sensorring::device::TMF8829_Device, and eduart::sensorring::device::WS2812b_Device.

◆ getBoardContext()

const board::SensorBoardParams * eduart::sensorring::device::Device::getBoardContext ( ) const

Return the board-level context pointer (non-owning).

Returns
Pointer to board params.

◆ getGlobalPose()

math::Pose eduart::sensorring::device::Device::getGlobalPose ( ) const

Compute and return the global pose in the ring coordinate frame.

Returns
Global pose (board pose combined with device offset).

◆ getPoseOffset()

math::Pose eduart::sensorring::device::Device::getPoseOffset ( ) const

Return the stored pose offset relative to the board centre.

Returns
Pose offset relative to the board centre.

◆ setBoardContext()

void eduart::sensorring::device::Device::setBoardContext ( const board::SensorBoardParams * board_params)

Initialize board-level context pointer (non-owning).

Parameters
[in]board_paramsPointer to board params.

◆ setDeviceIndex()

void eduart::sensorring::device::Device::setDeviceIndex ( unsigned int index)

Reassign the logical device index (DeviceID.index) without changing the hardware index.

Parameters
[in]indexNew globally unique per-type index.

◆ setPoseOffset()

void eduart::sensorring::device::Device::setPoseOffset ( const math::Pose & offset)

Store a pose offset relative to the board centre.

Parameters
[in]offsetOffset to apply on top of the board centre pose.

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