$darkmode
#include <simulation_context.hpp>
Public Member Functions | |
| SimulationContext (cloe::Stack conf, sol::state_view l) | |
| std::string | version () const |
| cloe::Logger | logger () const |
| std::shared_ptr< cloe::Registrar > | simulation_registrar () |
| std::vector< std::string > | model_ids () const |
| std::vector< std::string > | simulator_ids () const |
| std::vector< std::string > | controller_ids () const |
| std::vector< std::string > | vehicle_ids () const |
| std::vector< std::string > | plugin_ids () const |
| bool | foreach_model (std::function< bool(cloe::Model &, const char *type)> f) |
| bool | foreach_model (std::function< bool(const cloe::Model &, const char *type)> f) const |
| bool | foreach_simulator (std::function< bool(cloe::Simulator &)> f) |
| bool | foreach_simulator (std::function< bool(const cloe::Simulator &)> f) const |
| bool | foreach_controller (std::function< bool(cloe::Controller &)> f) |
| bool | foreach_controller (std::function< bool(const cloe::Controller &)> f) const |
| bool | foreach_vehicle (std::function< bool(cloe::Vehicle &)> f) |
| bool | foreach_vehicle (std::function< bool(const cloe::Vehicle &)> f) const |
Public Attributes | |
| cloe::Stack | config |
| Input configuration. | |
| std::string | uuid {} |
| UUID to use for simulation. | |
| bool | report_progress {false} |
| Report simulation progress to the console. | |
| bool | probe_simulation {false} |
| sol::state_view | lua |
| std::unique_ptr< cloe::DataBroker > | db |
| std::unique_ptr< Server > | server |
| std::shared_ptr< Coordinator > | coordinator |
| std::shared_ptr< Registrar > | registrar |
| std::unique_ptr< CommandExecuter > | commander |
| Configurable system command executer for triggers. | |
| SimulationSync | sync |
| Track the simulation timing. | |
| SimulationProgress | progress |
| Track the approximate progress of the simulation. | |
| cloe::Model * | now_initializing {nullptr} |
| std::map< std::string, std::unique_ptr< cloe::Simulator > > | simulators |
| std::map< std::string, std::shared_ptr< cloe::Vehicle > > | vehicles |
| std::map< std::string, std::unique_ptr< cloe::Controller > > | controllers |
| timer::DurationTimer< cloe::Duration > | cycle_duration |
| bool | pause_execution {false} |
| SimulationStatistics | statistics |
| std::optional< SimulationOutcome > | outcome |
| std::optional< SimulationResult > | result |
| std::optional< SimulationProbe > | probe |
| std::shared_ptr< events::LoopCallback > | callback_loop |
| std::shared_ptr< events::PauseCallback > | callback_pause |
| std::shared_ptr< events::ResumeCallback > | callback_resume |
| std::shared_ptr< events::StartCallback > | callback_start |
| std::shared_ptr< events::StopCallback > | callback_stop |
| std::shared_ptr< events::SuccessCallback > | callback_success |
| std::shared_ptr< events::FailureCallback > | callback_failure |
| std::shared_ptr< events::ResetCallback > | callback_reset |
| std::shared_ptr< events::TimeCallback > | callback_time |
SimulationContext represents the entire context of a running simulation and is used by SimulationMachine class as the data context for the state machine.
The simulation states need to store any data they want to access in the context here. This does have the caveat that all the data here is accessible to all states.
All input to and output from the simulation is via this struct.
| cloe::Model* engine::SimulationContext::now_initializing {nullptr} |
Non-owning pointer used in order to keep track which model is being initialized in the CONNECT state in order to allow it to be directly aborted if it is hanging during initialization. If no model is being actively initialized the valid value is nullptr.
| bool engine::SimulationContext::pause_execution {false} |
Tell the simulation that we want to transition into the PAUSE state.
We can't do this directly via an interrupt because we can only go into the PAUSE state after STEP_END.
| bool engine::SimulationContext::probe_simulation {false} |
Setup simulation but only probe for information. The simulation should only go through the CONNECT -> PROBE -> DISCONNECT state. The same errors that can occur for a normal simulation can occur here though, so make sure they are handled.