Description

Agent wrapper of a copter model, sends out SynCopterMessage-s to synchronize its state.

#include <SynCopterAgent.h>

Inheritance diagram for chrono::synchrono::SynCopterAgent:
Collaboration diagram for chrono::synchrono::SynCopterAgent:

Public Member Functions

 SynCopterAgent (chrono::copter::Copter< 6 > *copter=nullptr)
 Construct a copter agent with an optional copter object. More...
 
virtual ~SynCopterAgent ()
 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 SetZombieVisualizationFiles (std::string chassis_vis_file, std::string propeller_vis_file)
 Set the zombie visualization files. More...
 
void SetNumProps (int num_props)
 Set the number of propellers of the underlying copter. 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 () const
 

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< ChBodyCreateChassisZombieBody (const std::string &filename, ChSystem *system)
 Create a zombie chassis body. More...
 

Protected Attributes

chrono::copter::Copter< 6 > * m_copter
 Pointer to the ChCopter this class wraps.
 
std::shared_ptr< SynCopterStateMessagem_state
 State of the copter (See SynCopterMessage)
 
std::shared_ptr< SynCopterDescriptionMessagem_description
 Description for zombie creation on discovery.
 
std::shared_ptr< ChBodym_zombie_body
 agent's zombie body
 
std::vector< std::shared_ptr< ChBody > > m_prop_list
 vector of this agent's zombie propellers
 
- Protected Attributes inherited from chrono::synchrono::SynAgent
SynAgentID m_aid
 
std::function< void(std::shared_ptr< SynMessage >)> m_process_message_callback
 

Constructor & Destructor Documentation

◆ SynCopterAgent()

chrono::synchrono::SynCopterAgent::SynCopterAgent ( chrono::copter::Copter< 6 > *  copter = nullptr)

Construct a copter agent with an optional copter object.

Parameters
copterthe copter this agent is responsible for (will be null if the agent is a zombie)

Member Function Documentation

◆ CreateChassisZombieBody()

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

Create a zombie chassis body.

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::SynCopterAgent::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::SynCopterAgent::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::SynCopterAgent::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::SynCopterAgent::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::SynCopterAgent::SetID ( SynAgentID  aid)
overridevirtual

Set the Agent ID.

Reimplemented from chrono::synchrono::SynAgent.

◆ SetNumProps()

void chrono::synchrono::SynCopterAgent::SetNumProps ( int  num_props)
inline

Set the number of propellers of the underlying copter.

Parameters
num_propsnumber of propellers of the underlying copter

◆ SetZombieVisualizationFiles()

void chrono::synchrono::SynCopterAgent::SetZombieVisualizationFiles ( std::string  chassis_vis_file,
std::string  propeller_vis_file 
)
inline

Set the zombie visualization files.

Parameters
chassis_vis_filethe file used for chassis visualization
propeller_vis_filethe file used for propeller visualization

◆ SynchronizeZombie()

void chrono::synchrono::SynCopterAgent::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::SynCopterAgent::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/SynCopterAgent.h
  • /builds/uwsbel/chrono/src/chrono_synchrono/agent/SynCopterAgent.cpp