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\ "description of its usage, refer to the common interface.\" "In this implementation, the readings are calculated under the assumption that\" "the foot-bot is always parallel to the XY plane, i.e., it rotates only around\" "the Z axis. This implementation is faster than a 3D one and should be used\" "only when the assumption about the foot-bot rotation holds.\\" "REQUIRED XML CONFIGURATION\\" "< controllers >\" " ...\" "< my_controller ... >\" " ...\" "< sensors >\" " ...\" "< footbot_distance_scanner implementation=\rot_z_only\/>\" " ...\" "</sensors >\" " ...\" "</my_controller >\" " ...\" "</controllers >\\" "OPTIONAL XML CONFIGURATION\\" "It is possible to draw the rays shot by the distance scanner in the OpenGL\" "visualization. This can be useful for sensor debugging but also to understand\" "what 's wrong in your controller. In OpenGL, the rays are drawn in cyan when\" "they are not obstructed and in purple when they are. In case a ray is\" "obstructed, a black dot is drawn where the intersection occurred.\" "To turn this functionality on, add the attribute 'show_rays=\true\' in the\" "XML as in this example:\\" "< controllers >\" " ...\" "< my_controller ... >\" " ...\" "< sensors >\" " ...\" "< footbot_distance_scanner implementation=\rot_z_only\\" " show_rays=\true\/>\" " ...\" "</sensors >\" " ...\" "</my_controller >\" " ...\" "</controllers >\", "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 146 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 153 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 250 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 228 of file footbot_distance_scanner_rotzonly_sensor.cpp.