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

Base class for any thermal-sensing device. More...

#include <ThermalSensor.hpp>

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

Public Types

using MeasurementType = measurement::ThermalMeasurement
 Measurement type produced by this sensor category.

Public Member Functions

 ThermalSensor (DeviceID id, com::ComInterface *interface, com::ComEndpoint target)
 Construct a ThermalSensor with Device params.
 ~ThermalSensor () override=default
 Virtual destructor.
virtual const ThermalSensorParams & getParams () const =0
 Get the current ThermalSensor parameters.
const measurement::ThermalMeasurement & getLatestMeasurement () const
 Get the most recent measurement.
subscription::Subscription subscribe (std::function< void(const measurement::ThermalMeasurement &)> callback)
 Subscribe to thermal measurements from this sensor.
virtual void publishMeasurement ()
 Build a ThermalMeasurement from internal state and publish to all subscribers.
virtual bool startCalibration (unsigned int window)=0
 Start a thermal calibration over a sliding window of frames.
virtual bool stopCalibration ()=0
 Stop any ongoing thermal calibration sequence.
Public Member Functions inherited from eduart::sensorring::device::Sensor
 Sensor (DeviceID id, com::ComInterface *interface, com::ComEndpoint target)
 Construct the sensor with identity and communication link.
std::future< bool > measure (std::uint8_t sequence_number)
std::future< bool > fetch ()
std::future< bool > beginMeasurementWait ()
 Begin an asynchronous wait for the next measurement trigger.
void setMeasurementReady (bool success)
 Satisfy the pending measurement-wait future.
std::future< bool > beginDataAvailableWait ()
 Begin an asynchronous wait for new data to become available.
void setDataAvailableReady (bool success)
 Satisfy the pending data-available-wait future.
void resetSensorState ()
 Reset the device to its initialised state, clearing all error flags.
void clearDataFlag ()
 Clear the data-available flag so the device can accept the next measurement cycle.
Public Member Functions inherited from eduart::sensorring::device::Device
 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 Attributes

measurement::ThermalMeasurement _latest_measurement
subscription::Publisher< const measurement::ThermalMeasurement & > _thermal_publisher
 Publisher that delivers thermal measurements to subscribers.
Protected Attributes inherited from eduart::sensorring::device::Sensor
DeviceState _state
std::mutex _state_mutex
std::mutex _promise_mutex
std::optional< std::promise< bool > > _data_available_promise
std::optional< std::promise< bool > > _measurement_promise
Protected Attributes inherited from eduart::sensorring::device::Device
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)
Protected Member Functions inherited from eduart::sensorring::device::Sensor
virtual bool sendMeasurementRequest (std::uint8_t sequence_number)=0
virtual bool sendMeasurementTransmissionRequest ()=0
virtual void onResetSensorState ()
virtual void onClearDataFlag ()
Protected Member Functions inherited from eduart::sensorring::device::Device
virtual void comCallback (const com::ComEndpoint source, std::uint8_t command, const std::vector< std::uint8_t > &data)=0

Detailed Description

Base class for any thermal-sensing device.

Inherits from Sensor (which provides Device identity + measurement sync). Users subscribe to thermal measurements via subscribe(). The concrete sensor implementation publishes measurements by calling publishMeasurement() from the state machine thread.

Constructor & Destructor Documentation

◆ ThermalSensor()

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

Construct a ThermalSensor with Device params.

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

Member Function Documentation

◆ getLatestMeasurement()

const measurement::ThermalMeasurement & eduart::sensorring::device::ThermalSensor::getLatestMeasurement ( ) const

Get the most recent measurement.

Returns
Reference to the latest thermal measurement (check header.state for validity).

◆ getParams()

virtual const ThermalSensorParams & eduart::sensorring::device::ThermalSensor::getParams ( ) const
pure virtual

Get the current ThermalSensor parameters.

Returns
Current ThermalSensor parameters.

Implemented in eduart::sensorring::device::HTPA32_Device.

◆ publishMeasurement()

virtual void eduart::sensorring::device::ThermalSensor::publishMeasurement ( )
virtual

Build a ThermalMeasurement from internal state and publish to all subscribers.

Called by the state machine after a successful measurement fetch.

◆ startCalibration()

virtual bool eduart::sensorring::device::ThermalSensor::startCalibration ( unsigned int window)
pure virtual

Start a thermal calibration over a sliding window of frames.

Parameters
[in]windowNumber of frames to average for calibration.
Returns
true on success.

Implemented in eduart::sensorring::device::HTPA32_Device.

◆ stopCalibration()

virtual bool eduart::sensorring::device::ThermalSensor::stopCalibration ( )
pure virtual

Stop any ongoing thermal calibration sequence.

Returns
true on success.

Implemented in eduart::sensorring::device::HTPA32_Device.

◆ subscribe()

subscription::Subscription eduart::sensorring::device::ThermalSensor::subscribe ( std::function< void(const measurement::ThermalMeasurement &)> callback)
inline

Subscribe to thermal measurements from this sensor.

Parameters
[in]callbackInvoked with each new measurement.
Returns
RAII Subscription that auto-cancels on destruction.

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