argos::CDynamics2DEngine Class Reference

#include <dynamics2d_engine.h>

Inheritance diagram for argos::CDynamics2DEngine:
Collaboration diagram for argos::CDynamics2DEngine:

Public Types

enum  EShapeType { SHAPE_NORMAL = 0 , SHAPE_GRIPPABLE , SHAPE_GRIPPER }
 
enum  ELayerType { LAYER_FROZEN = 0 , LAYER_NORMAL = CP_ALL_LAYERS }
 
- Public Types inherited from argos::CPhysicsEngine
typedef std::vector< CPhysicsEngine * > TVector
 
typedef std::map< std::string, CPhysicsEngine *, std::less< std::string > > TMap
 

Public Member Functions

 CDynamics2DEngine ()
 
virtual ~CDynamics2DEngine ()
 
virtual void Init (TConfigurationNode &t_tree)
 Initializes the resource. More...
 
virtual void Reset ()
 Resets the resource. More...
 
virtual void Update ()
 
virtual void Destroy ()
 Undoes whatever was done by Init(). More...
 
virtual size_t GetNumPhysicsModels ()
 
virtual bool AddEntity (CEntity &c_entity)
 Adds an entity to the physics engine. More...
 
virtual bool RemoveEntity (CEntity &c_entity)
 Removes an entity from the physics engine. More...
 
virtual void CheckIntersectionWithRay (TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray) const
 Check which objects in this engine intersect the given ray. More...
 
cpFloat GetBoxLinearFriction () const
 
cpFloat GetBoxAngularFriction () const
 
cpFloat GetCylinderLinearFriction () const
 
cpFloat GetCylinderAngularFriction () const
 
cpSpace * GetPhysicsSpace ()
 
const cpSpace * GetPhysicsSpace () const
 
cpBody * GetGroundBody ()
 
Real GetElevation () const
 
Real GetDamping () const
 
void SetDamping (Real f_damping)
 
CVector2 GetGravity () const
 
void SetGravity (const CVector2 &c_gravity)
 
Real GetGrippingRigidity () const
 
void SetGrippingRigidity (Real f_gripping_rigidity)
 
void PositionPhysicsToSpace (CVector3 &c_new_pos, const CVector3 &c_original_pos, const cpBody *pt_body)
 
void OrientationPhysicsToSpace (CQuaternion &c_new_orient, cpBody *pt_body)
 
void AddPhysicsModel (const std::string &str_id, CDynamics2DModel &c_model)
 
void RemovePhysicsModel (const std::string &str_id)
 
- Public Member Functions inherited from argos::CPhysicsEngine
 CPhysicsEngine ()
 
virtual ~CPhysicsEngine ()
 
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...
 
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...
 
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from argos::CPhysicsEngine
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 42 of file dynamics2d_engine.h.

Member Enumeration Documentation

◆ ELayerType

Enumerator
LAYER_FROZEN 
LAYER_NORMAL 

Definition at line 52 of file dynamics2d_engine.h.

◆ EShapeType

Enumerator
SHAPE_NORMAL 
SHAPE_GRIPPABLE 
SHAPE_GRIPPER 

Definition at line 46 of file dynamics2d_engine.h.

Constructor & Destructor Documentation

◆ CDynamics2DEngine()

argos::CDynamics2DEngine::CDynamics2DEngine ( )

Definition at line 21 of file dynamics2d_engine.cpp.

◆ ~CDynamics2DEngine()

virtual argos::CDynamics2DEngine::~CDynamics2DEngine ( )
inlinevirtual

Definition at line 59 of file dynamics2d_engine.h.

Member Function Documentation

◆ AddEntity()

bool argos::CDynamics2DEngine::AddEntity ( CEntity c_entity)
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.

Implements argos::CPhysicsEngine.

Definition at line 150 of file dynamics2d_engine.cpp.

◆ AddPhysicsModel()

void argos::CDynamics2DEngine::AddPhysicsModel ( const std::string &  str_id,
CDynamics2DModel c_model 
)

Definition at line 251 of file dynamics2d_engine.cpp.

◆ CheckIntersectionWithRay()

void argos::CDynamics2DEngine::CheckIntersectionWithRay ( TEmbodiedEntityIntersectionData t_data,
const CRay3 c_ray 
) const
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.

Implements argos::CPhysicsEngine.

Definition at line 215 of file dynamics2d_engine.cpp.

◆ Destroy()

void argos::CDynamics2DEngine::Destroy ( )
virtual

Undoes whatever was done by Init().

Reimplemented from argos::CPhysicsEngine.

Definition at line 128 of file dynamics2d_engine.cpp.

