|
FhSim
3.1.0
Marine systems simulation
|
#include <SampledSensor.h>
Public Member Functions | |
| SampledSensor (ISimObjectCreator *creator, std::string kind, std::string name) | |
| SampledSensor (std::string kind, std::string name, const double mountOffset[3], const double mountDirection[3], double period, unsigned int seed) | |
| void | SetSamplePeriod (double period) |
| bool | HasPorts () const |
| True when built by the creator, so the ports exist and the sensor runs. | |
| unsigned int | Seed () const |
| The random seed; zero is deterministic and noise free. | |
| environment::EnvironmentProvider * | SetUpEnvironment (ISimObjectCreator *creator) |
| environment::EnvironmentProvider * | Environment () const |
| The environment found by SetUpEnvironment, or null. | |
| template<typename Measure > | |
| int | ForEachDueSample (const double t, Measure &&measure) |
| const SensorFrame & | Frame () const |
| The mounting geometry. | |
| SensorNoise & | Noise () |
| The random draws. | |
| const SensorNoise & | Noise () const |
| The random draws. | |
| double | NextSampleTime () const |
| The time of the next sample, s. | |
| const std::string & | Name () const |
| The name of the owning SimObject. | |
| std::string | Label () const |
| The message prefix, e.g. "SensorCtd 'Ctd'". | |
| void | Warn (const std::string &text) const |
| Writes a warning to the host logger, if there is one. | |
| void | Info (const std::string &text) const |
| Writes an information line to the host logger, if there is one. | |
Owns what every fixed-rate AUV sensor needs around its measurement.
A sampled sensor is a SimObject that takes a measurement at fixed instants of the accepted simulation time, at a point rigidly mounted on a moving body, with portable random imperfections. The CTD, the SilCam and the echosounder each own one SampledSensor member and supply only the measurement.
The member holds:
Pos and Quater inports and the mounting parameters);NoiseSeed parameter (FISH-0027);Environment, found once and only when the sensor has ports.There are two constructors, as on the sensors. The creator one registers the ports and reads the parameters; it leaves no sample due until SetSamplePeriod, because each sensor reads its rate under its own parameter name. The port-free one exists so the sensors can be unit tested without a host: it has no ports, no logger and no environment.
@group block and appears in no model list. | SampledSensor::SampledSensor | ( | ISimObjectCreator * | creator, |
| std::string | kind, | ||
| std::string | name | ||
| ) |
Registers the body ports, reads NoiseSeed and finds the host logger.
| creator | The creator of the owning SimObject. |
| kind | The sensor's class name, e.g. "SensorCtd", used in messages. |
| name | The name of the owning SimObject. |
| SampledSensor::SampledSensor | ( | std::string | kind, |
| std::string | name, | ||
| const double | mountOffset[3], | ||
| const double | mountDirection[3], | ||
| double | period, | ||
| unsigned int | seed | ||
| ) |
Constructs a sensor with no ports, for unit tests.
| kind | The sensor's class name, used in messages. |
| name | The name of the owning object. |
| mountOffset | The sensor position in the body frame, m. |
| mountDirection | The beam direction in the body frame. |
| period | The time between samples, s; must be positive. |
| seed | The random seed; zero is deterministic and noise free. |
|
inline |
Calls measure once for every sample due at time t.
A loop and not an if, so a long accepted step does not silently drop samples.
| t | The current simulation time, s. |
| measure | Takes one sample; called with no arguments. |
| void SampledSensor::SetSamplePeriod | ( | double | period | ) |
Restarts the clock at time zero with the given period.
| period | The time between samples, s; must be positive. |
| environment::EnvironmentProvider * SampledSensor::SetUpEnvironment | ( | ISimObjectCreator * | creator | ) |
Finds the shared environment once.
| creator | The creator of the owning SimObject. |
FindEnvironment has reported the error.