ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
#include <physics_engine.h>
Public Types | |
typedef std::vector < CPhysicsEngine * > | TVector |
typedef std::map< std::string, CPhysicsEngine *, std::less < std::string > > | TMap |
Public Member Functions | |
CPhysicsEngine () | |
virtual | ~CPhysicsEngine () |
virtual void | Init (TConfigurationNode &t_tree) |
Initializes the resource. | |
virtual void | Reset () |
Resets the resource. | |
virtual void | Destroy () |
Undoes whatever was done by Init(). | |
virtual void | Update ()=0 |
virtual bool | IsPointContained (const CVector3 &c_point)=0 |
virtual UInt32 | GetNumPhysicsEngineEntities ()=0 |
virtual void | AddEntity (CEntity &c_entity)=0 |
Adds an entity to the physics engine. | |
virtual void | RemoveEntity (CEntity &c_entity)=0 |
Removes an entity from the physics engine. | |
virtual bool | IsEntityTransferNeeded () const =0 |
Returns true if this engine has entities that must be transferred to another engine. | |
virtual void | TransferEntities ()=0 |
Executes the transfer of entities to other engines. | |
virtual CEmbodiedEntity * | CheckIntersectionWithRay (Real &f_t_on_ray, const CRay3 &c_ray) const =0 |
Check whether an object in this engine intersects the given ray. | |
UInt32 | GetIterations () const |
Returns the number of iterations per simulation clock tick. | |
Real | GetPhysicsClockTick () const |
Returns the length of the physics engine tick. | |
const std::string & | GetId () const |
Returns the id of this physics engine. | |
void | SetId (const std::string &str_id) |
Sets the id of this physics engine. | |
Static Public Member Functions | |
static Real | GetSimulationClockTick () |
Returns the simulation clock tick. | |
static Real | GetInverseSimulationClockTick () |
Returns the inverse of GetSimulationClockTick(). | |
static void | SetSimulationClockTick (Real f_simulation_clock_tick) |
Sets the simulation clock tick. |
Definition at line 28 of file physics_engine.h.
typedef std::map<std::string, CPhysicsEngine*, std::less<std::string> > argos::CPhysicsEngine::TMap |
Definition at line 33 of file physics_engine.h.
typedef std::vector<CPhysicsEngine*> argos::CPhysicsEngine::TVector |
Definition at line 32 of file physics_engine.h.
Definition at line 22 of file physics_engine.cpp.
virtual argos::CPhysicsEngine::~CPhysicsEngine | ( | ) | [inline, virtual] |
Definition at line 38 of file physics_engine.h.
virtual void argos::CPhysicsEngine::AddEntity | ( | CEntity & | c_entity | ) | [pure virtual] |
Adds an entity to the physics engine.
Important: when you implement this function, you must also take care of adding the physics model to the associated embodied entity.
Implemented in argos::CDynamics2DEngine.
virtual CEmbodiedEntity* argos::CPhysicsEngine::CheckIntersectionWithRay | ( | Real & | f_t_on_ray, |
const CRay3 & | c_ray | ||
) | const [pure virtual] |
Check whether an object in this engine intersects the given ray.
f_t_on_ray | In the parametric definition of ray = starting_point + t * direction, this parameter is t. A value between 0 and 1 means that the intersection point lies within the given ray; values outside this range mean that the intersection point is outside the ray extrema. |
c_ray | The test ray. |
NULL
if no intersection occurred. Implemented in argos::CDynamics2DEngine.
virtual void argos::CPhysicsEngine::Destroy | ( | ) | [inline, virtual] |
Undoes whatever was done by Init().
Implements argos::CBaseConfigurableResource.
Reimplemented in argos::CDynamics2DEngine.
Definition at line 42 of file physics_engine.h.
const std::string& argos::CPhysicsEngine::GetId | ( | ) | const [inline] |
Returns the id of this physics engine.
Definition at line 137 of file physics_engine.h.
Real argos::CPhysicsEngine::GetInverseSimulationClockTick | ( | ) | [static] |
Returns the inverse of GetSimulationClockTick().
Definition at line 59 of file physics_engine.cpp.
UInt32 argos::CPhysicsEngine::GetIterations | ( | ) | const [inline] |
Returns the number of iterations per simulation clock tick.
Physics engines can perform multiple updates for each simulation clock tick, to increase the accuracy of the simulation. This value is set to 1 by default. You can set a different value using the iterations
attribute available for every physics engine tag.
Definition at line 119 of file physics_engine.h.
virtual UInt32 argos::CPhysicsEngine::GetNumPhysicsEngineEntities | ( | ) | [pure virtual] |
Implemented in argos::CDynamics2DEngine.
Real argos::CPhysicsEngine::GetPhysicsClockTick | ( | ) | const [inline] |
Returns the length of the physics engine tick.
This value is calculated as GetSimulationClockTick() / static_cast<Real>(GetIterations()).
Definition at line 129 of file physics_engine.h.
Real argos::CPhysicsEngine::GetSimulationClockTick | ( | ) | [static] |
Returns the simulation clock tick.
The clock tick is the time elapsed between two control steps in a simulation. This value is set in the XML file through the 'ticks_per_second' attribute of the <experiment>
tag.
Definition at line 52 of file physics_engine.cpp.
void argos::CPhysicsEngine::Init | ( | TConfigurationNode & | t_tree | ) | [virtual] |
Initializes the resource.
t_tree | the base of the XML configuration tree to parse |
CARGoSException | if an error occurs |
Implements argos::CBaseConfigurableResource.
Reimplemented in argos::CDynamics2DEngine.
Definition at line 29 of file physics_engine.cpp.
virtual bool argos::CPhysicsEngine::IsEntityTransferNeeded | ( | ) | const [pure virtual] |
Returns true
if this engine has entities that must be transferred to another engine.
Implemented in argos::CDynamics2DEngine.
virtual bool argos::CPhysicsEngine::IsPointContained | ( | const CVector3 & | c_point | ) | [pure virtual] |
Implemented in argos::CDynamics2DEngine.
virtual void argos::CPhysicsEngine::RemoveEntity | ( | CEntity & | c_entity | ) | [pure virtual] |
Removes an entity from the physics engine.
Important: when you implement this function, you must also take care of removing the physics model to the associated embodied entity.
Implemented in argos::CDynamics2DEngine.
virtual void argos::CPhysicsEngine::Reset | ( | ) | [inline, virtual] |
Resets the resource.
Implements argos::CBaseConfigurableResource.
Reimplemented in argos::CDynamics2DEngine.
Definition at line 41 of file physics_engine.h.
void argos::CPhysicsEngine::SetId | ( | const std::string & | str_id | ) | [inline] |
Sets the id of this physics engine.
str_id | The wanted id. |
Definition at line 145 of file physics_engine.h.
void argos::CPhysicsEngine::SetSimulationClockTick | ( | Real | f_simulation_clock_tick | ) | [static] |
Sets the simulation clock tick.
The clock tick is the time elapsed between two control steps in a simulation. This value is set in the XML file through the ticks_per_second
attribute of the <experiment>
tag. You should never use this method in your code.
f_simulation_clock_tick | The new simulation clock tick. |
Definition at line 66 of file physics_engine.cpp.
virtual void argos::CPhysicsEngine::TransferEntities | ( | ) | [pure virtual] |
Executes the transfer of entities to other engines.
Implemented in argos::CDynamics2DEngine.
virtual void argos::CPhysicsEngine::Update | ( | ) | [pure virtual] |
Implemented in argos::CDynamics2DEngine.