#include <physics_model.h>
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 () |
CPhysicsEngine & | GetEngine () |
Returns the physics engine associated to this physics model. More... | |
CEmbodiedEntity & | GetEmbodiedEntity () |
Returns the embodied entity associated to this physics model. More... | |
const CEmbodiedEntity & | GetEmbodiedEntity () 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 | UpdatePhysics () |
Performs extra work just before the physics update takes place. More... | |
virtual void | MoveTo (const CVector3 &c_position, const CQuaternion &c_orientation)=0 |
const SBoundingBox & | GetBoundingBox () 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... | |
SBoundingBox & | GetBoundingBox () |
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... | |
Definition at line 102 of file physics_model.h.
typedef std::map<std::string, CPhysicsModel*> argos::CPhysicsModel::TMap |
Definition at line 106 of file physics_model.h.
typedef std::vector<CPhysicsModel*> argos::CPhysicsModel::TVector |
Definition at line 107 of file physics_model.h.
argos::CPhysicsModel::CPhysicsModel | ( | CPhysicsEngine & | c_engine, |
CEmbodiedEntity & | c_entity | ||
) |
Definition at line 44 of file physics_model.cpp.
|
inlinevirtual |
Definition at line 114 of file physics_model.h.
|
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.
|
pure virtual |
Calculates the axis-aligned box that contains the entire physics model.
The bounding box is often called AABB.
Implemented in argos::CPointMass3DQuadRotorModel, argos::CPointMass3DCylinderModel, argos::CPointMass3DBoxModel, argos::CDynamics3DSingleBodyObjectModel, argos::CDynamics3DMultiBodyObjectModel, argos::CDynamics2DSingleBodyObjectModel, argos::CDynamics2DMultiBodyObjectModel, argos::CPointMass3DFootBotModel, argos::CDynamics2DFootBotModel, and argos::CDynamics3DEPuckModel.
|
inline |
Returns an axis-aligned box that contains the physics model.
The bounding box is often called AABB.
Definition at line 242 of file physics_model.h.
|
inline |
Returns an axis-aligned box that contains the physics model.
The bounding box is often called AABB.
Definition at line 214 of file physics_model.h.
|
inline |
Returns the embodied entity associated to this physics model.
Definition at line 133 of file physics_model.h.
|
inline |
Returns the embodied entity associated to this physics model.
Definition at line 141 of file physics_model.h.
|
inline |
Returns the physics engine associated to this physics model.
Definition at line 125 of file physics_model.h.
|
pure virtual |
Returns true
if this model is colliding with another model.
true
if this model is colliding with another model. Implemented in argos::CPointMass3DModel, argos::CDynamics3DModel, argos::CDynamics2DSingleBodyObjectModel, and argos::CDynamics2DMultiBodyObjectModel.
|
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.
c_position | The wanted position. |
c_orientation | The wanted orientation. |
Implemented in argos::CPointMass3DModel, argos::CDynamics3DSingleBodyObjectModel, argos::CDynamics3DMultiBodyObjectModel, argos::CDynamics2DStretchableObjectModel, argos::CDynamics2DSingleBodyObjectModel, argos::CDynamics2DMultiBodyObjectModel, and argos::CDynamics2DFootBotModel.
void argos::CPhysicsModel::RegisterAnchorMethod | ( | const SAnchor & | s_anchor, |
void(MODEL::*)(SAnchor &) | pt_method | ||
) |
Registers an anchor method.
MODEL | A user-defined subclass of CPhysicsModel. |
s_anchor | The anchor to pass as a parameter to the anchor method. |
pt_method | The actual user-defined pointer-to-method. |
Definition at line 341 of file physics_model.h.
|
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:
Reimplemented in argos::CPointMass3DBoxModel, argos::CDynamics3DModel, argos::CDynamics2DSingleBodyObjectModel, argos::CDynamics3DPrototypeModel, and argos::CDynamics3DEPuckModel.
Definition at line 55 of file physics_model.cpp.
|
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::CPointMass3DModel, argos::CDynamics2DSingleBodyObjectModel, argos::CDynamics2DMultiBodyObjectModel, argos::CPointMass3DQuadRotorModel, argos::CPointMass3DCylinderModel, argos::CPointMass3DBoxModel, argos::CDynamics3DModel, argos::CDynamics2DStretchableObjectModel, argos::CDynamics3DPrototypeModel, argos::CPointMass3DFootBotModel, argos::CDynamics2DFootBotModel, argos::CDynamics3DEPuckModel, and argos::CDynamics2DEPuckModel.
|
inlinevirtual |
Performs extra work just before the physics update takes place.
This method is called as many times as the physics update itself, that is GetIteration() times every control step.
You can use this method to implement a PID controller, or to calculate high-frequency physics effects.
By default this method does nothing.
Definition at line 184 of file physics_model.h.