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;
76 cBody.GetAnchor(strAnchorId),
97 s_instance.Anchor.Enable();
109 s_instance.Anchor.Disable();
122 const std::string& str_payload) {
147 "CTagEquippedEntity::GetTag(), id=\"" <<
149 "\": index out of bounds: un_index = " <<
151 ", m_vecInstances.size() = " <<
160 const std::string& str_payload) {
162 "CTagEquippedEntity::SetTagPayload(), id=\"" <<
164 "\": index out of bounds: un_index = " <<
166 ", m_vecInstances.size() = " <<
176 s_instance.Tag.SetPayload(str_payload);
185 for(
UInt32 i = 0; i < vec_payloads.size(); ++i) {
191 "CTagEquippedEntity::SetTagPayloads(), id=\"" <<
193 "\": number of tags (" <<
195 ") does not equal the passed payload vector size (" <<
196 vec_payloads.size() <<
209 if(s_instance.Tag.IsEnabled()) {
210 cTagPosition = s_instance.PositionOffset;
211 cTagPosition.
Rotate(s_instance.Anchor.Orientation);
212 cTagPosition += s_instance.Anchor.Position;
213 cTagOrientation = s_instance.Anchor.Orientation *
214 s_instance.OrientationOffset;
215 s_instance.Tag.MoveTo(cTagPosition, cTagOrientation);
225 s_instance.Tag.SetMedium(c_medium);
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
unsigned int UInt32
32-bit unsigned integer.
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
ticpp::Iterator< ticpp::Element > TConfigurationNodeIterator
The iterator for the ARGoS configuration XML node.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_COMPOSABLE(CComposableEntity)
void GetNodeAttribute(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer)
Returns the value of a node's attribute.
Basic class for an entity that contains other entities.
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.
void AddComponent(CEntity &c_component)
Adds a component to this composable entity.
This entity is a link to a body in the physics engine.
void Disable()
Disables the entity.
const std::string & GetId() const
Returns the id of this entity.
std::string GetContext() const
Returns the context of this entity.
void Enable()
Enables the entity.
CComposableEntity & GetParent()
Returns this entity's parent.
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.
The exception that wraps all errors in ARGoS.
It defines the basic type CRadians, used to store an angle value in radians.
CVector3 & Rotate(const CQuaternion &c_quaternion)
Rotates this vector by the given quaternion.
A container of CTagEntity.
virtual void UpdateComponents()
Calls the Update() method on all the components.
void SetMedium(CTagMedium &c_medium)
Sets the medium associated to this entity.
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 SetTagPayload(UInt32 un_index, const std::string &str_payload)
Sets the payload of a tag.
SInstance::TVector m_vecInstances
List of the tags managed by this entity.
void AddTag(const std::string &str_id, const CVector3 &c_position, const CQuaternion &c_orientation, SAnchor &s_anchor, const CRadians &c_observable_angle, Real f_side_length, const std::string &str_payload)
Programmatically creates a new tag.
CTagEquippedEntity(CComposableEntity *pc_parent)
Class constructor.
void SetTagPayloads(const std::string &str_payload)
Sets the payload of all the tags to the given payload.
SInstance(CTagEntity &c_tag, SAnchor &s_anchor, const CVector3 &c_position_offset, const CQuaternion &c_orientation_offset)