8 #include <argos3/core/simulator/simulator.h>
9 #include <argos3/core/simulator/space/space.h>
10 #include <argos3/plugins/simulator/media/tag_medium.h>
23 PositionOffset(c_position_offset),
24 OrientationOffset(c_orientation_offset) {}
38 const std::string& str_id) :
52 for(itTag = itTag.begin(&t_tree);
63 std::string strAnchorId;
97 s_instance.Anchor.Enable();
109 s_instance.Anchor.Disable();
118 "CTagEquippedEntity::GetTag(), id=\"" <<
120 "\": index out of bounds: un_index = " <<
122 ", m_vecInstances.size() = " <<
131 const std::string& str_payload) {
133 "CTagEquippedEntity::SetTagPayload(), id=\"" <<
135 "\": index out of bounds: un_index = " <<
137 ", m_vecInstances.size() = " <<
147 s_instance.Tag.SetPayload(str_payload);
156 for(
UInt32 i = 0; i < vec_payloads.size(); ++i) {
162 "CTagEquippedEntity::SetTagPayloads(), id=\"" <<
164 "\": number of tags (" <<
166 ") does not equal the passed payload vector size (" <<
167 vec_payloads.size() <<
180 if(s_instance.Tag.IsEnabled()) {
181 cTagPosition = s_instance.PositionOffset;
182 cTagPosition.
Rotate(s_instance.Anchor.Orientation);
183 cTagPosition += s_instance.Anchor.Position;
184 cTagOrientation = s_instance.Anchor.Orientation *
185 s_instance.OrientationOffset;
186 s_instance.Tag.MoveTo(cTagPosition, cTagOrientation);
196 s_instance.Tag.SetMedium(c_medium);
void SetTagPayload(UInt32 un_index, const std::string &str_payload)
Sets the payload of a tag.
void Enable()
Enables the entity.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
void SetMedium(CTagMedium &c_medium)
Sets the medium associated to this entity.
CVector3 & Rotate(const CQuaternion &c_quaternion)
Rotates this vector by the given quaternion.
A container of CTagEntity.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
This entity is a link to a body in the physics engine.
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception...
SInstance(CTagEntity &c_tag, SAnchor &s_anchor, const CVector3 &c_position_offset, const CQuaternion &c_orientation_offset)
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
unsigned int UInt32
32-bit unsigned integer.
Basic class for an entity that contains other entities.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
An anchor related to the body of an entity.
SInstance::TVector m_vecInstances
List of the tags managed by this entity.
void AddComponent(CEntity &c_component)
Adds a component to this composable entity.
ticpp::Iterator< ticpp::Element > TConfigurationNodeIterator
The iterator for the ARGoS configuration XML node.
void GetNodeAttribute(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer)
Returns the value of a node's attribute.
The exception that wraps all errors in ARGoS.
CTagEntity & GetTag(UInt32 un_index)
Returns a tag by numeric index.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
void Disable()
Disables the entity.
CTagEquippedEntity(CComposableEntity *pc_parent)
Class constructor.
const SAnchor & GetAnchor(const std::string &str_id) const
Returns the wanted anchor as a const reference.
const std::string & GetId() const
Returns the id of this entity.
CComposableEntity & GetParent()
Returns this entity's parent.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_COMPOSABLE(CComposableEntity)
The namespace containing all the ARGoS related code.
std::string GetContext() const
Returns the context of this entity.
virtual void UpdateComponents()
Calls the Update() method on all the components.
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.
void SetTagPayloads(const std::string &str_payload)
Sets the payload of all the tags to the given payload.