bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::sensors::InfraredMessage Struct Reference

Models a message from an array of infrared reflectance sensors, one value per element: More...

#include <infrared.h>

Inheritance diagram for bitsim::sensors::InfraredMessage:
Collaboration diagram for bitsim::sensors::InfraredMessage:

Static Public Member Functions

static std::optional< InfraredMessage > parse (const std::string &msg)
Static Public Member Functions inherited from bitsim::sensors::MessageBase
static auto unix_seconds_since_epoch (std::chrono::system_clock::time_point point)
static auto unix_milliseconds_since_epoch (std::chrono::system_clock::time_point point)
static std::chrono::system_clock::time_point parse_utc_timestamp (const std::string &ts)

Public Attributes

std::vector< real_t > values
 The reflectance under each element, in [0, 1].
Public Attributes inherited from bitsim::sensors::MessageBase
std::chrono::system_clock::time_point source_timestamp
std::chrono::system_clock::time_point received_timestamp {std::chrono::system_clock::now()}

Detailed Description

Models a message from an array of infrared reflectance sensors, one value per element:

{"values": [0.91, 0.12, 0.88], "timestamp": "2026-11-18 10:15:02"}

Each value is the share of the infrared light that the floor under the element reflects back, from 0 for black to 1 for white. A board that reads the elements with an ADC divides by the reading over white paper. timestamp, in UTC, is optional.

Member Function Documentation

◆ parse()

std::optional< InfraredMessage > bitsim::sensors::InfraredMessage::parse ( const std::string & msg)
static
Returns
The message, or nothing if the text is not a valid message

Member Data Documentation

◆ values

std::vector<real_t> bitsim::sensors::InfraredMessage::values

The reflectance under each element, in [0, 1].


The documentation for this struct was generated from the following files: