ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
Go to the documentation of this file.
7 #ifndef PHYSICS_ENGINE_H
8 #define PHYSICS_ENGINE_H
14 class CEmbodiedEntity;
20 #include <argos3/core/utility/logging/argos_log.h>
21 #include <argos3/core/utility/math/ray2.h>
22 #include <argos3/core/utility/configuration/base_configurable_resource.h>
23 #include <argos3/core/utility/configuration/argos_configuration.h>
24 #include <argos3/core/utility/datatypes/datatypes.h>
25 #include <argos3/core/utility/plugins/factory.h>
131 typedef std::map<std::string, CPhysicsEngine*, std::less<std::string> >
TMap;
142 virtual void Update() = 0;
186 return !m_vecTransferData.empty();
228 const CRay3& c_ray)
const = 0;
267 return m_unIterations;
277 return m_fPhysicsClockTick;
284 inline const std::string&
GetId()
const {
292 void SetId(
const std::string& str_id) {
302 Real m_fPhysicsClockTick;
308 static Real m_fSimulationClockTick;
311 static Real m_fInverseSimulationClockTick;
317 std::vector<CEmbodiedEntity*> m_vecTransferData;
322 #define REGISTER_PHYSICS_ENGINE(CLASSNAME, \
329 REGISTER_SYMBOL(CPhysicsEngine, \
This class is the base of all XML-configurable ARGoS interface.
const std::string & GetId() const
Returns the id of this physics engine.
virtual void TransferEntities()
Executes the transfer of entities to other engines.
The namespace containing all the ARGoS related code.
static void SetSimulationClockTick(Real f_simulation_clock_tick)
Sets the simulation clock tick.
virtual bool AddEntity(CEntity &c_entity)=0
Adds an entity to the physics engine.
std::vector< SVerticalFace * > SideFaces
UInt32 GetIterations() const
Returns the number of iterations per simulation clock tick.
SEmbodiedEntityIntersectionItem(CEmbodiedEntity *pc_entity, Real f_t_on_ray)
virtual void Reset()
Resets the resource.
virtual size_t GetNumPhysicsModels()=0
bool IsEntityTransferNeeded() const
Returns true if this engine has entities that must be transferred to another engine.
This entity is a link to a body in the physics engine.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
A boundary face for entity transfer among physics engines.
bool operator<(const SEmbodiedEntityIntersectionItem &s_item)
bool GetClosestEmbodiedEntityIntersectedByRay(SEmbodiedEntityIntersectionItem &s_item, const CRay3 &c_ray)
Returns the closest intersection with an embodied entity to the ray start.
virtual void CheckIntersectionWithRay(TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray) const =0
Check which objects in this engine intersect the given ray.
virtual bool RemoveEntity(CEntity &c_entity)=0
Removes an entity from the physics engine.
bool GetEmbodiedEntitiesIntersectedByRay(TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray)
Checks whether the given ray intersects any entity.
SEmbodiedEntityIntersectionItem(const SEmbodiedEntityIntersectionItem &s_item)
SEmbodiedEntityIntersectionItem()
CEmbodiedEntity * IntersectedEntity
virtual void ScheduleEntityForTransfer(CEmbodiedEntity &c_entity)
Schedules an entity of transfer.
void Init(TConfigurationNode &t_node)
A boundary face for side parts of the volume.
bool IsEntityTransferActive() const
Returns true if entity transfer is active for this engine.
Real GetPhysicsClockTick() const
Returns the length of the physics engine tick.
SVolume & GetVolume()
Returns the boundary faces for the volume associated to this engine.
SHorizontalFace * TopFace
SHorizontalFace * BottomFace
unsigned int UInt32
32-bit unsigned integer.
virtual void Destroy()
Undoes whatever was done by Init().
virtual bool IsPointContained(const CVector3 &c_point)
Returns true if the given point is contained in this physics engine.
static Real GetSimulationClockTick()
Returns the simulation clock tick.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
A boundary face for top/bottom parts of the volume.
virtual void PostSpaceInit()
Executes extra initialization activities after the space has been initialized.
std::vector< CPhysicsEngine * > TVector
static Real GetInverseSimulationClockTick()
Returns the inverse of GetSimulationClockTick().
void SetId(const std::string &str_id)
Sets the id of this physics engine.
std::vector< SEmbodiedEntityIntersectionItem > TEmbodiedEntityIntersectionData
const SVolume & GetVolume() const
Returns the boundary faces for the volume associated to this engine.
virtual ~CPhysicsEngine()
float Real
Collects all ARGoS code.
std::map< std::string, CPhysicsEngine *, std::less< std::string > > TMap