$darkmode
#include <simulator.hpp>
Public Member Functions | |
| virtual size_t | num_vehicles () const =0 |
| virtual std::shared_ptr< Vehicle > | get_vehicle (size_t i) const =0 |
| virtual std::shared_ptr< Vehicle > | get_vehicle (const std::string &key) const =0 |
| Duration | process (const Sync &) override=0 |
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 | connect () |
| virtual void | disconnect () |
| virtual void | enroll (Registrar &) |
| virtual void | start (const Sync &) |
| virtual void | pause (const Sync &) |
| virtual void | resume (const Sync &) |
| virtual void | stop (const Sync &) |
| virtual void | reset () |
| virtual void | abort () |
| 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) |
Additional Inherited Members | |
Protected Member Functions inherited from cloe::Entity | |
| virtual Logger | logger () const |
Protected Attributes inherited from cloe::Model | |
| bool | connected_ {false} |
| bool | operational_ {false} |
Protected Attributes inherited from cloe::Entity | |
| std::string | name_ |
| std::string | desc_ |
The Simulator interface provides a model of the world.
This class binds Cloe to the a simulator, such as VTD or Minimator. In particular, it...
A Simulator is not expected to survive for more than one simulation. However, it should be able to connect and disconnect to a simulation, so that more than one Simulator instance can exist at any point in time.
Make sure to implement the following methods from the Model interface:
Duration resolution() constbool is_connected() constbool is_operational() constvoid connect()void disconnect()void enroll(Registrar&)void start(const Sync&)Duration process(const Sync&) = 0void pause(const Sync&)void resume(const Sync&)void stop(const Sync&)void reset()void abort()See the documentation for the Model class for information on when these methods are called in a simulation.
The majority of the step-for-step work occurs in the process method. After each simulator binding has processed, the vehicles will be processed. Since under-the-hood, each vehicle is provided by one of the simulators, consider that vehicle-specific work does not need to be done in the simulator process method.
The following methods are specific to the Simulator interface:
size_t num_vehicles()std::shared_ptr<Vehicle> get_vehicle(size_t)std::shared_ptr<Vehicle> get_vehicle(const std::string&)
|
pure virtual |
Return a pointer to a Vehicle.
Implemented in cloe::simulator::NopSimulator, minimator::MinimatorSimulator, and vtd::VtdBinding.
|
pure virtual |
Return a pointer to a Vehicle.
Implemented in cloe::simulator::NopSimulator, minimator::MinimatorSimulator, and vtd::VtdBinding.
|
pure virtual |
Return the number of vehicles that the simulator binding has access to.
Implemented in cloe::simulator::NopSimulator, minimator::MinimatorSimulator, and vtd::VtdBinding.
Send vehicle actuations to the simulator and retrieve the new world state.
Implements cloe::Model.
Implemented in cloe::simulator::NopSimulator, minimator::MinimatorSimulator, and vtd::VtdBinding.