ARGoS  3
A parallel, multi-engine simulator for swarm robotics
argos::CEmbodiedEntity Class Reference

This entity is a link to a body in the physics engine. More...

#include <embodied_entity.h>

+ Inheritance diagram for argos::CEmbodiedEntity:

List of all members.

Public Member Functions

 ENABLE_VTABLE ()
 CEmbodiedEntity (CComposableEntity *pc_parent)
 Class constructor.
 CEmbodiedEntity (CComposableEntity *pc_parent, const std::string &str_id, const CVector3 &c_position=CVector3(), const CQuaternion &c_orientation=CQuaternion(), bool b_movable=true)
 Class constructor.
virtual ~CEmbodiedEntity ()
 Class destructor.
virtual void Init (TConfigurationNode &t_tree)
 Initializes the state of the entity from the XML configuration tree.
bool IsMovable () const
 Returns true if the entity is movable.
void SetMovable (bool b_movable)
 Sets whether this entity is movable or not.
const SBoundingBoxGetBoundingBox () const
 Returns the bounding box of this embodied entity.
UInt32 GetPhysicsModelsNum () const
 Returns the number of physics models associated to this entity.
virtual void AddPhysicsModel (const std::string &str_engine_id, CPhysicsModel &c_physics_model)
 Adds a new physics model to this embodied entity.
void RemovePhysicsModel (const std::string &str_engine_id)
 Removes a physics model from this embodied entity.
const CPhysicsModelGetPhysicsModel (size_t un_idx) const
 Returns a physics model associated to this entity.
CPhysicsModelGetPhysicsModel (size_t un_idx)
 Returns a physics model associated to this entity.
const CPhysicsModelGetPhysicsModel (const std::string &str_engine_id) const
 Returns a physics model associated to this entity.
CPhysicsModelGetPhysicsModel (const std::string &str_engine_id)
 Returns a physics model associated to this entity.
virtual bool MoveTo (const CVector3 &c_position, const CQuaternion &c_orientation, bool b_check_only=false)
 Moves the entity to the wanted position and orientation.
virtual bool IsCollidingWithSomething () const
 Returns true if this entity is colliding with another object.
virtual std::string GetTypeDescription () const
 Returns a string label for this class.

Protected Member Functions

void CalculateBoundingBox ()
 Calculates the bounding box of this entity.

Protected Attributes

bool m_bMovable
CPhysicsModel::TMap m_tPhysicsModelMap
CPhysicsModel::TVector m_tPhysicsModelVector
SBoundingBoxm_sBoundingBox

Detailed Description

This entity is a link to a body in the physics engine.

The embodied entity can either be a root entity (i.e., parentless), or a component.

Its main purpose is to serve as an interface to the actual body in the physics engine. Sensors can use embodied entities to know the position and orientations of the objects in the arena, and can perform ray-cast queries to test for occlusions. In addition, the method MoveTo() allows one to move an entity and/or rotate it.

Embodied entities can be either movable or non-movable. Movable entities are typically self-propelled objects such as mobile robots, or passive objects that can be grasped and moved around. A movable entity can only be associated to a single physics engine per time. Non-movable embodied entities are typically the structural elements of the environments (walls, columns, etc.) and can be associated to multiple physics engines.

See also:
CPhysicsEngine
CPhysicsModel

Definition at line 49 of file embodied_entity.h.


Constructor & Destructor Documentation

Class constructor.

This constructor is meant to be used with the Init() method.

Parameters:
pc_parentThe parent of this entity.

Definition at line 19 of file embodied_entity.cpp.

argos::CEmbodiedEntity::CEmbodiedEntity ( CComposableEntity pc_parent,
const std::string &  str_id,
const CVector3 c_position = CVector3(),
const CQuaternion c_orientation = CQuaternion(),
bool  b_movable = true 
)

Class constructor.

This constructor is meant to be standalone. You should not call Init() after using this constructor, or memory leaks are likely to happen.

Parameters:
pc_parentThe parent of this entity.
str_idThe id of this entity.
c_positionThe initial entity position
c_orientationThe initial entity orientation
b_movableIf set to true, this entity is movable.

Definition at line 27 of file embodied_entity.cpp.

Class destructor.

Definition at line 42 of file embodied_entity.cpp.


Member Function Documentation

void argos::CEmbodiedEntity::AddPhysicsModel ( const std::string &  str_engine_id,
CPhysicsModel c_physics_model 
) [virtual]

Adds a new physics model to this embodied entity.

Internally it calls CalculateBoundingBox().

Parameters:
str_engine_idThe id of the engine to which the physics model belongs.
c_physics_modelThe physics model to add.
See also:
CPhysicsModel

Definition at line 82 of file embodied_entity.cpp.

