$darkmode
engine::SimulationContext Struct Reference

#include <simulation_context.hpp>

Collaboration diagram for engine::SimulationContext:

Public Member Functions

 SimulationContext (cloe::Stack conf, sol::state_view l)
 
std::string version () const
 
cloe::Logger logger () const
 
std::shared_ptr< cloe::Registrarsimulation_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::DataBrokerdb
 
std::unique_ptr< Serverserver
 
std::shared_ptr< Coordinatorcoordinator
 
std::shared_ptr< Registrarregistrar
 
std::unique_ptr< CommandExecutercommander
 Configurable system command executer for triggers.
 
SimulationSync sync
 Track the simulation timing.
 
SimulationProgress progress
 Track the approximate progress of the simulation.
 
cloe::Modelnow_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::Durationcycle_duration
 
bool pause_execution {false}
 
SimulationStatistics statistics
 
std::optional< SimulationOutcomeoutcome
 
std::optional< SimulationResultresult
 
std::optional< SimulationProbeprobe
 
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::TimeCallbackcallback_time
 

Detailed Description

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.

Member Data Documentation

◆ now_initializing

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.

◆ pause_execution

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.

◆ probe_simulation

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.


The documentation for this struct was generated from the following files: