#include <physics_engine.h>
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... | |
SVolume & | GetVolume () |
Returns the boundary faces for the volume associated to this engine. More... | |
const SVolume & | GetVolume () 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... | |
Definition at line 90 of file physics_engine.h.
typedef std::map<std::string, CPhysicsEngine*, std::less<std::string> > argos::CPhysicsEngine::TMap |
Definition at line 131 of file physics_engine.h.
typedef std::vector<CPhysicsEngine*> argos::CPhysicsEngine::TVector |
Definition at line 130 of file physics_engine.h.
argos::CPhysicsEngine::CPhysicsEngine | ( | ) |
Definition at line 178 of file physics_engine.cpp.
|
inlinevirtual |
Definition at line 136 of file physics_engine.h.
|
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.
true
if the entity was added, false
otherwise. Implemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.
|
pure virtual |
Check which objects in this engine intersect the given ray.
t_data | The list of entities that intersect the ray. |
c_ray | The test ray. |
Implemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.
|
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.
|
inline |
Returns the id of this physics engine.
Definition at line 284 of file physics_engine.h.
|
static |
Returns the inverse of GetSimulationClockTick().
Definition at line 271 of file physics_engine.cpp.
|
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 266 of file physics_engine.h.
|
pure virtual |
Implemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.
|
inline |
Returns the length of the physics engine tick.
This value is calculated as GetSimulationClockTick() / static_cast<Real>(GetIterations()).
Definition at line 276 of file physics_engine.h.
|
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 264 of file physics_engine.cpp.
|
inline |
Returns the boundary faces for the volume associated to this engine.
Definition at line 211 of file physics_engine.h.
|
inline |
Returns the boundary faces for the volume associated to this engine.
Definition at line 218 of file physics_engine.h.
|
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, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.
Definition at line 185 of file physics_engine.cpp.
|
inline |
Returns true
if entity transfer is active for this engine.
Definition at line 192 of file physics_engine.h.
|
inline |
Returns true
if this engine has entities that must be transferred to another engine.
Definition at line 185 of file physics_engine.h.
|
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.
|
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:
CARGoSException | if an error occurs |
Reimplemented in argos::CDynamics3DEngine.
Definition at line 157 of file physics_engine.h.
|
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.
true
if the entity was added, false
otherwise. Implemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.
|
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.
|
virtual |
Schedules an entity of transfer.
c_entity | The entity to transfer. |
str_engine_id | The id if the destination engine. |
Definition at line 246 of file physics_engine.cpp.
|
inline |
Sets the id of this physics engine.
str_id | The wanted id. |
Definition at line 292 of file physics_engine.h.
|
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 278 of file physics_engine.cpp.
|
virtual |
Executes the transfer of entities to other engines.
Reimplemented in argos::CPointMass3DEngine.
Definition at line 253 of file physics_engine.cpp.
|
pure virtual |
Implemented in argos::CDynamics2DEngine, argos::CDynamics3DEngine, and argos::CPointMass3DEngine.