Description

Agent wrapper of a wheeled vehicle, in particular holds a pointer to a ChWheeledVehicle and sends out SynWheeledVehicleMessage-s to synchronize its state.

#include <SynWheeledVehicleAgent.h>

Inheritance diagram for chrono::synchrono::SynWheeledVehicleAgent:
Collaboration diagram for chrono::synchrono::SynWheeledVehicleAgent:

Public Member Functions

 SynWheeledVehicleAgent (chrono::vehicle::ChWheeledVehicle *vehicle=nullptr, const std::string &filename="")
 Construct a wheeled vehicle agent with optionally a vehicle. More...
 
virtual ~SynWheeledVehicleAgent ()
 Destructor.
 
virtual void InitializeZombie (ChSystem *system) override
 Initialize this agents zombie representation Bodies are added and represented in the lead agent's world. More...
 
virtual void SynchronizeZombie (std::shared_ptr< SynMessage > message) override
 Synchronize this agents zombie with the rest of the simulation. More...
 
virtual void Update () override
 Update this agent Typically used to update the state representation of the agent to be distributed to other agents. More...
 
virtual void GatherMessages (SynMessageList &messages) override
 Generates messages to be sent to other nodes Will create or get messages and pass them into the referenced message vector. More...
 
virtual void GatherDescriptionMessages (SynMessageList &messages) override
 Get the description messages for this agent A single agent may have multiple description messages. More...
 
void SetZombieVisualizationFilesFromJSON (const std::string &filename)
 Set the zombie visualization files from a JSON specification file. More...
 
void SetZombieVisualizationFiles (std::string chassis_vis_file, std::string wheel_vis_file, std::string tire_vis_file)
 Set the zombie visualization files. More...
 
void SetNumWheels (int num_wheels)
 Set the number of wheels of the underlying vehicle. More...
 
virtual void SetID (SynAgentID aid) override
 Set the Agent ID. More...
 
- Public Member Functions inherited from chrono::synchrono::SynAgent
 SynAgent (SynAgentID aid=0)
 Construct a agent with the specified node_id. More...
 
virtual ~SynAgent ()
 Destructor.
 
virtual void ProcessMessage (std::shared_ptr< SynMessage > msg)
 Process an incoming message. More...
 
virtual void RegisterZombie (std::shared_ptr< SynAgent > zombie)
 Register a new zombie. More...
 
void SetProcessMessageCallback (std::function< void(std::shared_ptr< SynMessage >)> callback)
 
SynAgentID GetID ()
 

Protected Member Functions

std::shared_ptr< ChTriangleMeshShapeCreateMeshZombieComponent (const std::string &filename)
 Helper method used to create a ChTriangleMeshShape to be used on as a zombie body. More...
 
std::shared_ptr< ChBodyAuxRefCreateChassisZombieBody (const std::string &filename, ChSystem *system)
 Create a zombie chassis body. More...
 

Protected Attributes

chrono::vehicle::ChWheeledVehiclem_vehicle
 Pointer to the ChWheeledVehicle this class wraps.
 
std::shared_ptr< SynWheeledVehicleStateMessagem_state
 State of the vehicle (See SynWheeledVehicleMessage)
 
std::shared_ptr< SynWheeledVehicleDescriptionMessagem_description
 Description for zombie creation on discovery.
 
std::shared_ptr< ChBodyAuxRefm_zombie_body
 agent's zombie body reference
 
std::vector< std::shared_ptr< ChBodyAuxRef > > m_wheel_list
 vector of this agent's zombie wheels
 
- Protected Attributes inherited from chrono::synchrono::SynAgent
SynAgentID m_aid
 
std::function< void(std::shared_ptr< SynMessage >)> m_process_message_callback
 

Constructor & Destructor Documentation

◆ SynWheeledVehicleAgent()

chrono::synchrono::SynWheeledVehicleAgent::SynWheeledVehicleAgent ( chrono::vehicle::ChWheeledVehicle vehicle = nullptr,
const std::string &  filename = "" 
)

Construct a wheeled vehicle agent with optionally a vehicle.

Parameters
vehiclethe vehicle this agent is responsible for (will be null if agent's a zombie)
filenamejson specification file for zombie visualization (will query vehicle if not passed)

Member Function Documentation

◆ CreateChassisZombieBody()

std::shared_ptr< ChBodyAuxRef > chrono::synchrono::SynWheeledVehicleAgent::CreateChassisZombieBody ( const std::string &  filename,
ChSystem system 
)
protected

Create a zombie chassis body.

All ChVehicles have a chassis, so this can be defined here

Parameters
filenamethe filename that describes the ChTriangleMeshShape that should represent the chassis
systemthe system to add the body to

◆ CreateMeshZombieComponent()

std::shared_ptr< ChTriangleMeshShape > chrono::synchrono::SynWheeledVehicleAgent::CreateMeshZombieComponent ( const std::string &  filename)
protected

Helper method used to create a ChTriangleMeshShape to be used on as a zombie body.

Parameters
filenamethe file to generate a ChTriangleMeshShape from
Returns
std::shared_ptr<ChTriangleMeshShape>

◆ GatherDescriptionMessages()

virtual void chrono::synchrono::SynWheeledVehicleAgent::GatherDescriptionMessages ( SynMessageList &  messages)
inlineoverridevirtual

Get the description messages for this agent A single agent may have multiple description messages.

Parameters
messagesa referenced vector containing messages to be distributed from this rank

Implements chrono::synchrono::SynAgent.

◆ GatherMessages()

virtual void chrono::synchrono::SynWheeledVehicleAgent::GatherMessages ( SynMessageList &  messages)
inlineoverridevirtual

Generates messages to be sent to other nodes Will create or get messages and pass them into the referenced message vector.

Parameters
messagesa referenced vector containing messages to be distributed from this rank

Implements chrono::synchrono::SynAgent.

◆ InitializeZombie()

void chrono::synchrono::SynWheeledVehicleAgent::InitializeZombie ( ChSystem system)
overridevirtual

Initialize this agents zombie representation Bodies are added and represented in the lead agent's world.

Parameters
systemthe ChSystem used to initialize the zombie

Implements chrono::synchrono::SynAgent.

◆ SetID()

void chrono::synchrono::SynWheeledVehicleAgent::SetID ( SynAgentID  aid)
overridevirtual

Set the Agent ID.

Reimplemented from chrono::synchrono::SynAgent.

◆ SetNumWheels()

void chrono::synchrono::SynWheeledVehicleAgent::SetNumWheels ( int  num_wheels)
inline

Set the number of wheels of the underlying vehicle.

Parameters
num_wheelsnumber of wheels of the underlying vehicle

◆ SetZombieVisualizationFiles()

void chrono::synchrono::SynWheeledVehicleAgent::SetZombieVisualizationFiles ( std::string  chassis_vis_file,
std::string  wheel_vis_file,
std::string  tire_vis_file 
)
inline

Set the zombie visualization files.

Parameters
chassis_vis_filethe file used for chassis visualization
wheel_vis_filethe file used for wheel visualization
tire_vis_filethe file used for tire visualization

◆ SetZombieVisualizationFilesFromJSON()

void chrono::synchrono::SynWheeledVehicleAgent::SetZombieVisualizationFilesFromJSON ( const std::string &  filename)

Set the zombie visualization files from a JSON specification file.

Parameters
filenamethe json specification file

◆ SynchronizeZombie()

void chrono::synchrono::SynWheeledVehicleAgent::SynchronizeZombie ( std::shared_ptr< SynMessage message)
overridevirtual

Synchronize this agents zombie with the rest of the simulation.

Updates agent based on the passed message. Any message can be passed, so a check should be done to ensure this message was intended for this agent.

Parameters
messagethe message to process and is used to update the position of the zombie

Implements chrono::synchrono::SynAgent.

◆ Update()

void chrono::synchrono::SynWheeledVehicleAgent::Update ( )
overridevirtual

Update this agent Typically used to update the state representation of the agent to be distributed to other agents.

Implements chrono::synchrono::SynAgent.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_synchrono/agent/SynWheeledVehicleAgent.h
  • /builds/uwsbel/chrono/src/chrono_synchrono/agent/SynWheeledVehicleAgent.cpp