Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a00433_source.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/a00433_source.php on line 2
The ARGoS Website

loop_functions.h
Go to the documentation of this file.
1 
9 #ifndef LOOP_FUNCTIONS_H
10 #define LOOP_FUNCTIONS_H
11 
12 namespace argos {
13  class CLoopFunctions;
14  class CFloorEntity;
15  class CPositionalEntity;
16  class CEmbodiedEntity;
17 }
18 
19 #include <argos3/core/utility/configuration/base_configurable_resource.h>
20 #include <argos3/core/simulator/simulator.h>
21 #include <argos3/core/simulator/space/space.h>
22 #include <argos3/core/utility/datatypes/color.h>
23 #include <argos3/core/utility/math/vector2.h>
24 #include <argos3/core/utility/math/vector3.h>
25 #include <argos3/core/utility/math/quaternion.h>
26 #include <argos3/core/simulator/physics_engine/physics_engine.h>
27 
28 namespace argos {
29 
69 
70  public:
71 
76  m_cSimulator(CSimulator::GetInstance()),
77  m_cSpace(m_cSimulator.GetSpace()) {
78  }
79 
83  virtual ~CLoopFunctions() {}
84 
92  virtual void Init(TConfigurationNode& t_tree) {}
93 
101  virtual void Reset() {}
102 
109  virtual void Destroy() {}
110 
117  virtual void PreStep() {}
118 
125  virtual void PostStep() {}
126 
136  virtual bool IsExperimentFinished() {
137  return false;
138  }
139 
149  virtual void PostExperiment() {
150  }
151 
163  virtual CColor GetFloorColor(const CVector2& c_pos_on_floor) {
164  return CColor::WHITE;
165  }
166 
172  return m_cSimulator;
173  }
174 
179  inline CSpace& GetSpace() {
180  return m_cSpace;
181  }
182 
189  virtual void MoveEntity(CPositionalEntity& c_entity,
190  const CVector3& c_position,
191  const CQuaternion& c_orientation);
192 
203  virtual bool MoveEntity(CEmbodiedEntity& c_entity,
204  const CVector3& c_position,
205  const CQuaternion& c_orientation,
206  bool b_check_only = false);
207 
216  virtual void AddEntity(CEntity& c_entity);
217 
223  virtual void RemoveEntity(const std::string& str_entity_id);
224 
229  virtual void RemoveEntity(CEntity& c_entity);
230 
231  private:
232 
234  CSimulator& m_cSimulator;
235 
237  CSpace& m_cSpace;
238 
239  };
240 }
241 
247 #define REGISTER_LOOP_FUNCTIONS(CLASSNAME, LABEL) \
248  REGISTER_SYMBOL(CLoopFunctions, \
249  CLASSNAME, \
250  LABEL, \
251  "undefined", \
252  "undefined", \
253  "undefined", \
254  "undefined", \
255  "undefined")
256 
257 #endif
A set of hook functions to customize an experimental run.
A 3D vector class.
Definition: vector3.h:29
static CColor WHITE
Definition: color.h:30
The basic entity type.
Definition: entity.h:89
virtual void MoveEntity(CPositionalEntity &c_entity, const CVector3 &c_position, const CQuaternion &c_orientation)
Moves the entity to the wanted position and orientation.
virtual void RemoveEntity(const std::string &str_entity_id)
Removes an entity from the simulation.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
This entity is a link to a body in the physics engine.
virtual void AddEntity(CEntity &c_entity)
Adds the passed entity to the simulation.
virtual void PostStep()
Executes user-defined logic right after a control step is executed.
A 2D vector class.
Definition: vector2.h:25
CSimulator & GetSimulator()
Returns the simulator instance.
virtual void Init(TConfigurationNode &t_tree)
Executes user-defined initialization logic.
virtual void Reset()
Executes user-defined reset logic.
virtual bool IsExperimentFinished()
Returns true if the experiment is finished.
CLoopFunctions()
Class constructor.
virtual ~CLoopFunctions()
Class destructor.
virtual void PreStep()
Executes user-defined logic right before a control step is executed.
The basic color type.
Definition: color.h:25
virtual void PostExperiment()
Executes user-defined logic when the experiment finishes.
virtual void Destroy()
Executes user-defined destruction logic.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
The core class of ARGOS.
Definition: simulator.h:62
This class is the base of all XML-configurable ARGoS interface.
virtual CColor GetFloorColor(const CVector2 &c_pos_on_floor)
Returns the color of the floor in the specified point.
CSpace & GetSpace()
Returns a reference to the space state.