ARGoS  3
A parallel, multi-engine simulator for swarm robotics
argos::CPhysicsEngine Class Reference

#include <physics_engine.h>

+ Inheritance diagram for argos::CPhysicsEngine:

List of all members.

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 CEmbodiedEntityCheckIntersectionWithRay (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.

Detailed Description

Definition at line 28 of file physics_engine.h.


Member Typedef Documentation

typedef std::map<std::string, CPhysicsEngine*, std::less<std::string> > argos::CPhysicsEngine::TMap

Definition at line 33 of file physics_engine.h.

Definition at line 32 of file physics_engine.h.


Constructor & Destructor Documentation

virtual argos::CPhysicsEngine::~CPhysicsEngine ( ) [inline, virtual]

Definition at line 38 of file physics_engine.h.


Member Function Documentation

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.

Parameters:
f_t_on_rayIn 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_rayThe test ray.
Returns:
A pointer to the embodied entity intersecting the ray, or 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.

Returns:
The id of this physics engine.

Definition at line 137 of file physics_engine.h.

Returns the inverse of GetSimulationClockTick().

Returns:
The inverse of GetSimulationClockTick().

Definition at line 59 of file physics_engine.cpp.

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.

See also:
GetPhysicsClockTick()

Definition at line 119 of file physics_engine.h.

Returns the length of the physics engine tick.

This value is calculated as GetSimulationClockTick() / static_cast<Real>(GetIterations()).

See also:
GetIterations()

Definition at line 129 of file physics_engine.h.

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.

Returns:
The simulation clock tick.

Definition at line 52 of file physics_engine.cpp.

void argos::CPhysicsEngine::Init ( TConfigurationNode t_tree) [virtual]

Initializes the resource.

Parameters:
t_treethe base of the XML configuration tree to parse
Exceptions:
CARGoSExceptionif 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.

Parameters:
str_idThe 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.

Parameters:
f_simulation_clock_tickThe 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.


The documentation for this class was generated from the following files: