|
YAMS
Yet Another Mechanism System
|
#include <SensorData.hpp>
Public Types | |
| enum class | HALValueType { kBoolean , kDouble , kEnum , kInt , kLong } |
Public Member Functions | |
| SensorData (std::string name, std::function< HAL_Value()> supplier, HAL_Value defaultValue, HALValueType type) | |
| SensorData (std::string name, std::function< double()> supplier, double defaultVal) | |
| SensorData (std::string name, std::function< int()> supplier, int defaultVal) | |
| SensorData (std::string name, std::function< bool()> supplier, bool defaultVal) | |
| SensorData (std::string name, std::function< int64_t()> supplier, int64_t defaultVal) | |
| double | GetAsDouble () const |
| int | GetAsInt () const |
| bool | GetAsBoolean () const |
| int64_t | GetAsLong () const |
| HAL_Value | GetValue () const |
| HAL_Value | GetDefault () const |
| std::string | GetName () const |
| HALValueType | GetType () const |
| void | Set (HAL_Value val) |
| void | Set (double val) |
| void | Set (int val) |
| void | Set (int64_t val) |
| void | Set (bool val) |
| void | AddSimTrigger (HAL_Value value, std::function< bool()> trigger) |
| HAL_SimValueHandle | CreateValue (HAL_SimDeviceHandle device, int32_t direction) |
Static Public Member Functions | |
| static HAL_Value | Convert (double value) |
| static HAL_Value | Convert (int value) |
| static HAL_Value | Convert (bool value) |
| static HAL_Value | Convert (int64_t value) |
| static std::function< HAL_Value()> | Convert (std::function< double()> supplier) |
| static std::function< HAL_Value()> | Convert (std::function< int()> supplier) |
| static std::function< HAL_Value()> | Convert (std::function< bool()> supplier) |
| static std::function< HAL_Value()> | Convert (std::function< int64_t()> supplier) |
Encapsulates a single named field of a simulated sensor.
On a real robot the value is read from the supplied callable. In simulation the value is read from (and can be written to) a Glass SimValue, and trigger-based overrides can inject specific values at controlled times.
|
strong |
| yams::motorcontrollers::simulation::SensorData::SensorData | ( | std::string | name, |
| std::function< HAL_Value()> | supplier, | ||
| HAL_Value | defaultValue, | ||
| HALValueType | type | ||
| ) |
| yams::motorcontrollers::simulation::SensorData::SensorData | ( | std::string | name, |
| std::function< double()> | supplier, | ||
| double | defaultVal | ||
| ) |
| yams::motorcontrollers::simulation::SensorData::SensorData | ( | std::string | name, |
| std::function< int()> | supplier, | ||
| int | defaultVal | ||
| ) |
| yams::motorcontrollers::simulation::SensorData::SensorData | ( | std::string | name, |
| std::function< bool()> | supplier, | ||
| bool | defaultVal | ||
| ) |
| yams::motorcontrollers::simulation::SensorData::SensorData | ( | std::string | name, |
| std::function< int64_t()> | supplier, | ||
| int64_t | defaultVal | ||
| ) |
| void yams::motorcontrollers::simulation::SensorData::AddSimTrigger | ( | HAL_Value | value, |
| std::function< bool()> | trigger | ||
| ) |
Override the sensor value whenever trigger returns true.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| HAL_SimValueHandle yams::motorcontrollers::simulation::SensorData::CreateValue | ( | HAL_SimDeviceHandle | device, |
| int32_t | direction | ||
| ) |
Register this field with a SimDevice so it appears in Glass. Called by Sensor during construction (simulation only).
| bool yams::motorcontrollers::simulation::SensorData::GetAsBoolean | ( | ) | const |
| double yams::motorcontrollers::simulation::SensorData::GetAsDouble | ( | ) | const |
| int yams::motorcontrollers::simulation::SensorData::GetAsInt | ( | ) | const |
| int64_t yams::motorcontrollers::simulation::SensorData::GetAsLong | ( | ) | const |
| HAL_Value yams::motorcontrollers::simulation::SensorData::GetDefault | ( | ) | const |
| std::string yams::motorcontrollers::simulation::SensorData::GetName | ( | ) | const |
| HALValueType yams::motorcontrollers::simulation::SensorData::GetType | ( | ) | const |
| HAL_Value yams::motorcontrollers::simulation::SensorData::GetValue | ( | ) | const |
Get the current sensor value (real supplier on robot; Glass/trigger in sim).
| void yams::motorcontrollers::simulation::SensorData::Set | ( | bool | val | ) |
| void yams::motorcontrollers::simulation::SensorData::Set | ( | double | val | ) |
| void yams::motorcontrollers::simulation::SensorData::Set | ( | HAL_Value | val | ) |
| void yams::motorcontrollers::simulation::SensorData::Set | ( | int | val | ) |
| void yams::motorcontrollers::simulation::SensorData::Set | ( | int64_t | val | ) |