#include <IRSensor.h>
Inheritance diagram for Enki::IRSensor:

Public Member Functions | |
| IRSensor (Robot *owner, An::Vector pos, double height, double orientation, double range, double aperture, unsigned rayCount, SensorResponseFunctor **sensorResponseKernel) | |
| Constructor e.g. | |
| void | init () |
| Reset distance values. | |
| void | objectStep (double dt, PhysicalObject *po, World *w) |
| Check for all potential intersections using smartRadius of sensor and calculate and find closest distance for each ray. | |
| void | wallsStep (World *w) |
| Separated from objectStep because it is much simpler. | |
| void | finalize (double dt) |
| Applies the SensorResponseFunction to each ray and combines all rays using weights defined in the rayCombinationKernel. | |
| An::Point | getAbsolutePosition (void) |
| Return the absolute position of the IR sensor, updated at each time step on init(). | |
| double | getAbsoluteOrientation (void) |
| Return the absolute orientation of the IR sensor, updated at each time step on init(). | |
| unsigned | getRayCount (void) |
| Return the number of rays. | |
| double | getAperture (void) |
| Return the aperture of the sensor. | |
| double | getRange (void) |
| Return the range of the sensor. | |
| double | getSmartRadius (void) |
| Return the radius for the smallest circle enclosing all rays. | |
| An::Point | getAbsSmartPos (void) |
| Return current position of the center of the smartRadius, i.e. center of the smallest circle enclosing all rays in relative (robot) coordinates. | |
Public Attributes | |
| double | finalValue |
| Final sensor value. | |
Protected Attributes | |
| An::Vector | absPos |
| Absolute position in the world, updated on init(). | |
| double | absOrientation |
| Absolute orientation in the world, updated on init(). | |
| An::Vector | pos |
| Relative position on the robot. | |
| double | height |
| Height above ground, the sensor will not see any object of smaller height. | |
| double | orientation |
| Relative orientation on the robot. | |
| double | range |
| Actual detection range. | |
| double | aperture |
| Aperture angle. | |
| unsigned | rayCount |
| Number of rays used, each ray has an aperture of aperture/rayCount to the next one. Rays are assembled from right to left (i.e. counterclockwise). | |
| std::valarray< SensorResponseFunctor * > | sensorResponseKernel |
| Array of size rayCount used to compute the response of different rays using implementations of SensorResponseFunctor functors. | |
| double | smartRadius |
| Radius for the smallest circle enclosing all rays. | |
| An::Point | smartPos |
| Current position of the center of the smartRadius, i.e. center of the smallest circle enclosing all rays in relative (robot) coordinates. | |
| An::Vector | absSmartPos |
| Current position of the center of the smartRadius in absolute (world) coordinates, updated on init(). | |
| std::valarray< double > | rayValues |
| Temporary ray values containing the lowest distance found up to now. | |
| std::valarray< An::Color > | rayColors |
| Temporary ray values containing the color of the closest segment up to now. | |
| std::valarray< double > | rayAngles |
| The angle for each ray relative to the sensor orientation in relative (robot) coordinates. | |
| std::valarray< double > | absRayAngles |
| The angle for each ray relative to the sensor orientation in absolute (world) coordinates. | |
Private Member Functions | |
| double | distanceToPolygon (double rayAngle, const An::Polygone &p) const |
| Returns distance to PhysicalObject po for angle rayAngle. | |
|
||||||||||||||||||||||||||||||||||||
|
Constructor e.g. : "left(this, Vector (0.95, 0.95), 1.2, M_PI/4, 2.5, M_PI/6, 3, AliceIRNormalSensorModel)" i.e. for left: position on bot is x=0.95, y=0.95 from center of bot, height of sensor is 1.2, looking 45 deg to the left, +/-30 deg opening angle, 3cm max sensor range, a raycount of 3, SensorResponseFunctor in AliceIRNormalSensorModel array |
|
||||||||||||
|
Returns distance to PhysicalObject po for angle rayAngle. Note: The polygon MUST be convex and have vertices oriented counterclockwise (ccw). This code does not check for and verify these conditions. Returns distance to shortest intersection point or HUGE_VAL if there is no intersection |
|
|
Array of size rayCount used to compute the response of different rays using implementations of SensorResponseFunctor functors. SensorResponseFunctors translate the distances stored in the rayValues[] into actual sensor activations. Distances are in cm. For negative distance values, i.e. a sensor inside an object, wall, etc., the value of the sensor response function at distance 0 will be used. If a ray fails to touch the object, the distance returned will be HUGE_VAL; the sensor response function should typically return a 0 sensor activation for this case. An appropriate noise model (if realistic modelling is desired) should be included in the sensor response function. |
1.4.2