argos::CDynamics2DStretchableObjectModel Class Reference

A stretchable and grippable object model for the dynamics 2D engine. More...

#include <dynamics2d_stretchable_object_model.h>

Inheritance diagram for argos::CDynamics2DStretchableObjectModel:
Collaboration diagram for argos::CDynamics2DStretchableObjectModel:

Public Member Functions

 CDynamics2DStretchableObjectModel (CDynamics2DEngine &c_engine, CComposableEntity &c_entity)
 
virtual ~CDynamics2DStretchableObjectModel ()
 
virtual void MoveTo (const CVector3 &c_position, const CQuaternion &c_orientation)
 
virtual void Reset ()
 
virtual void UpdateFromEntityStatus ()
 Updates the state of this model from the status of the associated entity. More...
 
Real GetMass () const
 
void SetMass (Real f_mass)
 
void SetGrippable (CDynamics2DGrippable *pc_grippable)
 
void SetLinearFriction (Real f_max_bias, Real f_max_force)
 Sets the linear friction of this object. More...
 
void SetAngularFriction (Real f_max_bias, Real f_max_force)
 Sets the angular friction of this object. More...
 
- Public Member Functions inherited from argos::CDynamics2DSingleBodyObjectModel
 CDynamics2DSingleBodyObjectModel (CDynamics2DEngine &c_engine, CComposableEntity &c_entity)
 Class constructor. More...
 
virtual ~CDynamics2DSingleBodyObjectModel ()
 Class destructor. More...
 
CComposableEntityGetComposableEntity ()
 Returns the associated composable entity as a non-const reference. More...
 
const CComposableEntityGetComposableEntity () const
 Returns the associated composable entity as a const reference. More...
 
cpBody * GetBody ()
 Returns the body as non-const pointer. More...
 
const cpBody * GetBody () const
 Returns the body as const pointer. More...
 
virtual void CalculateBoundingBox ()
 Calculates the axis-aligned box that contains the entire physics model. More...
 
virtual void UpdateEntityStatus ()
 Updates the status of the associated entity. More...
 
virtual bool IsCollidingWithSomething () const
 Returns true if this model is colliding with another model. More...
 
virtual void SetBody (cpBody *pt_body, Real f_height)
 Sets the body and registers the default origin anchor method. More...
 
void UpdateOriginAnchor (SAnchor &s_anchor)
 Updates the origin anchor associated to the embodied entity. More...
 
- Public Member Functions inherited from argos::CDynamics2DModel
 CDynamics2DModel (CDynamics2DEngine &c_engine, CEmbodiedEntity &c_entity)
 
virtual ~CDynamics2DModel ()
 
CDynamics2DEngineGetDynamics2DEngine ()
 Returns the dynamics 2D engine state. More...
 
const CDynamics2DEngineGetDynamics2DEngine () const
 Returns the dynamics 2D engine state as a const reference. More...
 
- Public Member Functions inherited from argos::CPhysicsModel
 CPhysicsModel (CPhysicsEngine &c_engine, CEmbodiedEntity &c_entity)
 
virtual ~CPhysicsModel ()
 
CPhysicsEngineGetEngine ()
 Returns the physics engine associated to this physics model. More...
 
CEmbodiedEntityGetEmbodiedEntity ()
 Returns the embodied entity associated to this physics model. More...
 
const CEmbodiedEntityGetEmbodiedEntity () const
 Returns the embodied entity associated to this physics model. More...
 
const SBoundingBoxGetBoundingBox () const
 Returns an axis-aligned box that contains the physics model. More...
 
virtual void CalculateAnchors ()
 Calculates the anchors associated to this model. More...
 
SBoundingBoxGetBoundingBox ()
 Returns an axis-aligned box that contains the physics model. More...
 
template<typename MODEL >
void RegisterAnchorMethod (const SAnchor &s_anchor, void(MODEL::*pt_method)(SAnchor &))
 Registers an anchor method. More...
 

Additional Inherited Members

- Public Types inherited from argos::CDynamics2DModel
typedef std::map< std::string, CDynamics2DModel * > TMap
 
- Public Types inherited from argos::CPhysicsModel
typedef std::map< std::string, CPhysicsModel * > TMap
 
typedef std::vector< CPhysicsModel * > TVector
 

Detailed Description

A stretchable and grippable object model for the dynamics 2D engine.

This class is used by CDynamics2DBoxModel and CDynamics2DCylinderModel to share common code. If you want to add an additional stretchable object, you just need to subclass this class and implement the constructor similarly to what is done in CDynamics2DBoxModel and CDynamics2DCylinderModel.

See also
CDynamics2DBoxModel
CDynamics2DCylinderModel

Definition at line 32 of file dynamics2d_stretchable_object_model.h.

Constructor & Destructor Documentation

argos::CDynamics2DStretchableObjectModel::CDynamics2DStretchableObjectModel ( CDynamics2DEngine c_engine,
CComposableEntity c_entity 
)

Definition at line 9 of file dynamics2d_stretchable_object_model.cpp.

argos::CDynamics2DStretchableObjectModel::~CDynamics2DStretchableObjectModel ( )
virtual

Definition at line 20 of file dynamics2d_stretchable_object_model.cpp.

Member Function Documentation

Real argos::CDynamics2DStretchableObjectModel::GetMass ( ) const
inline

Definition at line 48 of file dynamics2d_stretchable_object_model.h.

void argos::CDynamics2DStretchableObjectModel::MoveTo ( const CVector3 c_position,
const CQuaternion c_orientation 
)
virtual

Moves the entity to the wanted position and orientation within this engine. When you create a new model, you must implement this method. Don't forget to call UpdateEntityStatus() after you've changed the position.

This method should never be called directly from user code. It is called internally by CEmbodiedEntity::MoveTo(), which is meant to be called from user code.

CEmbodiedEntity::MoveTo() never calls this method if the embodied entity is static. This is because static entities cannot be moved around. Thus, there's no need in your code to check whether the associated entity is static.

Parameters
c_positionThe wanted position.
c_orientationThe wanted orientation.

Reimplemented from argos::CDynamics2DSingleBodyObjectModel.

Definition at line 35 of file dynamics2d_stretchable_object_model.cpp.

void argos::CDynamics2DStretchableObjectModel::Reset ( )
virtual
void argos::CDynamics2DStretchableObjectModel::SetAngularFriction ( Real  f_max_bias,
Real  f_max_force 
)

Sets the angular friction of this object.

You must call this method strictly after SetBody().

Definition at line 73 of file dynamics2d_stretchable_object_model.cpp.

void argos::CDynamics2DStretchableObjectModel::SetGrippable ( CDynamics2DGrippable pc_grippable)
inline

Definition at line 56 of file dynamics2d_stretchable_object_model.h.

void argos::CDynamics2DStretchableObjectModel::SetLinearFriction ( Real  f_max_bias,
Real  f_max_force 
)

Sets the linear friction of this object.

You must call this method strictly after SetBody().

Definition at line 58 of file dynamics2d_stretchable_object_model.cpp.

void argos::CDynamics2DStretchableObjectModel::SetMass ( Real  f_mass)
inline

Definition at line 52 of file dynamics2d_stretchable_object_model.h.

virtual void argos::CDynamics2DStretchableObjectModel::UpdateFromEntityStatus ( )
inlinevirtual

Updates the state of this model from the status of the associated entity.

This method takes the current state of the associated entity (e.g., desired wheel speed, turret rotationss, etc.) and updates the state of this model. Typically, in this method you apply forces and set speeds.

Implements argos::CDynamics2DSingleBodyObjectModel.

Definition at line 46 of file dynamics2d_stretchable_object_model.h.