$darkmode
vtd::VtdVehicle Class Reference

#include <vtd_vehicle.hpp>

Inheritance diagram for vtd::VtdVehicle:
Collaboration diagram for vtd::VtdVehicle:

Public Member Functions

 VtdVehicle (uint64_t id, const std::string &name, std::unique_ptr< RdbTransceiverTcp > &&rdb_client, std::shared_ptr< TaskControl > task_control)
 
const std::string & vtd_name () const
 
void vtd_step_vehicle_control (const cloe::Sync &sync, ScpTransceiver &tx, LabelConfiguration lbl)
 
cloe::Duration vtd_step_sensors (const cloe::Sync &s)
 
void update_label (ScpTransceiver &tx, LabelConfiguration lbl)
 
void send_label (ScpTransceiver &tx) const
 
void reset ()
 
void configure_components (const std::map< std::string, VtdComponentConfig > &components)
 
- Public Member Functions inherited from cloe::Vehicle
 Vehicle (uint64_t id, const std::string &name)
 
std::shared_ptr< Vehicleclone (uint64_t id, const std::string &name)
 
uint64_t id () const
 
size_t size () const
 
bool has (const std::string &key) const
 
template<typename Enum , std::enable_if_t< std::is_enum< Enum >::value, int > = 0>
bool has (Enum c) const
 
template<typename T >
std::shared_ptr< const T > get (const std::string &key) const
 
template<typename T >
std::shared_ptr< T > get (const std::string &key)
 
template<typename T , typename Enum , std::enable_if_t< std::is_enum< Enum >::value, int > = 0>
std::shared_ptr< const T > get (Enum c) const
 
template<typename T , typename Enum , std::enable_if_t< std::is_enum< Enum >::value, int > = 0>
std::shared_ptr< T > get (Enum c)
 
template<typename... Arguments>
void new_component (Component *ptr, const Arguments &... aliases)
 
template<typename First , typename... Arguments>
void add_component (std::shared_ptr< Component > sp, const First &alias, const Arguments &... aliases)
 
template<typename Enum , std::enable_if_t< std::is_enum< Enum >::value, int > = 0>
void add_component (std::shared_ptr< Component > sp, Enum c)
 
void add_component (std::shared_ptr< Component > sp, const std::string &alias)
 
template<typename First , typename... Arguments>
void emplace_component (std::shared_ptr< Component > sp, const First &alias, const Arguments &... aliases)
 
template<typename Enum , std::enable_if_t< std::is_enum< Enum >::value, int > = 0>
void emplace_component (std::shared_ptr< Component > sp, Enum c)
 
void emplace_component (std::shared_ptr< Component > sp, const std::string &alias)
 
void set_component (const std::string &key, std::shared_ptr< Component > component)
 
std::vector< std::string > component_names () const
 
Duration process (const Sync &sync) override
 
void connect () override
 
void disconnect () override
 
void enroll (Registrar &r) 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 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)
 

Public Attributes

const std::string DEFAULT_SENSOR_NAME = "cloe::vtd::sensor::default"
 
std::string vtd_name_ {}
 
uint16_t sensor_port_ {0}
 
uint16_t id_ {0}
 
std::shared_ptr< TaskControltask_control_ {nullptr}
 
std::map< std::string, std::shared_ptr< VtdSensorData > > sensors_
 
std::shared_ptr< VtdVehicleControlego_control_ {nullptr}
 
scp::LabelVehicle vehicle_label_
 

Friends

void to_json (cloe::Json &j, const VtdVehicle &v)
 

Additional Inherited Members

- Protected Member Functions inherited from cloe::Vehicle
std::shared_ptr< const Componentat (const std::string &key) const
 
std::shared_ptr< Componentat (const std::string &key)
 
- 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_
 

Detailed Description

The VtdVehicle class contains all information pertaining to a vehicle represented in VTD.

Constructor & Destructor Documentation

◆ VtdVehicle()

vtd::VtdVehicle::VtdVehicle ( uint64_t  id,
const std::string &  name,
std::unique_ptr< RdbTransceiverTcp > &&  rdb_client,
std::shared_ptr< TaskControl task_control 
)
inline

Construct a new VtdVehicle.

Parameters
idA globally unique identifier number for this vehicle.
nameThe VTD scenario name of this vehicle. This can then be retrieved with the vtd_name() method. This is different from what is returned by name(), because the VTD name of a vehicle does not need to conform by the identifier requirements that apply to name().
rdb_clientRDB client unique to this vehicle. VTD creates an RDB communication channel for each vehicle in the scenario that we receive sensor data for. This channel is unique to the vehicle.
task_controlTask Control client shared with all vehicles. In order to transmit actuator data, we need to use the groundtruth communication channel that VTD provides. This is also the channel where the global groundtruth data is transmitted. We don't currently use this for retrieving ground truth data however, but may in the future.
Here is the call graph for this function:

Member Function Documentation

◆ reset()

void vtd::VtdVehicle::reset ( )
inlinevirtual

Reset the vehicle, as far as possible.

Reimplemented from cloe::Model.

◆ send_label()

void vtd::VtdVehicle::send_label ( ScpTransceiver tx) const
inline

Send the vehicle label to VTD.

◆ update_label()

void vtd::VtdVehicle::update_label ( ScpTransceiver tx,
LabelConfiguration  lbl 
)
inline

If state is different from previous, then we update the LabelVehicle and send the info.

This has to been done after all actuations have been made but before the cache is cleared for the next cycle.

◆ vtd_name()

const std::string& vtd::VtdVehicle::vtd_name ( ) const
inline

Return the name VTD associates with this vehicle.

◆ vtd_step_sensors()

cloe::Duration vtd::VtdVehicle::vtd_step_sensors ( const cloe::Sync s)
inline

Do everything that a vehicle needs after a step is triggered.

Here is the call graph for this function:

◆ vtd_step_vehicle_control()

void vtd::VtdVehicle::vtd_step_vehicle_control ( const cloe::Sync sync,
ScpTransceiver tx,
LabelConfiguration  lbl 
)
inline

Do everything that a vehicle needs before a step is triggered.

This currently does everything for the actuation.

Friends And Related Function Documentation

◆ to_json

void to_json ( cloe::Json &  j,
const VtdVehicle v 
)
friend

Write the JSON representation into j.


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