◆ GetBoxAngularFriction()

cpFloat argos::CDynamics2DEngine::GetBoxAngularFriction ( ) const
inline

Definition at line 77 of file dynamics2d_engine.h.

◆ GetBoxLinearFriction()

cpFloat argos::CDynamics2DEngine::GetBoxLinearFriction ( ) const
inline

Definition at line 73 of file dynamics2d_engine.h.

◆ GetCylinderAngularFriction()

cpFloat argos::CDynamics2DEngine::GetCylinderAngularFriction ( ) const
inline

Definition at line 85 of file dynamics2d_engine.h.

◆ GetCylinderLinearFriction()

cpFloat argos::CDynamics2DEngine::GetCylinderLinearFriction ( ) const
inline

Definition at line 81 of file dynamics2d_engine.h.

◆ GetDamping()

Real argos::CDynamics2DEngine::GetDamping ( ) const
inline

Definition at line 105 of file dynamics2d_engine.h.

◆ GetElevation()

Real argos::CDynamics2DEngine::GetElevation ( ) const
inline

Definition at line 101 of file dynamics2d_engine.h.

◆ GetGravity()

CVector2 argos::CDynamics2DEngine::GetGravity ( ) const
inline

Definition at line 113 of file dynamics2d_engine.h.

◆ GetGrippingRigidity()

Real argos::CDynamics2DEngine::GetGrippingRigidity ( ) const
inline

Definition at line 121 of file dynamics2d_engine.h.

◆ GetGroundBody()

cpBody* argos::CDynamics2DEngine::GetGroundBody ( )
inline

Definition at line 97 of file dynamics2d_engine.h.

◆ GetNumPhysicsModels()

size_t argos::CDynamics2DEngine::GetNumPhysicsModels ( )
virtual

Implements argos::CPhysicsEngine.

Definition at line 143 of file dynamics2d_engine.cpp.

◆ GetPhysicsSpace() [1/2]

cpSpace* argos::CDynamics2DEngine::GetPhysicsSpace ( )
inline

Definition at line 89 of file dynamics2d_engine.h.

◆ GetPhysicsSpace() [2/2]

const cpSpace* argos::CDynamics2DEngine::GetPhysicsSpace ( ) const
inline

Definition at line 93 of file dynamics2d_engine.h.

◆ Init()

void argos::CDynamics2DEngine::Init ( TConfigurationNode t_tree)
virtual

Initializes the resource.

Parameters
t_treethe base of the XML configuration tree to parse
Exceptions
CARGoSExceptionif an error occurs

Reimplemented from argos::CPhysicsEngine.

Definition at line 35 of file dynamics2d_engine.cpp.

◆ OrientationPhysicsToSpace()

void argos::CDynamics2DEngine::OrientationPhysicsToSpace ( CQuaternion c_new_orient,
cpBody *  pt_body 
)

Definition at line 243 of file dynamics2d_engine.cpp.

◆ PositionPhysicsToSpace()

void argos::CDynamics2DEngine::PositionPhysicsToSpace ( CVector3 c_new_pos,
const CVector3 c_original_pos,
const cpBody *  pt_body 
)

Definition at line 232 of file dynamics2d_engine.cpp.

◆ RemoveEntity()

bool argos::CDynamics2DEngine::RemoveEntity ( CEntity c_entity)
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.

Implements argos::CPhysicsEngine.

Definition at line 161 of file dynamics2d_engine.cpp.

◆ RemovePhysicsModel()

void argos::CDynamics2DEngine::RemovePhysicsModel ( const std::string &  str_id)

Definition at line 259 of file dynamics2d_engine.cpp.

◆ Reset()

void argos::CDynamics2DEngine::Reset ( )
virtual

Resets the resource.

Reimplemented from argos::CPhysicsEngine.

Definition at line 93 of file dynamics2d_engine.cpp.

◆ SetDamping()

void argos::CDynamics2DEngine::SetDamping ( Real  f_damping)
inline

Definition at line 109 of file dynamics2d_engine.h.

◆ SetGravity()

void argos::CDynamics2DEngine::SetGravity ( const CVector2 c_gravity)
inline

Definition at line 117 of file dynamics2d_engine.h.

◆ SetGrippingRigidity()

void argos::CDynamics2DEngine::SetGrippingRigidity ( Real  f_gripping_rigidity)
inline

Definition at line 125 of file dynamics2d_engine.h.

◆ Update()

void argos::CDynamics2DEngine::Update ( )
virtual

Implements argos::CPhysicsEngine.

Definition at line 104 of file dynamics2d_engine.cpp.