36 #include <argos3/core/config.h>
37 #include <argos3/core/utility/math/rng.h>
38 #include <argos3/core/utility/configuration/argos_configuration.h>
39 #include <argos3/core/utility/datatypes/datatypes.h>
40 #include <argos3/core/simulator/physics_engine/physics_engine.h>
41 #include <argos3/core/simulator/medium/medium.h>
120 return m_vecPhysicsEngines;
128 template <
typename T>
130 CMedium::TMap::const_iterator it = m_mapMedia.find(str_id);
131 if(it != m_mapMedia.end()) {
132 T* pcMedium =
dynamic_cast<T*
>(it->second);
133 if(pcMedium != NULL) {
158 ARGOS_ASSERT(m_pcVisualization != NULL,
"No visualization specified in the XML file.");
159 return *m_pcVisualization;
167 return m_tConfigurationRoot;
175 return *m_pcProfiler;
183 return m_pcProfiler != NULL;
192 return m_unRandomSeed;
201 m_unRandomSeed = un_random_seed;
202 m_bWasRandomSeedSet =
true;
220 return m_strExperimentConfigFileName;
229 m_strExperimentConfigFileName = str_file_name;
237 return *m_pcLoopFunctions;
245 m_pcLoopFunctions = &c_loop_functions;
253 return m_unMaxSimulationClock;
269 return m_bRealTimeClock;
277 m_bRealTimeClock = b_real_time;
284 m_bTerminated =
true;
293 return ARGOS_INSTALL_PREFIX;
306 void Load(ticpp::Document& t_tree);
387 typedef std::map<std::string, TConfigurationNode*> TControllerConfigurationMap;
394 TControllerConfigurationMap m_mapControllerConfig;
434 std::string m_strExperimentConfigFileName;
439 UInt32 m_unMaxSimulationClock;
456 bool m_bWasRandomSeedSet;
461 ticpp::Document m_tConfiguration;
481 bool m_bHumanReadableProfile;
486 bool m_bRealTimeClock;
A set of hook functions to customize an experimental run.
void Terminate()
Puts an end to the simulation.
UInt32 GetMaxSimulationClock() const
Returns the time limit on this experiment.
CVisualization & GetVisualization()
Returns a reference to the visualization.
CPhysicsEngine::TVector & GetPhysicsEngines()
Returns the list of currently existing physics engines.
~CSimulator()
Class destructor.
std::vector< CMedium * > TVector
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
CLoopFunctions & GetLoopFunctions()
Returns a reference to the loop functions associated to the current experiment.
UInt32 GetNumThreads() const
Returns the number of threads used during the experiment.
CRandom::CRNG * GetRNG()
Returns the random generator of the "argos" category.
std::map< std::string, CPhysicsEngine *, std::less< std::string > > TMap
bool IsExperimentFinished() const
Returns true if the experiment has finished.
void SetRandomSeed(UInt32 un_random_seed)
Sets the random seed of the "argos" category of the random seed.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
CPhysicsEngine & GetPhysicsEngine(const std::string &str_id) const
Returns a reference to a physics engine.
void UpdateSpace()
Performs an update step of the space.
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
std::vector< CPhysicsEngine * > TVector
unsigned int UInt32
32-bit unsigned integer.
void LoadExperiment()
Loads the XML configuration file.
TConfigurationNode & GetConfigurationRoot()
Returns a reference to the root node of the parsed XML configuration file.
void Execute()
Executes the simulation loop.
void Reset()
Resets the experiment.
void Destroy()
Undoes whatever was done by Init().
CMedium::TVector & GetMedia()
Returns the list of currently existing media.
void Load(ticpp::Document &t_tree)
Loads an already-parsed XML configuration tree.
UInt32 GetRandomSeed() const
Returns the random seed of the "argos" category of the random seed.
CProfiler & GetProfiler()
Returns a reference to the profiler.
void SetRealTimeClock(bool b_real_time)
When passed true, the clock tick follows the real time.
T & GetMedium(const std::string &str_id)
Returns a reference to a medium.
void SetLoopFunctions(CLoopFunctions &c_loop_functions)
Asociates loop functions to the current experiment.
bool IsProfiling() const
Returns true if ARGoS is being profiled.
std::map< std::string, CMedium * > TMap
const std::string & GetExperimentFileName() const
Returns the name of the XML configuration file parsed by Load().
std::string GetInstallationDirectory() const
Returns the base directory in which the ARGoS core was installed.
The namespace containing all the ARGoS related code.
void Reset(UInt32 un_new_random_seed)
Resets the experiment.
void SetExperimentFileName(const std::string &str_file_name)
Sets the name of the XML configuration file parsed by Load().
void Init()
Initializes the experiment.
static CSimulator & GetInstance()
Returns the instance to the CSimulator class.
TConfigurationNode & GetConfigForController(const std::string &str_id)
Returns the XML portion relative to the controller with the given ID.
bool IsRealTimeClock() const
Returns true if the clock tick follows the real time.
CSpace & GetSpace() const
Returns a reference to the simulated space.