ARGoS  3
A parallel, multi-engine simulator for swarm robotics
argos::CSimulator Class Reference

The core class of ARGOS. More...

#include <simulator.h>

List of all members.

Public Member Functions

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

Static Public Member Functions

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

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

Class destructor.

Definition at line 44 of file simulator.cpp.


Member Function Documentation

Undoes whatever was done by Init().

Definition at line 195 of file simulator.cpp.

Executes the simulation loop.

Definition at line 251 of file simulator.cpp.

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

Definition at line 90 of file simulator.cpp.

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.

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.

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 269 of file simulator.h.

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 73 of file simulator.cpp.

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.

Returns the time limit on this experiment.

Returns:
The time limit on this experiment.

Definition at line 252 of file simulator.h.

Returns the list of currently existing media.

Returns:
The list of currently existing media.

Definition at line 149 of file simulator.h.

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.

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.

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 81 of file simulator.cpp.

Returns the list of currently existing physics engines.

Returns:
The list of currently existing physics engines.

Definition at line 119 of file simulator.h.

Returns a reference to the profiler.

Returns:
A reference to the profiler.

Definition at line 174 of file simulator.h.

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.

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.

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.

Returns a reference to the visualization.

Returns:
A reference to the visualization.

Definition at line 157 of file simulator.h.

Initializes the experiment.

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

Definition at line 114 of file simulator.cpp.

Returns true if the experiment has finished.

Internally it checks whether the time limit has been reached or the loop functions' IsExperimentFinished() method returned true.

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

Definition at line 278 of file simulator.cpp.

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.

Loads the XML configuration file.

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

Definition at line 101 of file simulator.cpp.

Resets the experiment.

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

Definition at line 159 of file simulator.cpp.

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 306 of file simulator.h.

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.

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.

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.

Performs an update step of the space.

Definition at line 258 of file simulator.cpp.


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