ARGoS  3
A parallel, multi-engine simulator for swarm robotics
core/simulator/loop_functions.h
Go to the documentation of this file.
00001 
00009 #ifndef LOOP_FUNCTIONS_H
00010 #define LOOP_FUNCTIONS_H
00011 
00012 namespace argos {
00013    class CLoopFunctions;
00014    class CFloorEntity;
00015 }
00016 
00017 #include <argos3/core/utility/configuration/base_configurable_resource.h>
00018 #include <argos3/core/simulator/simulator.h>
00019 #include <argos3/core/simulator/space/space.h>
00020 #include <argos3/core/utility/datatypes/color.h>
00021 #include <argos3/core/utility/math/vector2.h>
00022 #include <argos3/core/utility/math/vector3.h>
00023 #include <argos3/core/utility/math/quaternion.h>
00024 #include <argos3/core/simulator/physics_engine/physics_engine.h>
00025 
00026 namespace argos {
00027 
00066    class CLoopFunctions : public CBaseConfigurableResource {
00067 
00068    public:
00069 
00073       CLoopFunctions() :
00074          m_cSimulator(CSimulator::GetInstance()),
00075          m_cSpace(m_cSimulator.GetSpace()) {
00076       }
00077 
00081       virtual ~CLoopFunctions() {}
00082 
00090       virtual void Init(TConfigurationNode& t_tree) {}
00091 
00099       virtual void Reset() {}
00100 
00107       virtual void Destroy() {}
00108 
00114       virtual void PreStep() {}
00115 
00121       virtual void PostStep() {}
00122 
00132       virtual bool IsExperimentFinished() {
00133          return false;
00134       }
00135 
00147       virtual CColor GetFloorColor(const CVector2& c_pos_on_floor) {
00148          return CColor::BLACK;
00149       }
00150 
00155       inline CSimulator& GetSimulator() {
00156          return m_cSimulator;
00157       }
00158 
00163       inline CSpace& GetSpace() {
00164          return m_cSpace;
00165       }
00166 
00178       bool MoveEntity(CPositionalEntity& c_entity,
00179                       const CVector3& c_position,
00180                       const CQuaternion& c_orientation,
00181                       bool b_check_only);
00182 
00191       void AddEntity(CEntity& c_entity);
00192 
00198       void RemoveEntity(const std::string& str_entity_id);
00199 
00204       void RemoveEntity(CEntity& c_entity);
00205 
00206    private:
00207 
00209       CSimulator& m_cSimulator;
00210 
00212       CSpace& m_cSpace;
00213 
00214    };
00215 }
00216 
00222 #define REGISTER_LOOP_FUNCTIONS(CLASSNAME, LABEL) \
00223    REGISTER_SYMBOL(CLoopFunctions,                \
00224                    CLASSNAME,                     \
00225                    LABEL,                         \
00226                    "undefined",                   \
00227                    "undefined",                   \
00228                    "undefined",                   \
00229                    "undefined",                   \
00230                    "undefined")
00231 
00232 #endif