footbot_distance_scanner_rotzonly_sensor.cpp File Reference
#include "footbot_distance_scanner_rotzonly_sensor.h"
#include <argos3/core/simulator/entity/composable_entity.h>
#include <argos3/core/simulator/entity/controllable_entity.h>
#include <argos3/core/simulator/simulator.h>
#include <argos3/core/simulator/space/space.h>
Include dependency graph for footbot_distance_scanner_rotzonly_sensor.cpp:

Go to the source code of this file.

Namespaces

 argos
 The namespace containing all the ARGoS related code.
 

Macros

#define ADD_READING(RAYS, MAP, INDEX, MINDIST)
 
#define ADD_READINGS(RAYS, MAP, MINDIST)
 
#define CALCULATE_SHORT_RANGE_RAY(ANGLE, INDEX)
 
#define CALCULATE_LONG_RANGE_RAY(ANGLE, INDEX)
 

Functions

 argos::REGISTER_SENSOR (CFootBotDistanceScannerRotZOnlySensor, "footbot_distance_scanner", "rot_z_only", "Carlo Pinciroli [ilpincy@gmail.com]", "1.0", "The foot-bot distance scanner sensor (optimized for 2D).", "This sensor accesses the foot-bot distance scanner sensor. For a complete\n" "description of its usage, refer to the common interface.\n" "In this implementation, the readings are calculated under the assumption that\n" "the foot-bot is always parallel to the XY plane, i.e., it rotates only around\n" "the Z axis. This implementation is faster than a 3D one and should be used\n" "only when the assumption about the foot-bot rotation holds.\n\n" "This sensor is enabled by default.\n\n" "REQUIRED XML CONFIGURATION\n\n" " <controllers>\n" " ...\n" " <my_controller ...>\n" " ...\n" " <sensors>\n" " ...\n" " <footbot_distance_scanner implementation=\"rot_z_only\" />\n" " ...\n" " </sensors>\n" " ...\n" " </my_controller>\n" " ...\n" " </controllers>\n\n" "OPTIONAL XML CONFIGURATION\n\n" "It is possible to draw the rays shot by the distance scanner in the OpenGL\n" "visualization. This can be useful for sensor debugging but also to understand\n" "what's wrong in your controller. In OpenGL, the rays are drawn in cyan when\n" "they are not obstructed and in purple when they are. In case a ray is\n" "obstructed, a black dot is drawn where the intersection occurred.\n" "To turn this functionality on, add the attribute 'show_rays=\"true\"' in the\n" "XML as in this example:\n\n" " <controllers>\n" " ...\n" " <my_controller ...>\n" " ...\n" " <sensors>\n" " ...\n" " <footbot_distance_scanner implementation=\"rot_z_only\"\n" " show_rays=\"true\" />\n" " ...\n" " </sensors>\n" " ...\n" " </my_controller>\n" " ...\n" " </controllers>\n", "Usable")
 

Macro Definition Documentation

◆ ADD_READING

#define ADD_READING (   RAYS,
  MAP,
  INDEX,
  MINDIST 
)
Value:
cAngle += cInterSensorSpan; \
cAngle.SignedNormalize(); \
fReading = CalculateReadingForRay(RAYS[INDEX],MINDIST); \
MAP[cAngle] = fReading; \
m_tReadingsMap[cAngle] = fReading;

Definition at line 153 of file footbot_distance_scanner_rotzonly_sensor.cpp.

◆ ADD_READINGS

#define ADD_READINGS (   RAYS,
  MAP,
  MINDIST 
)
Value:
ADD_READING(RAYS,MAP,1,MINDIST) \
ADD_READING(RAYS,MAP,2,MINDIST) \
ADD_READING(RAYS,MAP,3,MINDIST) \
ADD_READING(RAYS,MAP,4,MINDIST) \
ADD_READING(RAYS,MAP,5,MINDIST)
#define ADD_READING(RAYS, MAP, INDEX, MINDIST)

Definition at line 160 of file footbot_distance_scanner_rotzonly_sensor.cpp.

◆ CALCULATE_LONG_RANGE_RAY

#define CALCULATE_LONG_RANGE_RAY (   ANGLE,
  INDEX 
)
Value:
m_cDirection.RotateZ(ANGLE); \
m_cOriginRayStart = m_cDirection; \
m_cOriginRayEnd = m_cDirection; \
m_cOriginRayStart *= LONG_RANGE_RAY_START; \
m_cOriginRayEnd *= LONG_RANGE_RAY_END; \
m_cRayStart = m_pcEmbodiedEntity->GetOriginAnchor().Position; \
m_cRayStart += m_cOriginRayStart; \
m_cRayStart.SetZ(m_cRayStart.GetZ() + SENSOR_ELEVATION); \
m_cRayEnd = m_pcEmbodiedEntity->GetOriginAnchor().Position; \
m_cRayEnd += m_cOriginRayEnd; \
m_cRayEnd.SetZ(m_cRayEnd.GetZ() + SENSOR_ELEVATION); \
m_cLongRangeRays1[INDEX].Set(m_cRayStart, m_cRayEnd); \
m_cRayStart = m_pcEmbodiedEntity->GetOriginAnchor().Position; \
m_cRayStart -= m_cOriginRayStart; \
m_cRayStart.SetZ(m_cRayStart.GetZ() + SENSOR_ELEVATION); \
m_cRayEnd = m_pcEmbodiedEntity->GetOriginAnchor().Position; \
m_cRayEnd -= m_cOriginRayEnd; \
m_cRayEnd.SetZ(m_cRayEnd.GetZ() + SENSOR_ELEVATION); \
m_cLongRangeRays3[INDEX].Set(m_cRayStart, m_cRayEnd);

Definition at line 257 of file footbot_distance_scanner_rotzonly_sensor.cpp.

◆ CALCULATE_SHORT_RANGE_RAY

#define CALCULATE_SHORT_RANGE_RAY (   ANGLE,
  INDEX 
)
Value:
m_cDirection.RotateZ(ANGLE); \
m_cOriginRayStart = m_cDirection; \
m_cOriginRayEnd = m_cDirection; \
m_cOriginRayStart *= SHORT_RANGE_RAY_START; \
m_cOriginRayEnd *= SHORT_RANGE_RAY_END; \
m_cRayStart = m_pcEmbodiedEntity->GetOriginAnchor().Position; \
m_cRayStart += m_cOriginRayStart; \
m_cRayStart.SetZ(m_cRayStart.GetZ() + SENSOR_ELEVATION); \
m_cRayEnd = m_pcEmbodiedEntity->GetOriginAnchor().Position; \
m_cRayEnd += m_cOriginRayEnd; \
m_cRayEnd.SetZ(m_cRayEnd.GetZ() + SENSOR_ELEVATION); \
m_cShortRangeRays0[INDEX].Set(m_cRayStart, m_cRayEnd); \
m_cRayStart = m_pcEmbodiedEntity->GetOriginAnchor().Position; \
m_cRayStart -= m_cOriginRayStart; \
m_cRayStart.SetZ(m_cRayStart.GetZ() + SENSOR_ELEVATION); \
m_cRayEnd = m_pcEmbodiedEntity->GetOriginAnchor().Position; \
m_cRayEnd -= m_cOriginRayEnd; \
m_cRayEnd.SetZ(m_cRayEnd.GetZ() + SENSOR_ELEVATION); \
m_cShortRangeRays2[INDEX].Set(m_cRayStart, m_cRayEnd); \
\
/* Highly reuse the vectors to speed up the computation */

Definition at line 235 of file footbot_distance_scanner_rotzonly_sensor.cpp.