#include <physics_engine.h>

Inheritance diagram for argos::CPhysicsEngine:
Collaboration diagram for argos::CPhysicsEngine:

Classes

struct  SBoundaryFace
 A boundary face for entity transfer among physics engines. More...
 
struct  SHorizontalFace
 A boundary face for top/bottom parts of the volume. More...
 
struct  SVerticalFace
 A boundary face for side parts of the volume. More...
 
struct  SVolume
 The volume boundaries. More...
 

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. More...
 
virtual void Reset ()
 Resets the resource. More...
 
virtual void Destroy ()
 Undoes whatever was done by Init(). More...
 
virtual void Update ()=0
 
virtual void PostSpaceInit ()
 Executes extra initialization activities after the space has been initialized. More...
 
virtual bool IsPointContained (const CVector3 &c_point)
 Returns true if the given point is contained in this physics engine. More...
 
virtual size_t GetNumPhysicsModels ()=0
 
virtual bool AddEntity (CEntity &c_entity)=0
 Adds an entity to the physics engine. More...
 
virtual bool RemoveEntity (CEntity &c_entity)=0
 Removes an entity from the physics engine. More...
 
bool IsEntityTransferNeeded () const
 Returns true if this engine has entities that must be transferred to another engine. More...
 
bool IsEntityTransferActive () const
 Returns true if entity transfer is active for this engine. More...
 
virtual void ScheduleEntityForTransfer (CEmbodiedEntity &c_entity)
 Schedules an entity of transfer. More...
 
virtual void TransferEntities ()
 Executes the transfer of entities to other engines. More...
 
SVolumeGetVolume ()
 Returns the boundary faces for the volume associated to this engine. More...
 
const SVolumeGetVolume () const
 Returns the boundary faces for the volume associated to this engine. More...
 
virtual void CheckIntersectionWithRay (TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray) const =0
 Check which objects in this engine intersect the given ray. More...
 
UInt32 GetIterations () const
 Returns the number of iterations per simulation clock tick. More...
 
Real GetPhysicsClockTick () const
 Returns the length of the physics engine tick. More...
 
const std::string & GetId () const
 Returns the id of this physics engine. More...
 
void SetId (const std::string &str_id)
 Sets the id of this physics engine. More...
 
- Public Member Functions inherited from argos::CBaseConfigurableResource
virtual ~CBaseConfigurableResource ()
 Class destructor. More...
 

Static Public Member Functions

static Real GetSimulationClockTick ()
 Returns the simulation clock tick. More...
 
static Real GetInverseSimulationClockTick ()
 Returns the inverse of GetSimulationClockTick(). More...
 
static void SetSimulationClockTick (Real f_simulation_clock_tick)
 Sets the simulation clock tick. More...
 

Detailed Description

Definition at line 90 of file physics_engine.h.

Member Typedef Documentation

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

Definition at line 131 of file physics_engine.h.

Definition at line 130 of file physics_engine.h.

Constructor & Destructor Documentation

argos::CPhysicsEngine::CPhysicsEngine ( )

Definition at line 178 of file physics_engine.cpp.

virtual argos::CPhysicsEngine::~CPhysicsEngine ( )
inlinevirtual

Definition at line 136 of file physics_engine.h.

Member Function Documentation

virtual bool 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.

Returns
true if the entity was added, false otherwise.

Implemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.

virtual void argos::CPhysicsEngine::CheckIntersectionWithRay ( TEmbodiedEntityIntersectionData t_data,
const CRay3 c_ray 
) const
pure virtual

Check which objects in this engine intersect the given ray.

Parameters
t_dataThe list of entities that intersect the ray.
c_rayThe test ray.

Implemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.

virtual void argos::CPhysicsEngine::Destroy ( )
inlinevirtual

Undoes whatever was done by Init().

Implements argos::CBaseConfigurableResource.

Reimplemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.

Definition at line 140 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 284 of file physics_engine.h.

Real argos::CPhysicsEngine::GetInverseSimulationClockTick ( )
static

Returns the inverse of GetSimulationClockTick().

Returns
The inverse of GetSimulationClockTick().

Definition at line 271 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.

See also
GetPhysicsClockTick()

Definition at line 266 of file physics_engine.h.

virtual size_t argos::CPhysicsEngine::GetNumPhysicsModels ( )
pure virtual
Real argos::CPhysicsEngine::GetPhysicsClockTick ( ) const
inline

Returns the length of the physics engine tick.

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

See also
GetIterations()

Definition at line 276 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.

Returns
The simulation clock tick.

Definition at line 264 of file physics_engine.cpp.

SVolume& argos::CPhysicsEngine::GetVolume ( )
inline

Returns the boundary faces for the volume associated to this engine.

Definition at line 211 of file physics_engine.h.

const SVolume& argos::CPhysicsEngine::GetVolume ( ) const
inline

Returns the boundary faces for the volume associated to this engine.

Definition at line 218 of file physics_engine.h.

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, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.

Definition at line 185 of file physics_engine.cpp.

bool argos::CPhysicsEngine::IsEntityTransferActive ( ) const
inline

Returns true if entity transfer is active for this engine.

Definition at line 192 of file physics_engine.h.

bool argos::CPhysicsEngine::IsEntityTransferNeeded ( ) const
inline

Returns true if this engine has entities that must be transferred to another engine.

Definition at line 185 of file physics_engine.h.

bool argos::CPhysicsEngine::IsPointContained ( const CVector3 c_point)
virtual

Returns true if the given point is contained in this physics engine.

Reimplemented in argos::CPointMass3DEngine.

Definition at line 212 of file physics_engine.cpp.

virtual void argos::CPhysicsEngine::PostSpaceInit ( )
inlinevirtual

Executes extra initialization activities after the space has been initialized.

By default, this method does nothing. The order in which initialization takes place is:

Exceptions
CARGoSExceptionif an error occurs
See also
Init()
CSpace::Init()

Reimplemented in argos::CDynamics3DEngine.

Definition at line 157 of file physics_engine.h.

virtual bool 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.

Returns
true if the entity was added, false otherwise.

Implemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.

virtual void argos::CPhysicsEngine::Reset ( )
inlinevirtual

Resets the resource.

Implements argos::CBaseConfigurableResource.

Reimplemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.

Definition at line 139 of file physics_engine.h.

void argos::CPhysicsEngine::ScheduleEntityForTransfer ( CEmbodiedEntity c_entity)
virtual

Schedules an entity of transfer.

Parameters
c_entityThe entity to transfer.
str_engine_idThe id if the destination engine.

Definition at line 246 of file physics_engine.cpp.

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 292 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 278 of file physics_engine.cpp.

void argos::CPhysicsEngine::TransferEntities ( )
virtual

Executes the transfer of entities to other engines.

Reimplemented in argos::CPointMass3DEngine.

Definition at line 253 of file physics_engine.cpp.

virtual void argos::CPhysicsEngine::Update ( )
pure virtual