EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
eduart::sensorring::device::HTPA32_Device Class Reference

Device wrapper for an HTPA32 thermal sensor on the sensorring bus. More...

#include <HTPA32_Device.hpp>

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

Public Member Functions

 HTPA32_Device (HTPA32_Params params, com::ComInterfaceID interface, unsigned int idx)
 Construct a new HTPA32 device instance.
 ~HTPA32_Device ()
 Destructor.
const HTPA32_Params & getParams () const override
 Get the sensor parameters used to configure this device.
bool configure () override
 Configure the device. Reads the EEPROM once on first call.
std::future< bool > getEepromAsync (std::chrono::milliseconds timeout)
 Request the EEPROM content asynchronously.
bool stopCalibration () override
 Stop any ongoing thermal calibration sequence.
bool startCalibration (unsigned int window) override
 Start a thermal calibration over a sliding window of frames.
Public Member Functions inherited from eduart::sensorring::device::ThermalSensor
 ThermalSensor (DeviceID id, com::ComInterface *interface, com::ComEndpoint target)
 Construct a ThermalSensor with Device params.
 ~ThermalSensor () override=default
 Virtual destructor.
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.
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.
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

bool sendMeasurementRequest (std::uint8_t sequence_number) override
bool sendMeasurementTransmissionRequest () override
Protected Member Functions inherited from eduart::sensorring::device::Sensor
virtual void onResetSensorState ()
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

Friends

class HTPA32_DeviceImpl
class HTPA32_DeviceTestAccess

Additional Inherited Members

Public Types inherited from eduart::sensorring::device::ThermalSensor
using MeasurementType = measurement::ThermalMeasurement
 Measurement type produced by this sensor category.
Static Public Member Functions inherited from eduart::sensorring::ActionDispatcher
static void globalExecute (Action action)
Protected Attributes inherited from eduart::sensorring::device::ThermalSensor
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

Detailed Description

Device wrapper for an HTPA32 thermal sensor on the sensorring bus.

Measurements contain a reconstructed row-major temperature image. A board orientation of Left rotates the image by 180 degrees; Right and None leave its mounting orientation unchanged. Calibration remains in sensor order.

Constructor & Destructor Documentation

◆ HTPA32_Device()

eduart::sensorring::device::HTPA32_Device::HTPA32_Device ( HTPA32_Params params,
com::ComInterfaceID interface,
unsigned int idx )

Construct a new HTPA32 device instance.

Parameters
[in]paramsSensor configuration parameters.
[in]interfaceCommunication interface used to talk to the device.
[in]idxIndex of the sensor on the bus.

Member Function Documentation

◆ configure()

bool eduart::sensorring::device::HTPA32_Device::configure ( )
overridevirtual

Configure the device. Reads the EEPROM once on first call.

Returns
true on success.

Reimplemented from eduart::sensorring::device::Device.

◆ getEepromAsync()

std::future< bool > eduart::sensorring::device::HTPA32_Device::getEepromAsync ( std::chrono::milliseconds timeout)

Request the EEPROM content asynchronously.

Parameters
[in]timeoutMaximum time to wait for completion.
Returns
Future resolving to true on success.

◆ getParams()

const HTPA32_Params & eduart::sensorring::device::HTPA32_Device::getParams ( ) const
overridevirtual

Get the sensor parameters used to configure this device.

Returns
Reference to the internal HTPA32 parameter struct.

Implements eduart::sensorring::device::ThermalSensor.

◆ sendMeasurementRequest()

bool eduart::sensorring::device::HTPA32_Device::sendMeasurementRequest ( std::uint8_t sequence_number)
overrideprotectedvirtual

◆ sendMeasurementTransmissionRequest()

bool eduart::sensorring::device::HTPA32_Device::sendMeasurementTransmissionRequest ( )
overrideprotectedvirtual

◆ startCalibration()

bool eduart::sensorring::device::HTPA32_Device::startCalibration ( unsigned int window)
overridevirtual

Start a thermal calibration over a sliding window of frames.

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

Implements eduart::sensorring::device::ThermalSensor.

◆ stopCalibration()

bool eduart::sensorring::device::HTPA32_Device::stopCalibration ( )
overridevirtual

Stop any ongoing thermal calibration sequence.

Returns
true on success.

Implements eduart::sensorring::device::ThermalSensor.


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