Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a00183.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a00183.php on line 2
The ARGoS Website

argos::CPhysicsModel Class Referenceabstract

#include <physics_model.h>

Inheritance diagram for argos::CPhysicsModel:

Public Types

typedef std::map< std::string, CPhysicsModel * > TMap
 
typedef std::vector< CPhysicsModel * > TVector
 

Public Member Functions

 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...
 
virtual void UpdateEntityStatus ()
 Updates the status of the associated entity. More...
 
virtual void UpdateFromEntityStatus ()=0
 Updates the state of this model from the status of the associated entity. More...
 
virtual void MoveTo (const CVector3 &c_position, const CQuaternion &c_orientation)=0
 
const SBoundingBoxGetBoundingBox () const
 Returns an axis-aligned box that contains the physics model. More...
 
virtual void CalculateBoundingBox ()=0
 Calculates the axis-aligned box that contains the entire physics model. More...
 
virtual void CalculateAnchors ()
 Calculates the anchors associated to this model. More...
 
virtual bool IsCollidingWithSomething () const =0
 Returns true if this model is colliding with another 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...
 

Detailed Description

Definition at line 102 of file physics_model.h.

Member Typedef Documentation

typedef std::map<std::string, CPhysicsModel*> argos::CPhysicsModel::TMap

Definition at line 106 of file physics_model.h.

Definition at line 107 of file physics_model.h.

Constructor & Destructor Documentation

argos::CPhysicsModel::CPhysicsModel ( CPhysicsEngine c_engine,
CEmbodiedEntity c_entity 
)

Definition at line 44 of file physics_model.cpp.

virtual argos::CPhysicsModel::~CPhysicsModel ( )
inlinevirtual

Definition at line 114 of file physics_model.h.

Member Function Documentation

void argos::CPhysicsModel::CalculateAnchors ( )
virtual

Calculates the anchors associated to this model.

The default implementation of this method should fit all possible use cases. There's usually no need to override it.

Definition at line 77 of file physics_model.cpp.

virtual void argos::CPhysicsModel::CalculateBoundingBox ( )
pure virtual
const SBoundingBox& argos::CPhysicsModel::GetBoundingBox ( ) const
inline

Returns an axis-aligned box that contains the physics model.

The bounding box is often called AABB.

Returns
The bounding box as a const struct.

Definition at line 198 of file physics_model.h.

SBoundingBox& argos::CPhysicsModel::GetBoundingBox ( )
inline

Returns an axis-aligned box that contains the physics model.

The bounding box is often called AABB.

Returns
The bounding box as a modifiable struct.

Definition at line 226 of file physics_model.h.

CEmbodiedEntity& argos::CPhysicsModel::GetEmbodiedEntity ( )
inline

Returns the embodied entity associated to this physics model.

Returns
The embodied entity associated to this physics model.

Definition at line 133 of file physics_model.h.

const CEmbodiedEntity& argos::CPhysicsModel::GetEmbodiedEntity ( ) const
inline

Returns the embodied entity associated to this physics model.

Returns
The embodied entity associated to this physics model.

Definition at line 141 of file physics_model.h.

CPhysicsEngine& argos::CPhysicsModel::GetEngine ( )
inline

Returns the physics engine associated to this physics model.

Returns
The physics engine associated to this physics model.

Definition at line 125 of file physics_model.h.

virtual bool argos::CPhysicsModel::IsCollidingWithSomething ( ) const
pure virtual

Returns true if this model is colliding with another model.

Returns
true if this model is colliding with another model.

Implemented in argos::CDynamics3DModel, argos::CDynamics2DMultiBodyObjectModel, argos::CDynamics2DSingleBodyObjectModel, and argos::CPointMass3DModel.

virtual void argos::CPhysicsModel::MoveTo ( const CVector3 c_position,
const CQuaternion c_orientation 
)
pure 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.

Implemented in argos::CDynamics2DMultiBodyObjectModel, argos::CDynamics2DSingleBodyObjectModel, argos::CDynamics3DMultiBodyObjectModel, argos::CDynamics3DSingleBodyObjectModel, argos::CDynamics2DStretchableObjectModel, argos::CPointMass3DModel, and argos::CDynamics2DFootBotModel.

template<typename MODEL >
void argos::CPhysicsModel::RegisterAnchorMethod ( const SAnchor s_anchor,
void(MODEL::*)(SAnchor &)  pt_method 
)

Registers an anchor method.

Parameters
MODELA user-defined subclass of CPhysicsModel.
s_anchorThe anchor to pass as a parameter to the anchor method.
pt_methodThe actual user-defined pointer-to-method.

Definition at line 325 of file physics_model.h.

void argos::CPhysicsModel::UpdateEntityStatus ( )
virtual

Updates the status of the associated entity.

This method performs all the calculations to update the status of the entity associated to this model. In particular, it is in this method that anchors get updated and transfer to other engines is scheduled. This method internally calls:

See also
CalculateBoundingBox()
CalculateAnchors()
CComposableEntity::UpdateComponents()

Reimplemented in argos::CDynamics3DModel, argos::CDynamics2DSingleBodyObjectModel, argos::CDynamics3DPrototypeModel, and argos::CPointMass3DBoxModel.

Definition at line 55 of file physics_model.cpp.

virtual void argos::CPhysicsModel::UpdateFromEntityStatus ( )
pure virtual

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.

Implemented in argos::CDynamics3DModel, argos::CDynamics2DMultiBodyObjectModel, argos::CDynamics2DSingleBodyObjectModel, argos::CPointMass3DQuadRotorModel, argos::CDynamics2DStretchableObjectModel, argos::CPointMass3DModel, argos::CDynamics2DFootBotModel, argos::CDynamics3DPrototypeModel, argos::CDynamics2DEPuckModel, argos::CPointMass3DFootBotModel, argos::CPointMass3DBoxModel, and argos::CPointMass3DCylinderModel.