Description

Base class for SynChrono agents.

#include <SynAgent.h>

Inheritance diagram for chrono::synchrono::SynAgent:
Collaboration diagram for chrono::synchrono::SynAgent:

Public Member Functions

 SynAgent (unsigned int rank, SynAgentType type, ChSystem *system=nullptr)
 Construct a agent with the specified rank and type. More...
 
virtual ~SynAgent ()
 Destructor.
 
virtual void Advance (double time_of_next_sync)=0
 Advance the state of this agent until agent time syncs with passed time. More...
 
virtual void InitializeZombie (ChSystem *system=0)=0
 Initialize this agents zombie representation In order to be visualized, the lead agent on this rank should pass in a ChSystem. More...
 
virtual void SynchronizeZombie (SynMessage *message)=0
 Synchronoize this agents zombie with the rest of the simulation. More...
 
virtual std::shared_ptr< SynMessageStateGetState ()=0
 Get the state of this agent. More...
 
virtual std::shared_ptr< SynAgentMessageGetMessage ()=0
 Get the this agent's message to be pass to other ranks. More...
 
virtual void GenerateMessagesToSend (std::vector< SynMessage * > &messages)=0
 Generates messages to be sent to other ranks Will create or get messages and pass them into the referenced message vector. More...
 
virtual void ProcessMessage (SynMessage *msg)
 Process an incoming message. More...
 
void SetVisualizationManager (std::shared_ptr< SynVisualizationManager > vis_manager)
 Set the VisualizationManager for this agent.
 
std::shared_ptr< SynBrainGetBrain ()
 Get/Set this agent's brain.
 
void SetBrain (std::shared_ptr< SynBrain > brain)
 
unsigned int GetRank ()
 Get/Set this agent's rank.
 
void SetRank (unsigned int rank)
 
ChSystemGetSystem ()
 Get/Set the Chrono system associated with this agent.
 
void SetSystem (ChSystem *system)
 
double GetStepSize ()
 Get/Set this agent's step size.
 
void SetStepSize (double step_size)
 
SynAgentType GetType () const
 Get the type of this agent.
 

Static Public Member Functions

static rapidjson::Document ParseAgentFileJSON (const std::string &filename)
 Parse an agent json specification file. More...
 

Protected Attributes

unsigned int m_rank
 agent rank
 
SynAgentType m_type
 agent type
 
double m_step_size
 Step size of the underlying agent.
 
std::shared_ptr< SynBrainm_brain
 handle to this agent's brain
 
std::shared_ptr< SynVisualizationManagerm_vis_manager
 handle to this agent's visualization manager
 
ChSystemm_system
 pointer to the Chrono system
 

Constructor & Destructor Documentation

◆ SynAgent()

chrono::synchrono::SynAgent::SynAgent ( unsigned int  rank,
SynAgentType  type,
ChSystem system = nullptr 
)

Construct a agent with the specified rank and type.

Parameters
rankthe rank this agent is on
typethe type of the underlying agent
systemoptional argument to set the ChSystem of the agent through the constructor

Member Function Documentation

◆ Advance()

virtual void chrono::synchrono::SynAgent::Advance ( double  time_of_next_sync)
pure virtual

Advance the state of this agent until agent time syncs with passed time.

Parameters
time_of_next_synctime at which this agent should stop advancing

Implemented in chrono::synchrono::SynVehicleAgent, and chrono::synchrono::SynEnvironmentAgent.

◆ GenerateMessagesToSend()

virtual void chrono::synchrono::SynAgent::GenerateMessagesToSend ( std::vector< SynMessage * > &  messages)
pure virtual

Generates messages to be sent to other ranks 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

Implemented in chrono::synchrono::SynTrackedVehicleAgent, chrono::synchrono::SynWheeledVehicleAgent, and chrono::synchrono::SynEnvironmentAgent.

◆ GetMessage()

virtual std::shared_ptr<SynAgentMessage> chrono::synchrono::SynAgent::GetMessage ( )
pure virtual

Get the this agent's message to be pass to other ranks.

Returns
std::shared_ptr<SynMessageState>

Implemented in chrono::synchrono::SynTrackedVehicleAgent, chrono::synchrono::SynWheeledVehicleAgent, and chrono::synchrono::SynEnvironmentAgent.

◆ GetState()

virtual std::shared_ptr<SynMessageState> chrono::synchrono::SynAgent::GetState ( )
pure virtual

Get the state of this agent.

Returns
std::shared_ptr<SynMessageState>

Implemented in chrono::synchrono::SynTrackedVehicleAgent, chrono::synchrono::SynWheeledVehicleAgent, and chrono::synchrono::SynEnvironmentAgent.

◆ InitializeZombie()

virtual void chrono::synchrono::SynAgent::InitializeZombie ( ChSystem system = 0)
pure virtual

Initialize this agents zombie representation In order to be visualized, the lead agent on this rank should pass in a ChSystem.

With the passed system, bodies can be added and represented in the lead agent's world.

Parameters
systemthe ChSystem used to initialize the zombie

Implemented in chrono::synchrono::SynEnvironmentAgent, and chrono::synchrono::SynVehicleAgent.

◆ ParseAgentFileJSON()

Document chrono::synchrono::SynAgent::ParseAgentFileJSON ( const std::string &  filename)
static

Parse an agent json specification file.

Parameters
filenamethe json specification file
Returns
rapidjson::Document

◆ ProcessMessage()

virtual void chrono::synchrono::SynAgent::ProcessMessage ( SynMessage msg)
inlinevirtual

Process an incoming message.

Will pass the message directly to this agent's brain.

Parameters
msgthe received message to be processed

Reimplemented in chrono::synchrono::SynVehicleAgent.

◆ SynchronizeZombie()

virtual void chrono::synchrono::SynAgent::SynchronizeZombie ( SynMessage message)
pure virtual

Synchronoize 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

Implemented in chrono::synchrono::SynVehicleAgent, and chrono::synchrono::SynEnvironmentAgent.


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