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

The basic entity type. More...

#include <entity.h>

+ Inheritance diagram for argos::CEntity:

List of all members.

Public Types

typedef std::vector< CEntity * > TVector
 A vector of entities.
typedef unordered_map
< std::string, CEntity * > 
TMap
 A map of entities.
typedef std::multimap
< std::string, CEntity * > 
TMultiMap
 A multi-map of entities.

Public Member Functions

 ENABLE_VTABLE ()
 CEntity (CComposableEntity *pc_parent)
 Class constructor.
 CEntity (CComposableEntity *pc_parent, const std::string &str_id)
 Class constructor.
virtual ~CEntity ()
 Class destructor.
virtual void Init (TConfigurationNode &t_tree)
 Initializes the state of the entity from the XML configuration tree.
virtual void Reset ()
 Resets the state of the entity to whatever it was after Init() or the standalone constructor was called.
virtual void Destroy ()
 Destroys the entity, undoing whatever was done by Init() or by the standalone constructor.
const std::string & GetId () const
 Returns the id of this entity.
std::string GetContext () const
 Returns the context of this entity.
bool HasParent () const
 Returns true if this entity has a parent.
CEntityGetRootEntity ()
 Returns the root entity containing this entity.
const CEntityGetRootEntity () const
 Returns the root entity containing this entity.
CComposableEntityGetParent ()
 Returns this entity's parent.
const CComposableEntityGetParent () const
 Returns this entity's parent.
void SetParent (CComposableEntity &c_parent)
 Sets this entity's parent.
virtual std::string GetTypeDescription () const
 Returns a string label for this class.
virtual void Update ()
 Updates the state of this entity.
bool IsEnabled () const
 Returns true if the entity is enabled.
void Enable ()
 Enables the entity.
void Disable ()
 Disables the entity.
virtual void SetEnabled (bool b_enabled)
 Enables or disables an entity.
bool CanBeEnabledIfDisabled () const
 Returns true if this entity, once disabled, can be re-enabled.
void SetCanBeEnabledIfDisabled (bool b_can_it)
 Sets whether this entity, once disabled, can be re-enabled.

Detailed Description

The basic entity type.

The simulation data is organized into basic items referred to as entities ARGoS natively offers several entity types, and the user can customize them or add new ones if necessary. Each type of entity stores information about a specific aspect of the simulation.

For instance, to store the complete state of a wheeled robot, a CComposableEntity is used. CComposableEntity are logical containers that are used to group other entities. CComposableEntity can be nested to form trees of arbitrary complexity. The CControllableEntity is a component that stores a reference to the user-defined control code and to the robot's sensors and actuators. The CEmbodiedEntity component stores the position, orientation and 3D bounding box of the robot. The current wheel speed is stored into the CWheeledEntity component. If the robot is equipped with colored LEDs, their state is stored in a component called CLEDEquippedEntity.

Entity types are organized in hierarchies. For instance, the CEmbodiedEntity is an extension of the simpler CPositionalEntity, which contains just the position and orientation of an object, but not its bounding box. These design choices (entity composition and extension) ensure flexibility, enhance code reuse and diminish information redundancy.

Entity types are indexed in efficient data structures optimized for access speed. In this way, the performance of the plug-ins that access the simulated 3D space is enhanced. For example, positional entities and their extensions are indexed in several type-specific space hashes.

See also:
CSpace
CSpaceHash

Definition at line 89 of file entity.h.


Member Typedef Documentation

typedef unordered_map<std::string, CEntity*> argos::CEntity::TMap

A map of entities.

Reimplemented in argos::CLEDEquippedEntity, and argos::CControllableEntity.

Definition at line 100 of file entity.h.

typedef std::multimap<std::string, CEntity*> argos::CEntity::TMultiMap

A multi-map of entities.

Definition at line 103 of file entity.h.

typedef std::vector<CEntity*> argos::CEntity::TVector

A vector of entities.

Reimplemented in argos::CControllableEntity, and argos::CRABEquippedEntity.

Definition at line 97 of file 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 18 of file entity.cpp.

argos::CEntity::CEntity ( CComposableEntity pc_parent,
const std::string &  str_id 
)

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.

Definition at line 27 of file entity.cpp.

virtual argos::CEntity::~CEntity ( ) [inline, virtual]

Class destructor.

Definition at line 128 of file entity.h.


Member Function Documentation

bool argos::CEntity::CanBeEnabledIfDisabled ( ) const [inline]

Returns true if this entity, once disabled, can be re-enabled.