Calculates the bounding box of this entity.

In case of association to multiple models, the resulting bounding box is the largest that contains all the bounding boxes of each model.

See also:
CPhysicsModel::CalculateBoundingBox()

Definition at line 200 of file embodied_entity.cpp.

Returns the bounding box of this embodied entity.

The bounding box is calculated by the physics engine. In case multiple physics engines are associated to this entity, the resulting bounding box is the largest bounding box that includes all the bounding boxes of each physics engine.

Returns:
The bounding box of this embodied entity.
See also:
SBoundingBox

Definition at line 64 of file embodied_entity.cpp.

const CPhysicsModel & argos::CEmbodiedEntity::GetPhysicsModel ( size_t  un_idx) const

Returns a physics model associated to this entity.

Parameters:
un_idxThe index of the wanted physics model.
Returns:
a physics model associated to this entity.
Exceptions:
CARGoSExceptionif the index is out of bounds.

Definition at line 111 of file embodied_entity.cpp.

Returns a physics model associated to this entity.

Parameters:
un_idxThe index of the wanted physics model.
Returns:
a physics model associated to this entity.
Exceptions:
CARGoSExceptionif the index is out of bounds.

Definition at line 121 of file embodied_entity.cpp.

const CPhysicsModel & argos::CEmbodiedEntity::GetPhysicsModel ( const std::string &  str_engine_id) const

Returns a physics model associated to this entity.

Parameters:
str_engine_idThe id of the engine to which the physics model belongs.
Returns:
a physics model associated to this entity.
Exceptions:
CARGoSExceptionif the engine id is not found.

Definition at line 131 of file embodied_entity.cpp.

CPhysicsModel & argos::CEmbodiedEntity::GetPhysicsModel ( const std::string &  str_engine_id)

Returns a physics model associated to this entity.

Parameters:
str_engine_idThe id of the engine to which the physics model belongs.
Returns:
a physics model associated to this entity.
Exceptions:
CARGoSExceptionif the engine id is not found.

Definition at line 142 of file embodied_entity.cpp.

Returns the number of physics models associated to this entity.

Returns:
The number of physics models associated to this entity.

Definition at line 75 of file embodied_entity.cpp.

virtual std::string argos::CEmbodiedEntity::GetTypeDescription ( ) const [inline, virtual]

Returns a string label for this class.

Returns:
A string label for this class.

Reimplemented from argos::CPositionalEntity.

Definition at line 202 of file embodied_entity.h.

void argos::CEmbodiedEntity::Init ( TConfigurationNode t_tree) [virtual]

Initializes the state of the entity from the XML configuration tree.

Internally, this entity calls CPositionalEntity::Init() and sets m_bMovable to true.

Exceptions:
CARGoSExceptionif a parse error occurred
See also:
CPositionalEntity::Init()
m_bMovable

Reimplemented from argos::CPositionalEntity.

Definition at line 51 of file embodied_entity.cpp.

Returns true if this entity is colliding with another object.

Returns:
true if this entity is colliding with another object.

Definition at line 241 of file embodied_entity.cpp.

bool argos::CEmbodiedEntity::IsMovable ( ) const [inline]

Returns true if the entity is movable.

Returns:
true if the entity is movable.

Definition at line 100 of file embodied_entity.h.

bool argos::CEmbodiedEntity::MoveTo ( const CVector3 c_position,
const CQuaternion c_orientation,
bool  b_check_only = false 
) [virtual]

Moves the entity to the wanted position and orientation.

The movement is allowed only if the object does not collide with anything once in the new position. In case of multiple models associated to this entity, all the engines are checked.

Parameters:
c_positionThe wanted position.
c_orientationThe wanted orientation.
b_check_onlyIf false, the movement is executed; otherwise, the object is not actually moved.
Returns:
true if no collisions were detected, false otherwise.
See also:
CPhysicsModel::MoveTo()

Reimplemented from argos::CPositionalEntity.

Definition at line 153 of file embodied_entity.cpp.

void argos::CEmbodiedEntity::RemovePhysicsModel ( const std::string &  str_engine_id)

Removes a physics model from this embodied entity.

Internally it calls CalculateBoundingBox().

Parameters:
str_engine_idThe id of the engine to which the physics model belongs.
Exceptions:
CARGoSExceptionif the engine id is not found.

Definition at line 95 of file embodied_entity.cpp.

void argos::CEmbodiedEntity::SetMovable ( bool  b_movable) [inline]

Sets whether this entity is movable or not.

This flag cannot be changed during an experiment, because the results are undefined.

Parameters:
b_movabletrue if the entity is movable.

Definition at line 110 of file embodied_entity.h.


Member Data Documentation

Definition at line 218 of file embodied_entity.h.


The documentation for this class was generated from the following files: