$darkmode
Public Member Functions | |
| VtdBinding (const std::string &name, const VtdConfiguration &config) | |
| void | abort () final |
| void | connect () final |
| void | disconnect () final |
| void | connect_and_configure (size_t) |
| void | enroll (cloe::Registrar &r) final |
| void | clear () |
| void | reset () final |
| size_t | num_vehicles () const final |
| std::shared_ptr< cloe::Vehicle > | get_vehicle (size_t i) const final |
| std::shared_ptr< cloe::Vehicle > | get_vehicle (const std::string &key) const final |
| void | start (const cloe::Sync &) final |
| cloe::Duration | process (const cloe::Sync &sync) final |
| void | stop (const cloe::Sync &) final |
Public Member Functions inherited from cloe::Model | |
| virtual | ~Model () noexcept=default |
| virtual Duration | resolution () const |
| virtual bool | is_connected () const |
| virtual bool | is_operational () const |
| virtual void | pause (const Sync &) |
| virtual void | resume (const Sync &) |
| Entity (std::string name) | |
| Entity (std::string name, std::string desc) | |
Public Member Functions inherited from cloe::Entity | |
| Entity (std::string name) | |
| Entity (std::string name, std::string desc) | |
| const std::string & | name () const |
| void | set_name (std::string name) |
| const std::string & | description () const |
| void | set_description (std::string desc) |
Protected Member Functions | |
| std::shared_ptr< VtdVehicle > | get_vehicle_by_id (uint64_t id) const |
| std::shared_ptr< VtdVehicle > | get_vehicle_by_name (const std::string &name) const |
| void | init_camera_position (const std::string &name) |
| void | readall_scp () |
| void | scp_try_read_until (std::function< bool(void)> pred) |
| void | apply_scp (const std::string &scp_message) |
| void | apply_scp_rdb (boost::property_tree::ptree &xml) |
| void | apply_scp_set (boost::property_tree::ptree &xml) |
| void | apply_scp_init_done (boost::property_tree::ptree &xml) |
| void | apply_scp_run (boost::property_tree::ptree &) |
| void | apply_scp_restart (boost::property_tree::ptree &) |
| void | apply_scp_stop (boost::property_tree::ptree &) |
| void | apply_scenario_filename (boost::property_tree::ptree &xml) |
| void | apply_scp_scenario_response (boost::property_tree::ptree &xml) |
| fs::path | relative_scenario_path (const fs::path &p) |
Protected Member Functions inherited from cloe::Entity | |
| virtual Logger | logger () const |
Friends | |
| void | to_json (cloe::Json &j, const VtdBinding &b) |
Additional Inherited Members | |
Protected Attributes inherited from cloe::Model | |
| bool | connected_ {false} |
| bool | operational_ {false} |
Protected Attributes inherited from cloe::Entity | |
| std::string | name_ |
| std::string | desc_ |
|
inlinefinalvirtual |
Signal an abort to model processing.
This method is called asynchronously. It is highly recommended to make use of a std::atomic_bool for purposes of making the abortion request known to other parts of the model. This method is called when the user requests the simulation to be aborted, e.g., by sending the SIGINT signal.
An abort will be followed by a stop if the simulation was started.
The default implementation will throw an error. This will be caught and possibly ignored. Otherwise, the simulation will be killed.
Reimplemented from cloe::Model.
|
inlineprotected |
Parse selected VTD SCP messages and call the relevant apply methods.
|
inlineprotected |
Create a new vehicle if one with the given ID does not already exist.
We get this before "SimCtrl.Run" arrives. However, users may use the Set command, and therefore these are only processed while VTD is not running.
|
inline |
Clear internal data-structures so that we can configure() again.
|
inlinefinalvirtual |
Initiate a connection to the model, including any initialization.
After a successful connection, the following methods shall be callable:
enroll(Registrar&)start(const Sync&)When implementing this method, e.g. via override or final, make sure to call this method:
void MySuperModel::connect() final { // Your connection code Model::connect(); }
Reimplemented from cloe::Model.
|
inline |
Connect to and configure VTD.
Reads SCP bus and collects VTD state information until VTD initialization is completed.
|
inlinefinalvirtual |
Tear down the connection to the model.
After successful disconnection, it is not expected that the model should be able to connect again.
When implementing this method, e.g. via override or final, make sure to call this method:
void MySuperModel::disconnect() final { // Your disconnection code Model::disconnect(); }
Reimplemented from cloe::Model.
|
inlinefinalvirtual |
Register any events, actions, or handlers with the registrar.
Reimplemented from cloe::Model.
|
inlinefinalvirtual |
Return a pointer to a Vehicle.
Implements cloe::Simulator.
|
inlinefinalvirtual |
Return a pointer to a Vehicle.
Implements cloe::Simulator.
|
inlineprotected |
Return a VtdVehicle with the given name, or nullptr if it doesn't exist.
Thus, this function can be used to also check if a vehicle has a particular name:
if (this->get_vtd_vehicle(name)) { // ... }
|
inlineprotected |
Set the initial camera position on the vehicle with the given name.
|
inlinefinalvirtual |
Return the number of vehicles that the simulator binding has access to.
Implements cloe::Simulator.
|
inlinefinalvirtual |
Synchronize with VTD and trigger the next VTD frame calculation.
It performs the following steps:
Implements cloe::Simulator.
|
inlineprotected |
Read as many SCP messages as the client currently has in the buffer and apply them, one after another.
This can result in pretty much any change in the binding, including:
Note: currently there is no need to read a "single" scp message, so there is no read_scp function anymore.
|
inlinefinalvirtual |
Restart VTD and reset the essential parts of the binding.
This is not a true reset as some state VTD will remain (e.g. sensor configuration). But the simulation time together with all objects of the scenario will start over from 0.
Reimplemented from cloe::Model.
|
inlinefinalvirtual |
Perform model setup for the simulation.
The passed Sync interface should return a step and time of zero.
process(const Sync&) is called.is_operational() should return true after this. Reimplemented from cloe::Model.
|
inlinefinalvirtual |
Perform final work that may throw an exception.
This is called after the last process call when the simulation is through. It is possible after a call to stop, that a reset will be called, followed by a further start. Nominally, however, it will be followed by a disconnect.
is_operational() should return false after this. Reimplemented from cloe::Model.