ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
Go to the documentation of this file.
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") {
92 else if(it->Value() ==
"ring") {
106 cRingStartAngleRadians,
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);
void Set(const Real f_x, const Real f_y, const Real f_z)
Sets the vector contents from Cartesian coordinates.
SSensor::TList m_tSensors
The list of sensors.
virtual ~CProximitySensorEquippedEntity()
The namespace containing all the ARGoS related code.
const SAnchor & GetAnchor(const std::string &str_id) const
Returns the wanted anchor as a const reference.
It defines the basic type CRadians, used to store an angle value in radians.
Basic class for an entity that contains other entities.
The exception that wraps all errors in ARGoS.
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.
void Enable()
Enables the entity.
CRadians & SignedNormalize()
Normalizes the value in the range [-PI:PI].
CVector3 & RotateZ(const CRadians &c_angle)
Rotates this vector wrt the z axis.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_ENTITY(CEntity)
This entity is a link to a body in the physics engine.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
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 AddSensor(const CVector3 &c_offset, const CVector3 &c_direction, Real f_range, SAnchor &s_anchor)
ticpp::Iterator< ticpp::Element > TConfigurationNodeIterator
The iterator for the ARGoS configuration XML node.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
An anchor related to the body of an entity.
void AddSensorRing(const CVector3 &c_center, Real f_radius, const CRadians &c_start_angle, Real f_range, UInt32 un_num_sensors, SAnchor &s_anchor)
CComposableEntity & GetParent()
Returns this entity's parent.
CVector3 & Normalize()
Normalizes this vector.
unsigned int UInt32
32-bit unsigned integer.
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.
void Disable()
Disables the entity.
void GetNodeAttribute(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer)
Returns the value of a node's attribute.
It defines the basic type CDegrees, used to store an angle value in degrees.
CRadians ToRadians(const CDegrees &c_degrees)
Converts CDegrees to CRadians.
SSensor(const CVector3 &c_offset, const CVector3 &c_direction, Real f_range, SAnchor &s_anchor)
static const CRadians TWO_PI
Set to PI * 2.
float Real
Collects all ARGoS code.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
CProximitySensorEquippedEntity(CComposableEntity *pc_parent)