8 #include <argos3/core/simulator/space/space.h>
9 #include <argos3/core/simulator/entity/composable_entity.h>
21 Direction(c_direction),
39 const std::string& str_id) :
67 if(t_tree.NoChildren()) {
72 for(it = it.begin(&t_tree); it != it.end(); ++it) {
73 std::string strAnchorId;
84 if(it->Value() ==
"sensor") {
90 AddSensor(cOff, cDir, fRange, cBody.GetAnchor(strAnchorId));
92 else if(it->Value() ==
"ring") {
106 cRingStartAngleRadians,
109 cBody.GetAnchor(strAnchorId));
126 for(
size_t i = 0; i <
m_tSensors.size(); ++i) {
136 for(
size_t i = 0; i <
m_tSensors.size(); ++i) {
163 for(
UInt32 i = 0; i < un_num_sensors; ++i) {
164 cAngle = c_start_angle + i * cSensorSpacing;
166 cOff.
Set(f_radius, 0.0f, 0.0f);
169 cDir.
Set(f_range, 0.0f, 0.0f);
171 AddSensor(cOff, cDir, f_range, s_anchor);
185 CRadians cSensorSpacing = (c_end_angle - c_start_angle) / (un_num_sensors - 1);
188 for(
UInt32 i = 0; i < un_num_sensors; ++i) {
189 cAngle = c_start_angle + i * cSensorSpacing;
191 cOff.
Set(f_radius, 0.0f, 0.0f);
194 cDir.
Set(f_range, 0.0f, 0.0f);
196 AddSensor(cOff, cDir, f_range, s_anchor);
#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.
void GetNodeAttributeOrDefault(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer, const T &t_default)
Returns the value of a node's attribute, or the passed default value.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
CRadians ToRadians(const CDegrees &c_degrees)
Converts CDegrees to CRadians.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_ENTITY(CEntity)
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.
This entity is a link to a body in the physics engine.
void Disable()
Disables the 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.
static const CRadians TWO_PI
Set to PI * 2.
CRadians & SignedNormalize()
Normalizes the value in the range [-PI:PI].
It defines the basic type CDegrees, used to store an angle value in degrees.
CVector3 & Normalize()
Normalizes this vector.
void Set(const Real f_x, const Real f_y, const Real f_z)
Sets the vector contents from Cartesian coordinates.
CVector3 & RotateZ(const CRadians &c_angle)
Rotates this vector wrt the z axis.
void AddSensorFan(const CVector3 &c_center, Real f_radius, const CRadians &c_start_angle, const CRadians &c_end_angle, Real f_range, UInt32 un_num_sensors, SAnchor &s_anchor)
void AddSensorRing(const CVector3 &c_center, Real f_radius, const CRadians &c_start_angle, Real f_range, UInt32 un_num_sensors, SAnchor &s_anchor)
CProximitySensorEquippedEntity(CComposableEntity *pc_parent)
SSensor::TList m_tSensors
The list of sensors.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
virtual ~CProximitySensorEquippedEntity()
void AddSensor(const CVector3 &c_offset, const CVector3 &c_direction, Real f_range, SAnchor &s_anchor)
SSensor(const CVector3 &c_offset, const CVector3 &c_direction, Real f_range, SAnchor &s_anchor)