11#include "SampleClock.h"
12#include "SensorFrame.h"
13#include "SensorNoise.h"
15#include <fhsim/simobject/SimObject.h>
22class EnvironmentProvider;
57 SampledSensor(ISimObjectCreator* creator, std::string kind, std::string name);
68 SampledSensor(std::string kind, std::string name,
const double mountOffset[3],
const double mountDirection[3],
69 double period,
unsigned int seed);
81 unsigned int Seed()
const {
return m_seed; }
92 environment::EnvironmentProvider*
Environment()
const {
return m_environment; }
102 template<
typename Measure>
106 while (m_clock.
Due(t)) {
126 const std::string&
Name()
const {
return m_name; }
129 std::string
Label()
const {
return m_kind +
" '" + m_name +
"'"; }
132 void Warn(
const std::string& text)
const;
135 void Info(
const std::string& text)
const;
142 unsigned int m_seed = 0;
144 PrintDuringExec* m_print =
nullptr;
145 bool m_hasPorts =
false;
147 environment::EnvironmentProvider* m_environment =
nullptr;
Definition SampleClock.h:40
bool Due(const double t)
Definition SampleClock.h:65
double NextSampleTime() const
The time at which the next sample is due, s.
Definition SampleClock.h:76
Definition SampledSensor.h:49
bool HasPorts() const
True when built by the creator, so the ports exist and the sensor runs.
Definition SampledSensor.h:78
const std::string & Name() const
The name of the owning SimObject.
Definition SampledSensor.h:126
void Warn(const std::string &text) const
Writes a warning to the host logger, if there is one.
unsigned int Seed() const
The random seed; zero is deterministic and noise free.
Definition SampledSensor.h:81
void SetSamplePeriod(double period)
const SensorFrame & Frame() const
The mounting geometry.
Definition SampledSensor.h:114
SampledSensor(ISimObjectCreator *creator, std::string kind, std::string name)
void Info(const std::string &text) const
Writes an information line to the host logger, if there is one.
int ForEachDueSample(const double t, Measure &&measure)
Definition SampledSensor.h:103
std::string Label() const
The message prefix, e.g. "SensorCtd 'Ctd'".
Definition SampledSensor.h:129
environment::EnvironmentProvider * SetUpEnvironment(ISimObjectCreator *creator)
const SensorNoise & Noise() const
The random draws.
Definition SampledSensor.h:120
environment::EnvironmentProvider * Environment() const
The environment found by SetUpEnvironment, or null.
Definition SampledSensor.h:92
SampledSensor(std::string kind, std::string name, const double mountOffset[3], const double mountDirection[3], double period, unsigned int seed)
double NextSampleTime() const
The time of the next sample, s.
Definition SampledSensor.h:123
SensorNoise & Noise()
The random draws.
Definition SampledSensor.h:117
Definition SensorFrame.h:36
Definition SensorNoise.h:39