EduArt Sensor Ring Library 3.0.0
Loading...
Searching...
No Matches
eduart::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::device::HTPA32_Device:
[legend]
Collaboration diagram for eduart::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_ParamsgetParams () const
 Get the sensor parameters used to configure this device.
std::pair< const measurement::GrayscaleImage &, DeviceStategetLatestGrayscaleImage () const
 Get the most recent grayscale image and current sensor state.
std::pair< const measurement::FalseColorImage &, DeviceStategetLatestFalseColorImage () const
 Get the most recent false-color image and current sensor state.
std::future< bool > getEepromAsync (std::chrono::milliseconds timeout)
 Request the EEPROM content asynchronously.
bool stopCalibration ()
 Stop any ongoing thermal calibration sequence.
bool startCalibration (unsigned int window)
 Start a thermal calibration over a sliding window of frames.
std::pair< const measurement::ThermalMeasurement &, DeviceStategetLatestMeasurement () const
 Get the latest thermal measurement and current sensor state.
Public Member Functions inherited from eduart::device::BaseDevice
 BaseDevice (DeviceID id, com::ComInterface *interface, com::ComEndpoint target, bool enable)
 Constructs the device with the given ID, communication interface, endpoint, and enable flag.
DeviceID getDeviceID () const
 Returns the device identifier.
void setPoseOffset (const DevicePoseOffset &offset)
 Set the pose offset of this device relative to the board center.
DevicePoseOffset getPoseOffset () const
 Get the pose offset of this device relative to the board center.
Public Member Functions inherited from eduart::device::BaseSensor
 BaseSensor (com::ComInterface *interface, com::ComEndpoint target, unsigned int idx, bool enable)
 Construct a base sensor and register it with the communication interface.
virtual ~BaseSensor ()
 Destructor.
unsigned int getIdx () const
 Get the index of this sensor instance.
bool getEnable () const
 Query if the sensor is currently enabled.
void setEnable (bool enable)
 Enable or disable the sensor.
void setPose (math::Vector3 translation, math::Vector3 rotation)
 Set the pose of the sensor in the common coordinate frame.
void resetSensorState ()
 Reset error state and internal flags to nominal values.
void clearDataFlag ()
 Clear state for the next measurement cycle. Calls the sensor-specific hook onClearDataFlag().
std::future< bool > beginMeasurementWait ()
 Start a measurement-wait cycle and return a future that will be set when the measurement is ready.
std::future< bool > beginDataAvailableWait ()
 Start a data-available-wait cycle and return a future that will be set when new data is available.

Static Public Member Functions

static std::future< bool > requestThermalMeasurementAsync (const std::vector< HTPA32_Device * > &devices, std::chrono::milliseconds timeout)
 Request thermal measurements asynchronously on a set of devices.
static std::future< bool > fetchThermalMeasurementAsync (const std::vector< HTPA32_Device * > &devices, std::chrono::milliseconds timeout)
 Fetch thermal measurements asynchronously from a set of devices.

Friends

class HTPA32_DeviceImpl

Additional Inherited Members

Protected Member Functions inherited from eduart::device::BaseSensor
void setMeasurementReady (bool success)
 Set the result of the current measurement-wait cycle. Called from derived callbacks when ready.
void setDataAvailableReady (bool success)
 Set the result of the current data-available-wait cycle. Called from derived callbacks when "data available" is received.
virtual void comCallback (const com::ComEndpoint source, const std::vector< std::uint8_t > &data)=0
 Handle an incoming communication message for this sensor.
Protected Attributes inherited from eduart::device::BaseDevice
DeviceState _state
 Current lifecycle/runtime state.
DeviceID _id
 Device identifier.
bool _enable
 Whether the device is enabled.
DevicePoseOffset _pose_offset
 Pose offset of the device relative to the sensor board center.
Protected Attributes inherited from eduart::device::BaseSensor
unsigned int _idx
 Index of this sensor instance within its group.
DeviceState _error
 Current health state of the sensor.
com::ComInterface * _interface
 Communication interface used to talk to the sensor.
math::Vector3 _translation
 Translation of the sensor origin in the common coordinate frame.
math::Vector3 _rotation
 Rotation of the sensor expressed as Euler angles in degrees.
math::Matrix3 _rot_m
 Rotation matrix derived from the Euler angles.
bool _enable_flag
 Flag indicating whether the sensor is enabled.
std::mutex _state_mutex
std::optional< std::promise< bool > > _measurement_promise
 Promise for the current measurement-wait cycle; set by callback, consumed by wait + get().
std::optional< std::promise< bool > > _data_available_promise
 Promise for the current data-available-wait cycle; set by callback when "data available" is received.
std::mutex _promise_mutex
subscription::Subscription _com_subscription
 RAII subscription to the communication interface.

Detailed Description

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

Constructor & Destructor Documentation

◆ HTPA32_Device()

eduart::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

◆ fetchThermalMeasurementAsync()

std::future< bool > eduart::device::HTPA32_Device::fetchThermalMeasurementAsync ( const std::vector< HTPA32_Device * > & devices,
std::chrono::milliseconds timeout )
static

Fetch thermal measurements asynchronously from a set of devices.

Parameters
[in]devicesVector of devices to read from.
[in]timeoutMaximum time to wait for completion.
Returns
Future resolving to true when all fetches succeed.

◆ getEepromAsync()

std::future< bool > eduart::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.

◆ getLatestFalseColorImage()

std::pair< const measurement::FalseColorImage &, DeviceState > eduart::device::HTPA32_Device::getLatestFalseColorImage ( ) const

Get the most recent false-color image and current sensor state.

Returns
Pair of latest false-color image and associated sensor state.

◆ getLatestGrayscaleImage()

std::pair< const measurement::GrayscaleImage &, DeviceState > eduart::device::HTPA32_Device::getLatestGrayscaleImage ( ) const

Get the most recent grayscale image and current sensor state.

Returns
Pair of latest grayscale image and associated sensor state.

◆ getLatestMeasurement()

std::pair< const measurement::ThermalMeasurement &, DeviceState > eduart::device::HTPA32_Device::getLatestMeasurement ( ) const

Get the latest thermal measurement and current sensor state.

Returns
Pair of latest thermal measurement and associated sensor state.

◆ getParams()

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

Get the sensor parameters used to configure this device.

Returns
Reference to the internal HTPA32 parameter struct.

◆ requestThermalMeasurementAsync()

std::future< bool > eduart::device::HTPA32_Device::requestThermalMeasurementAsync ( const std::vector< HTPA32_Device * > & devices,
std::chrono::milliseconds timeout )
static

Request thermal measurements asynchronously on a set of devices.

Parameters
[in]devicesVector of devices to trigger.
[in]timeoutMaximum time to wait for completion.
Returns
Future resolving to true when all requests succeed.

◆ startCalibration()

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

Start a thermal calibration over a sliding window of frames.

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

◆ stopCalibration()

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

Stop any ongoing thermal calibration sequence.

Returns
true on success.

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