$darkmode
#include "simulation.hpp"#include <cstdint>#include <filesystem>#include <fstream>#include <future>#include <sstream>#include <string>#include <thread>#include <cloe/controller.hpp>#include <cloe/core/abort.hpp>#include <cloe/data_broker.hpp>#include <cloe/registrar.hpp>#include <cloe/simulator.hpp>#include <cloe/trigger/example_actions.hpp>#include <cloe/trigger/set_action.hpp>#include <cloe/utility/resource_handler.hpp>#include <cloe/vehicle.hpp>#include <fable/utility.hpp>#include <fable/utility/sol.hpp>#include "coordinator.hpp"#include "lua_action.hpp"#include "lua_api.hpp"#include "simulation_context.hpp"#include "utility/command.hpp"#include "utility/state_machine.hpp"#include "utility/time_event.hpp"Classes | |
| class | engine::SimulationMachine |
| class | engine::LuaCloeSignal |
| struct | engine::SignalReport |
| struct | engine::SignalsReport |
Macros | |
| #define | PROJECT_SOURCE_DIR "" |
| #define | DEFINE_STATE(Id, S) DEFINE_STATE_STRUCT(SimulationMachine, SimulationContext, Id, S) |
Functions | |
| INCLUDE_RESOURCE (index_html, PROJECT_SOURCE_DIR "/webui/index.html") | |
| INCLUDE_RESOURCE (favicon, PROJECT_SOURCE_DIR "/webui/cloe_16x16.png") | |
| INCLUDE_RESOURCE (cloe_logo, PROJECT_SOURCE_DIR "/webui/cloe.svg") | |
| INCLUDE_RESOURCE (bootstrap_css, PROJECT_SOURCE_DIR "/webui/bootstrap.min.css") | |
| std::string | engine::enumerate_simulator_vehicles (const cloe::Simulator &s) |
| void | engine::handle_cloe_error (cloe::Logger logger, const cloe::Error &e) |
| size_t | engine::insert_triggers_from_config (SimulationContext &ctx) |
| cloe::Json | engine::dump_signals (cloe::DataBroker &db) |
| std::vector< std::string > | engine::dump_signals_autocompletion (cloe::DataBroker &db) |
This file provides the simulation state machine.
The following flow diagram shows how the states of a simulation are traversed in a typical simulation. The nominal flow is rendered in solid lines, while irregular situations are rendered in dashed lines.
┌──────────────────────┐
+------------ │ Connect │
| └──────────────────────┘
| │
| ▼
| ┌──────────────────────┐
+---... │ Start │ <-------------------------+
| └──────────────────────┘ |
| │ |
| ▼ |
| ┌──────────────────────┐ +-----------+ |
+---... │ StepBegin │ ◀──┐<--- | Resume | |
| └──────────────────────┘ │ +-----------+ |
| │ │ ^ |
| ▼ │ | |
| ┌──────────────────────┐ │ | |
+---... │ StepSimulators │ │ | |
| └──────────────────────┘ │ | |
| │ │ | |
| ▼ │ | |
| ┌──────────────────────┐ │ | |
+---... │ StepControllers │ │ | |
| └──────────────────────┘ │ | |
| │ │ | |
v ▼ │ | |
+-----------+ ┌──────────────────────┐ │ +-----------+ |
| Abort | │ StepEnd │ ───┘---> | Pause | |
+-----------+ └──────────────────────┘ +-----------+ |
| | │ | ^ |
| | failure │ success | | |
| | ▼ +-----+ |
| | ┌──────────────────────┐ +-----------+ |
| +--------> │ Stop │ -------> | Reset | ---+
| └──────────────────────┘ +-----------+
| │
| ▼
| ┌──────────────────────┐
+-------------> │ Disconnect │
└──────────────────────┘
Note that not all possible transitions or states are presented in the above diagram; for example, it is possible to go into the Abort state from almost any other state. Neither can one see the constraints that apply to the above transitions; for example, after Abort, the state machine may go into the Stop state, but then will in every case go into the Disconnect state and never into the Reset state.