36 std::mt19937_64 gen(
static_cast<uint64_t
>(std::chrono::system_clock::now().time_since_epoch().count()));
37 std::uniform_int_distribution<uint64_t> dist(0, std::numeric_limits<uint64_t>::max() / 2);
52 return "BaroSimulator";
62 return "Data Simulator";
69 if (ImGui::InputDouble(fmt::format(
"Sea-level pressure##{}",
size_t(
id)).c_str(), &
_pressure0, 0.0, 0.0,
"%.3f hPa"))
74 if (ImGui::InputDouble(fmt::format(
"Sea-level temperature##{}",
size_t(
id)).c_str(), &
_temp0, 0.0, 0.0,
"%.3f K"))
79 if (ImGui::InputDouble(fmt::format(
"Temperature lapse rate##{}",
size_t(
id)).c_str(), &
_lapserate, 0.0, 0.0,
"%.6f K / m"))
84 if (ImGui::InputDouble(fmt::format(
"Geoid undulation##{}",
size_t(
id)).c_str(), &
_geoidhgt, 0.0, 0.0,
"%.3f m"))
89 ImGui::SetNextItemWidth(columnWidth);
99 if (ImGui::InputDouble(fmt::format(
"Gravity##{}",
size_t(
id)).c_str(), &
_gravity, 0.0, 0.0,
"%.5f m / s²"))
112 if (ImGui::InputDouble(fmt::format(
"Std. Dev. of Pressure noise##{}",
size_t(
id)).c_str(), &
_pressurenoise, 0.0, 0.0,
"%.3f hPa"))
119 float currentCursorX = ImGui::GetCursorPosX();
120 if (ImGui::Checkbox(fmt::format(
"##rng.useSeed {} {}", title,
size_t(
id)).c_str(), &rng.useSeed))
122 LOG_DEBUG(
"{}: {} rng.useSeed changed to {}",
nameId(), title, rng.useSeed);
125 if (ImGui::IsItemHovered()) { ImGui::SetTooltip(
"Use seed?"); }
129 ImGui::BeginDisabled();
131 ImGui::SetNextItemWidth(itemWidth - (ImGui::GetCursorPosX() - currentCursorX));
132 if (
ImGui::SliderULong(fmt::format(
"{} Seed##{}", title,
size_t(
id)).c_str(), &rng.seed, 0, std::numeric_limits<uint64_t>::max() / 2,
"%lu"))
139 ImGui::EndDisabled();
185 if (j.contains(
"temp0"))
187 j.at(
"temp0").get_to(
_temp0);
189 if (j.contains(
"pressure0"))
193 if (j.contains(
"lapserate"))
197 if (j.contains(
"geoidhgt"))
201 if (j.contains(
"gravity"))
205 if (j.contains(
"initPos"))
209 if (j.contains(
"gravityInput"))
213 if (j.contains(
"pressurenoise"))
217 if (j.contains(
"pressureRng"))
225 auto PosObs = std::static_pointer_cast<const Pos>(queue.
extract_front());
227 auto pressureObs = std::make_shared<BaroPressObs>();
229 pressureObs->insTime = PosObs->insTime;
Barometric Pressure Storage Class.
Barometer observation simulator.
Combo representing an enumeration.
nlohmann::json json
json namespace
Different Gravity Models.
Text Help Marker (?) with Tooltip.
Utility class for logging to console and file.
#define LOG_DEBUG
Debug information. Should not be called on functions which receive observations (spamming)
#define LOG_DATA
All output which occurs repeatedly every time observations are received.
#define LOG_TRACE
Detailled info to trace the execution of the program. Should not be called on functions which receive...
static std::string type()
Returns the type of the data class.
static constexpr size_t OUTPUT_PORT_INDEX_BAROPRESSURE
Flow.
double _pressurenoise
pressure noise in hPa
json save() const override
Saves the node into a json object.
double _gravity
Gravity in m / s²
static std::string typeStatic()
String representation of the Class Type.
void receiveObs(InputPin::NodeDataQueue &queue, size_t pinIdx)
Converts the RtklibPosObs into PosVel.
~BaroSimulator() override
Destructor.
double _pressure0
Pressure at Sea level in hPa.
RandomNumberGenerator _pressureRng
Random number generator for the pressure noise.
double _temp0
Temperature at Sea level in deg K.
void guiConfig() override
ImGui config window which is shown on double click.
static std::string category()
String representation of the Class Category.
BaroSimulator()
Default constructor.
Eigen::Vector3d _initPos
Initial position in LLA [deg, deg, m] for the calculation of the local gravity through EGM96.
void deinitialize() override
Deinitialize the node.
double _lapserate
Temperature lapse rate in K / m.
bool initialize() override
Initialize the node.
GravityInput _gravityInput
Default gravity input type.
@ Position
Entry of the position, gravity is then deducted from EGM96.
@ Manual
Manual entry of the gravity's magnitude.
double _geoidhgt
Geoid undulation in m.
void restore(const json &j) override
Restores the node from a json object.
double _exponent
save computations, by storing g * M / R0 / L;
std::string type() const override
String representation of the Class Type.
static constexpr double Rg
Universal gas constant in [J/K/mol].
static constexpr double dMtr
Molar mass of dry air in [kg/mol].
ImVec2 _guiConfigDefaultWindowSize
Node(std::string name)
Constructor.
std::string nameId() const
Node name and id.
std::string name
Name of the Node.
void invokeCallbacks(size_t portIndex, const std::shared_ptr< const NodeData > &data)
Calls all registered callbacks on the specified output port.
bool _hasConfig
Flag if the config window should be shown.
static std::string type()
Returns the type of the data class.
Manages a thread which calls a specified function at a specified interval.
auto extract_front()
Returns a copy of the first element in the container and removes it from the container.
static float windowFontRatio()
Ratio to multiply for GUI window elements.
bool SliderULong(const char *label, uint64_t *v, uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for 'uint64'.
bool InputDouble3(const char *label, double v[3], const char *format, ImGuiInputTextFlags flags)
Shows an InputText GUI element for an array of 'double[3]'.
OutputPin * CreateOutputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier, OutputPin::PinData data=static_cast< void * >(nullptr), int idx=-1)
Create an Output Pin object.
InputPin * CreateInputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier={}, InputPin::Callback callback=static_cast< InputPin::FlowFirableCallbackFunc >(nullptr), InputPin::FlowFirableCheckFunc firable=nullptr, int priority=0, int idx=-1)
Create an Input Pin object.
void ApplyChanges()
Signals that there have been changes to the flow.
Eigen::Vector3< typename Derived::Scalar > n_calcGravitation_EGM96(const Eigen::MatrixBase< Derived > &lla_position, size_t ndegree=10)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...