Returns:
true if this entity, once disabled, can be re-enabled.
See also:
m_bEnabled
m_bCanBeEnabledIfDisabled

Definition at line 267 of file entity.h.

virtual void argos::CEntity::Destroy ( ) [inline, virtual]

Destroys the entity, undoing whatever was done by Init() or by the standalone constructor.

The default implementation of this method does nothing.

Implements argos::CBaseConfigurableResource.

Reimplemented in argos::CControllableEntity, argos::CFootBotEntity, and argos::CEPuckEntity.

Definition at line 151 of file entity.h.

void argos::CEntity::Disable ( ) [inline]

Disables the entity.

See also:
m_bEnabled
m_bCanBeEnabledIfDisabled
SetEnabled()

Definition at line 249 of file entity.h.

void argos::CEntity::Enable ( ) [inline]

Enables the entity.

See also:
m_bEnabled
m_bCanBeEnabledIfDisabled
SetEnabled()

Definition at line 239 of file entity.h.

std::string argos::CEntity::GetContext ( ) const

Returns the context of this entity.

Returns:
The context of this entity.

Definition at line 73 of file entity.cpp.

const std::string& argos::CEntity::GetId ( ) const [inline]

Returns the id of this entity.

Returns:
The id of this entity.

Definition at line 157 of file entity.h.

Returns this entity's parent.

Returns:
This entity's parent.
Exceptions:
CARGoSExceptionif this entity has no parent.

Definition at line 85 of file entity.cpp.

Returns this entity's parent.

Returns:
This entity's parent.
Exceptions:
CARGoSExceptionif this entity has no parent.

Definition at line 97 of file entity.cpp.

Returns the root entity containing this entity.

Returns:
The root entity containing this entity.

Definition at line 109 of file entity.cpp.

Returns the root entity containing this entity.

Returns:
The root entity containing this entity.

Definition at line 121 of file entity.cpp.

bool argos::CEntity::HasParent ( ) const [inline]

Returns true if this entity has a parent.

Returns:
true if this entity has a parent.

Definition at line 171 of file entity.h.

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

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

If the id of the entity has not been set yet, this method sets an id for the entity. If the entity has no parent, this method parses the passed XML tree and looks for the id attribute, setting its value as id. If, instead, this entity has a parent, the id is set as GetParent().GetId() + "." + GetTypeDescription().

Exceptions:
CARGoSExceptionif a parse error occurred

Implements argos::CBaseConfigurableResource.

Reimplemented in argos::CEmbodiedEntity, argos::CFloorEntity, argos::CControllableEntity, argos::CGripperEquippedEntity, argos::CLEDEquippedEntity, argos::COmnidirectionalCameraEquippedEntity, argos::CGroundSensorEquippedEntity, argos::CLightSensorEquippedEntity, argos::CProximitySensorEquippedEntity, argos::CFootBotEntity, argos::CLEDEntity, argos::CRABEquippedEntity, argos::CCylinderEntity, argos::CEPuckEntity, argos::CBoxEntity, argos::CLightEntity, and argos::CPositionalEntity.

Definition at line 38 of file entity.cpp.

bool argos::CEntity::IsEnabled ( ) const [inline]

Returns true if the entity is enabled.

Returns:
true if the entity is enabled.
See also:
m_bEnabled
m_bCanBeEnabledIfDisabled

Definition at line 229 of file entity.h.

void argos::CEntity::SetCanBeEnabledIfDisabled ( bool  b_can_it) [inline]

Sets whether this entity, once disabled, can be re-enabled.

Returns:
true if this entity, once disabled, can be re-enabled; false otherwise
See also:
m_bEnabled
m_bCanBeEnabledIfDisabled

Definition at line 277 of file entity.h.

void argos::CEntity::SetEnabled ( bool  b_enabled) [virtual]

Enables or disables an entity.

Parameters:
b_enabledtrue if the entity is enabled, false otherwise
See also:
m_bEnabled
m_bCanBeEnabledIfDisabled

Reimplemented in argos::CComposableEntity, and argos::CLEDEntity.

Definition at line 133 of file entity.cpp.

void argos::CEntity::SetParent ( CComposableEntity c_parent) [inline]

Sets this entity's parent.

Parameters:
c_parentThe new parent.

Definition at line 205 of file entity.h.

virtual void argos::CEntity::Update ( ) [inline, virtual]

Updates the state of this entity.

The default implementation of this method does nothing.

Reimplemented in argos::CComposableEntity, argos::CLEDEquippedEntity, argos::CRABEquippedEntity, and argos::CFootBotDistanceScannerEquippedEntity.

Definition at line 221 of file entity.h.


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