|
YAMS
Yet Another Mechanism System
|
#include <Sensor.hpp>
Public Member Functions | |
| Sensor (std::string sensorName, std::vector< SensorData > fields) | |
| Sensor (const yams::mechanisms::config::SimSensorConfig &cfg) | |
| SensorData & | GetField (const std::string &name) |
| const SensorData & | GetField (const std::string &name) const |
| double | GetAsDouble (const std::string &name) const |
| int | GetAsInt (const std::string &name) const |
| bool | GetAsBoolean (const std::string &name) const |
| int64_t | GetAsLong (const std::string &name) const |
| HAL_SimDeviceHandle | GetDevice () const |
| void | AddSimTrigger (const std::string &field, HAL_Value value, std::function< bool()> trigger) |
Simulated sensor backed by a HAL SimDevice.
All fields report the real supplier value on a physical robot. In simulation they surface in the Glass UI and can be overridden with trigger-based values for automated testing scenarios.
| yams::motorcontrollers::simulation::Sensor::Sensor | ( | std::string | sensorName, |
| std::vector< SensorData > | fields ) |
Construct a sensor from a name and an explicit list of fields.
| sensorName | Name shown in the Glass simulation window. |
| fields | Fields to register with the SimDevice. |
|
explicit |
Construct from a SimSensorConfig builder.
| void yams::motorcontrollers::simulation::Sensor::AddSimTrigger | ( | const std::string & | field, |
| HAL_Value | value, | ||
| std::function< bool()> | trigger ) |
Set field to value whenever trigger returns true.
| bool yams::motorcontrollers::simulation::Sensor::GetAsBoolean | ( | const std::string & | name | ) | const |
| double yams::motorcontrollers::simulation::Sensor::GetAsDouble | ( | const std::string & | name | ) | const |
| int yams::motorcontrollers::simulation::Sensor::GetAsInt | ( | const std::string & | name | ) | const |
| int64_t yams::motorcontrollers::simulation::Sensor::GetAsLong | ( | const std::string & | name | ) | const |
| HAL_SimDeviceHandle yams::motorcontrollers::simulation::Sensor::GetDevice | ( | ) | const |
The underlying SimDevice handle (invalid on a real robot).
| SensorData & yams::motorcontrollers::simulation::Sensor::GetField | ( | const std::string & | name | ) |
Get the SensorData for name (throws if not found).
| const SensorData & yams::motorcontrollers::simulation::Sensor::GetField | ( | const std::string & | name | ) | const |