$darkmode
vtd::VtdLatLongActuator Class Reference

#include <actuator_component.hpp>

Inheritance diagram for vtd::VtdLatLongActuator:
Collaboration diagram for vtd::VtdLatLongActuator:

Public Member Functions

 VtdLatLongActuator (std::shared_ptr< TaskControl > tc, uint64_t id)
 
bool update_vehicle_label () override
 
cloe::utility::ActuationLevel get_actuation_level () override
 
cloe::Duration process (const cloe::Sync &sync) override
 
void reset () override
 
void step_begin (const cloe::Sync &) override
 
void step_end (const cloe::Sync &) override
 
cloe::Json to_json () const override
 
- Public Member Functions inherited from cloe::LatLongActuator
virtual void set_acceleration (double a)
 
virtual boost::optional< double > acceleration ()
 
virtual bool is_acceleration () const
 
virtual void set_steering_angle (double a)
 
virtual boost::optional< double > steering_angle ()
 
virtual bool is_steering_angle () const
 
utility::ActuationLevel actuation_level () const
 
fable::Json active_state () const override
 
 Component (const std::string &name, const std::string &description="")
 
 Component (std::string &&name, std::string &&description="")
 
- Public Member Functions inherited from cloe::Component
 Component (const std::string &name, const std::string &description="")
 
 Component (std::string &&name, std::string &&description="")
 
uint64_t id () const
 
template<typename T >
T * as ()
 
Duration process (const Sync &sync) override
 
void reset () override
 
void abort () override
 
- 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 &)
 
 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::LatLongActuator
utility::ActuationLevel level_
 
boost::optional< double > target_acceleration_
 
boost::optional< double > target_steering_angle_
 
- Protected Attributes inherited from cloe::Model
bool connected_ {false}
 
bool operational_ {false}
 
- Protected Attributes inherited from cloe::Entity
std::string name_
 
std::string desc_
 

Detailed Description

VtdLatLongActuator implements LatLongActuator for the VTD binding.

Usage

Every VTD cycle, the following needs to be done:

  • has_level_change must be used before clear_cache is called
  • step_begin registers any actuation with the TaskControl client, and must be called before clear_cache.
  • clear_cache must be called before the cycle is over.
  • TaskControl::add_trigger_and_send must be called to send the information to VTD.

Member Function Documentation

◆ get_actuation_level()

cloe::utility::ActuationLevel vtd::VtdLatLongActuator::get_actuation_level ( )
inlineoverridevirtual

Return the current actuation level, if applicable.

Reimplemented from vtd::VtdVehicleControl.

Here is the call graph for this function:

◆ process()

cloe::Duration vtd::VtdLatLongActuator::process ( const cloe::Sync )
inlineoverridevirtual

Perform model processing given the simulation context.

In particular, the model may read and write information from and to data it has, in particular any vehicles.

  • Method is_operational() should return true.
  • It may throw an exception. Those derived from ModelError are more likely to be correctly handled, however. The simulation may handle it by a) removing or replacing the model, b) stopping the simulation, or c) ignoring the exception. In the last case, this method will be called again in the next simulation step. In any case, assume that the simulation will print a message to the logs or the console.
  • It should return the current simulation duration from the model's time domain, which is expected to be less or equal to sync.time().

Reimplemented from cloe::LatLongActuator.

◆ reset()

void vtd::VtdLatLongActuator::reset ( )
inlineoverridevirtual

Reset the model state.

This is called when Cloe is asked to reset the whole simulation to time 0. This can be the case when the simulator or a controller asks us to recover from a temporary problem without repeating the whole simulation setup.

The default implementation will raise an error. So if your model is not able to re-initialize, the simulation will be aborted.

Reimplemented from cloe::LatLongActuator.

◆ step_begin()

void vtd::VtdLatLongActuator::step_begin ( const cloe::Sync sync)
inlineoverridevirtual

Add the DriverControl or DynObjectState package to the TaskControl.

This should only be called once per simulation step. This method will not pay attention for you. Later, when the TaskControl sends its packages, this one will be part of it.

Implements vtd::VtdVehicleControl.

◆ step_end()

void vtd::VtdLatLongActuator::step_end ( const cloe::Sync )
inlineoverridevirtual

Operations after vehicle control information was added to the TaskControl message and the vehicle labels were set.

Reimplemented from vtd::VtdVehicleControl.

◆ update_vehicle_label()

bool vtd::VtdLatLongActuator::update_vehicle_label ( )
inlineoverridevirtual

Returns true when the controller actuation state changes from its previous configuration.

This should only be called after all controllers have run for a particular simulation step. Unless of course you are interested if "so far" the state is different or not. The "old state" with which the current state is compared is the state that is present at the time that a control message is sent to VTD. This means that after calling send_driver_control, this method will definitely return false.

Reimplemented from vtd::VtdVehicleControl.


The documentation for this class was generated from the following file: