Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a02168.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a02168.php on line 2
The ARGoS Website

The core class of ARGOS. More...

#include <simulator.h>

Public Member Functions

 ~CSimulator ()
 Class destructor. More...
 
CSpaceGetSpace () const
 Returns a reference to the simulated space. More...
 
CPhysicsEngineGetPhysicsEngine (const std::string &str_id) const
 Returns a reference to a physics engine. More...
 
CPhysicsEngine::TVectorGetPhysicsEngines ()
 Returns the list of currently existing physics engines. More...
 
template<typename T >
T & GetMedium (const std::string &str_id)
 Returns a reference to a medium. More...
 
CMedium::TVectorGetMedia ()
 Returns the list of currently existing media. More...
 
CVisualizationGetVisualization ()
 Returns a reference to the visualization. More...
 
TConfigurationNodeGetConfigurationRoot ()
 Returns a reference to the root node of the parsed XML configuration file. More...
 
CProfilerGetProfiler ()
 Returns a reference to the profiler. More...
 
bool IsProfiling () const
 Returns true if ARGoS is being profiled. More...
 
UInt32 GetRandomSeed () const
 Returns the random seed of the "argos" category of the random seed. More...
 
void SetRandomSeed (UInt32 un_random_seed)
 Sets the random seed of the "argos" category of the random seed. More...
 
CRandom::CRNGGetRNG ()
 Returns the random generator of the "argos" category. More...
 
const std::string & GetExperimentFileName () const
 Returns the name of the XML configuration file parsed by Load(). More...
 
void SetExperimentFileName (const std::string &str_file_name)
 Sets the name of the XML configuration file parsed by Load(). More...
 
CLoopFunctionsGetLoopFunctions ()
 Returns a reference to the loop functions associated to the current experiment. More...
 
void SetLoopFunctions (CLoopFunctions &c_loop_functions)
 Asociates loop functions to the current experiment. More...
 
UInt32 GetMaxSimulationClock () const
 Returns the time limit on this experiment. More...
 
UInt32 GetNumThreads () const
 Returns the number of threads used during the experiment. More...
 
bool IsRealTimeClock () const
 Returns true if the clock tick follows the real time. More...
 
void SetRealTimeClock (bool b_real_time)
 When passed true, the clock tick follows the real time. More...
 
void Terminate ()
 Puts an end to the simulation. More...
 
std::string GetInstallationDirectory () const
 Returns the base directory in which the ARGoS core was installed. More...
 
TConfigurationNodeGetConfigForController (const std::string &str_id)
 Returns the XML portion relative to the controller with the given ID. More...
 
void Load (ticpp::Document &t_tree)
 Loads an already-parsed XML configuration tree. More...
 
void LoadExperiment ()
 Loads the XML configuration file. More...
 
void Init ()
 Initializes the experiment. More...
 
void Reset ()
 Resets the experiment. More...
 
void Reset (UInt32 un_new_random_seed)
 Resets the experiment. More...
 
void Destroy ()
 Undoes whatever was done by Init(). More...
 
void Execute ()
 Executes the simulation loop. More...
 
void UpdateSpace ()
 Performs an update step of the space. More...
 
bool IsExperimentFinished () const
 Returns true if the experiment has finished. More...
 

Static Public Member Functions

static CSimulatorGetInstance ()
 Returns the instance to the CSimulator class. More...
 

Detailed Description

The core class of ARGOS.

Class CSimulator is the core class of ARGOS. CSimulator organises the flow of data coming from the modules of ARGoS and provides the main simulation loop.

Definition at line 62 of file simulator.h.

Constructor & Destructor Documentation

◆ ~CSimulator()

argos::CSimulator::~CSimulator ( )

Class destructor.

Definition at line 47 of file simulator.cpp.

Member Function Documentation

◆ Destroy()

void argos::CSimulator::Destroy ( )

Undoes whatever was done by Init().

Definition at line 217 of file simulator.cpp.

◆ Execute()

void argos::CSimulator::Execute ( )

Executes the simulation loop.

Definition at line 273 of file simulator.cpp.

◆ GetConfigForController()

TConfigurationNode & argos::CSimulator::GetConfigForController ( const std::string &  str_id)

Returns the XML portion relative to the controller with the given ID.

Definition at line 95 of file simulator.cpp.

◆ GetConfigurationRoot()

TConfigurationNode& argos::CSimulator::GetConfigurationRoot ( )
inline

Returns a reference to the root node of the parsed XML configuration file.

Returns
A reference to the root node of the parsed XML configuration file.

Definition at line 166 of file simulator.h.

◆ GetExperimentFileName()

const std::string& argos::CSimulator::GetExperimentFileName ( ) const
inline

Returns the name of the XML configuration file parsed by Load().

Returns
The name of the XML configuration file parsed by Load().
See also
Load

Definition at line 219 of file simulator.h.

◆ GetInstallationDirectory()

std::string argos::CSimulator::GetInstallationDirectory ( ) const
inline

Returns the base directory in which the ARGoS core was installed.

Usually it is /usr or /usr/local.

Returns
The directory in which the ARGoS core was installed.

Definition at line 292 of file simulator.h.

◆ GetInstance()

CSimulator & argos::CSimulator::GetInstance ( )
static

Returns the instance to the CSimulator class.

Since CSimulator is a singleton, the instance is created at the first call of this function and returned thereafter.

Returns
The instance to the CSimulator class.

Definition at line 78 of file simulator.cpp.

◆ GetLoopFunctions()

CLoopFunctions& argos::CSimulator::GetLoopFunctions ( )
inline

Returns a reference to the loop functions associated to the current experiment.

Returns
A reference to the loop functions associated to the current experiment.

Definition at line 236 of file simulator.h.

◆ GetMaxSimulationClock()

UInt32 argos::CSimulator::GetMaxSimulationClock ( ) const
inline

Returns the time limit on this experiment.

Returns
The time limit on this experiment.

Definition at line 252 of file simulator.h.

◆ GetMedia()

CMedium::TVector& argos::CSimulator::GetMedia ( )
inline

Returns the list of currently existing media.

Returns
The list of currently existing media.

Definition at line 149 of file simulator.h.

◆ GetMedium()

template<typename T >
T& argos::CSimulator::GetMedium ( const std::string &  str_id)
inline

Returns a reference to a medium.

Parameters
str_idThe id of the wanted medium.
Returns
A reference to the wanted medium.

Definition at line 129 of file simulator.h.

◆ GetNumThreads()

UInt32 argos::CSimulator::GetNumThreads ( ) const
inline

Returns the number of threads used during the experiment.

Returns
The number of threads used during the experiment.

Definition at line 260 of file simulator.h.

◆ GetPhysicsEngine()

CPhysicsEngine & argos::CSimulator::GetPhysicsEngine ( const std::string &  str_id) const

Returns a reference to a physics engine.

Parameters
str_idThe id of the wanted physics engine.
Returns
A reference to the wanted physics engine.

Definition at line 86 of file simulator.cpp.

◆ GetPhysicsEngines()

CPhysicsEngine::TVector& argos::CSimulator::GetPhysicsEngines ( )
inline

Returns the list of currently existing physics engines.

Returns
The list of currently existing physics engines.

Definition at line 119 of file simulator.h.

◆ GetProfiler()

CProfiler& argos::CSimulator::GetProfiler ( )
inline

Returns a reference to the profiler.

Returns
A reference to the profiler.

Definition at line 174 of file simulator.h.

◆ GetRandomSeed()

UInt32 argos::CSimulator::GetRandomSeed ( ) const
inline

Returns the random seed of the "argos" category of the random seed.

Returns
the random seed of the "argos" category of the random seed.
See also
CRandom

Definition at line 191 of file simulator.h.

◆ GetRNG()

CRandom::CRNG* argos::CSimulator::GetRNG ( )
inline

Returns the random generator of the "argos" category.

Returns
the random generator of the "argos" category.
See also
CRandom

Definition at line 210 of file simulator.h.

◆ GetSpace()

CSpace& argos::CSimulator::GetSpace ( ) const
inline

Returns a reference to the simulated space.

Returns
A reference to the simulated space.

Definition at line 104 of file simulator.h.

◆ GetVisualization()

CVisualization& argos::CSimulator::GetVisualization ( )
inline

Returns a reference to the visualization.

Returns
A reference to the visualization.

Definition at line 157 of file simulator.h.

◆ Init()

void argos::CSimulator::Init ( )

Initializes the experiment.

It works on the assumption that method LoadExperiment() has been called already.

Definition at line 132 of file simulator.cpp.

◆ IsExperimentFinished()

bool argos::CSimulator::IsExperimentFinished ( ) const

Returns true if the experiment has finished.

The experiment is considered finished when at least one of these conditions holds true:

Returns
true if the experiment has finished.
See also
GetMaxSimulationClock()
Terminate()
CLoopFunctions::IsExperimentFinished()

Definition at line 288 of file simulator.cpp.

◆ IsProfiling()

bool argos::CSimulator::IsProfiling ( ) const
inline

Returns true if ARGoS is being profiled.

Returns
true if ARGoS is being profiled.

Definition at line 182 of file simulator.h.

◆ IsRealTimeClock()

bool argos::CSimulator::IsRealTimeClock ( ) const
inline

Returns true if the clock tick follows the real time.

By default, this flag is false.

Definition at line 268 of file simulator.h.

◆ Load()

void argos::CSimulator::Load ( ticpp::Document &  t_tree)

Loads an already-parsed XML configuration tree.

The tree should have the same structure as an ARGoS file. The variable m_tConfigurationRoot is set here.

Definition at line 106 of file simulator.cpp.

◆ LoadExperiment()

void argos::CSimulator::LoadExperiment ( )

Loads the XML configuration file.

The XML configuration file is parsed by this function. The variable m_tConfigurationRoot is set here.

Definition at line 119 of file simulator.cpp.

◆ Reset() [1/2]

void argos::CSimulator::Reset ( )

Resets the experiment.

Restores the state of the experiment right after Init() and before any step is executed.

Definition at line 179 of file simulator.cpp.

◆ Reset() [2/2]

void argos::CSimulator::Reset ( UInt32  un_new_random_seed)
inline

Resets the experiment.

Restores the state of the experiment right after Init() and before any step is executed. This variant changes the random seed to allow for resetting the experiment to a different state. This method is useful, for instance, when embedding ARGoS in an optimization algorithm, and multiple, different runs of an experiment must be executed. This method is faster than destroying and recreating the experiment with a different seed, but it is functionally equivalent.

Parameters
un_new_random_seedThe new random seed.

Definition at line 337 of file simulator.h.

◆ SetExperimentFileName()

void argos::CSimulator::SetExperimentFileName ( const std::string &  str_file_name)
inline

Sets the name of the XML configuration file parsed by Load().

Parameters
str_file_nameThe name of the XML configuration file parsed by Load().
See also
Load

Definition at line 228 of file simulator.h.

◆ SetLoopFunctions()

void argos::CSimulator::SetLoopFunctions ( CLoopFunctions c_loop_functions)
inline

Asociates loop functions to the current experiment.

Parameters
c_loop_functionsA reference to the loop functions to associate to the current experiment.

Definition at line 244 of file simulator.h.

◆ SetRandomSeed()

void argos::CSimulator::SetRandomSeed ( UInt32  un_random_seed)
inline

Sets the random seed of the "argos" category of the random seed.

Parameters
un_random_seedsets random seed of the "argos" category of the random seed.
See also
CRandom

Definition at line 200 of file simulator.h.

◆ SetRealTimeClock()

void argos::CSimulator::SetRealTimeClock ( bool  b_real_time)
inline

When passed true, the clock tick follows the real time.

Parameters
b_real_timetrue to make the clock tick follow the real time; false otherwise.

Definition at line 276 of file simulator.h.

◆ Terminate()

void argos::CSimulator::Terminate ( )
inline

Puts an end to the simulation.

Definition at line 283 of file simulator.h.

◆ UpdateSpace()

void argos::CSimulator::UpdateSpace ( )

Performs an update step of the space.

Definition at line 280 of file simulator.cpp.