34 #ifndef __ENKI_IRSENSOR_H 35 #define __ENKI_IRSENSOR_H 149 IRSensor(
Robot *
owner,
Vector pos,
double height,
double orientation,
double range,
double m,
double x0,
double c,
double noiseSd = 0.);
166 double getRayDist(
unsigned i)
const {
return rayDists.at(i); }
A vector in a 2D space.
Definition: Geometry.h:68
Point getAbsolutePosition(void) const
Return the absolute position of the IR sensor, updated at each time step on init() ...
Definition: IRSensor.h:169
A situated object in the world with mass, geometry properties, physical properties, ...
Definition: PhysicalEngine.h:131
double getSmartRadius(void) const
Return the radius for the smallest circle enclosing all rays.
Definition: IRSensor.h:179
double getAperture(void) const
Return the aperture of the sensor.
Definition: IRSensor.h:175
IRSensor(Robot *owner, Vector pos, double height, double orientation, double range, double m, double x0, double c, double noiseSd=0.)
Constructor.
Definition: IRSensor.cpp:49
double getRayDist(unsigned i) const
Return the distance of a ray.
Definition: IRSensor.h:166
double finalDist
Final computed distance.
Definition: IRSensor.h:134
const double c
Third parameter of response function.
Definition: IRSensor.h:112
const 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)
Definition: IRSensor.h:106
double absOrientation
Absolute orientation in the world, updated on init()
Definition: IRSensor.h:92
Point smartPos
Current position of the center of the smartRadius, i.e. center of the smallest circle enclosing all r...
Definition: IRSensor.h:119
Enki is the namespace of the Enki simulator. All Enki functions and classes excepted the math one are...
Definition: BluetoothBase.cpp:44
Vector absPos
Absolute position in the world, updated on init()
Definition: IRSensor.h:90
double getDist(void) const
Return the distance through the inverse response of the final sensor value.
Definition: IRSensor.h:162
std::vector< double > absRayAngles
The angle for each ray relative to the sensor orientation in absolute (world) coordinates.
Definition: IRSensor.h:129
Robot * owner
The physical object that owns the interaction.
Definition: Interaction.h:62
const double range
Actual detection range.
Definition: IRSensor.h:100
The interfaces for the interactions.
void init(double dt, World *w)
Reset distance values.
Definition: IRSensor.cpp:87
double getValue(void) const
Return the final sensor value.
Definition: IRSensor.h:160
const double alpha
1/cos(aperture)
Definition: IRSensor.h:104
const Vector pos
Relative position on the robot.
Definition: IRSensor.h:94
unsigned getRayCount(void) const
Return the number of rays.
Definition: IRSensor.h:173
double responseFunction(double x) const
Return the response for a given distance.
Definition: IRSensor.cpp:280
double inverseResponseFunction(double v) const
Return the inverse response for a given distance.
Definition: IRSensor.cpp:292
void objectStep(double dt, World *w, PhysicalObject *po)
Check for all potential intersections using smartRadius of sensor and calculate and find closest dist...
Definition: IRSensor.cpp:107
const double m
Maximum possible response value, might be inside the robot if x0<0, first parameter of response funct...
Definition: IRSensor.h:108
const double x0
Position of the maximum of response (might be negative, inside the robot), second parametere of respo...
Definition: IRSensor.h:110
double getRange(void) const
Return the range of the sensor.
Definition: IRSensor.h:177
void wallsStep(double dt, World *w)
Separated from objectStep because it is much simpler.
Definition: IRSensor.cpp:180
The world is the container of all objects and robots.
Definition: PhysicalEngine.h:411
A generic infrared sensor.
Definition: IRSensor.h:86
const double height
Height above ground, the sensor will not see any object of smaller height.
Definition: IRSensor.h:96
std::vector< double > rayDists
Temporary ray values containing the lowest distance found up to now.
Definition: IRSensor.h:123
double finalValue
Final sensor value.
Definition: IRSensor.h:132
double getAbsoluteOrientation(void) const
Return the absolute orientation of the IR sensor, updated at each time step on init() ...
Definition: IRSensor.h:171
void finalize(double dt, World *w)
Applies the SensorResponseFunction to each ray and combines all rays using weights defined in the ray...
Definition: IRSensor.cpp:261
void updateRay(size_t i, double dist)
If dist is smaller than current ray distance, update distance and response value. ...
Definition: IRSensor.cpp:268
Polygone, which is a vector of points. Anti-clockwise, standard trigonometric orientation.
Definition: Geometry.h:238
std::vector< double > rayValues
Temporary ray values containing the response value of the closest object found up to now...
Definition: IRSensor.h:125
const double orientation
Relative orientation on the robot.
Definition: IRSensor.h:98
Interacts with another object or wall only up to a certain distance.
Definition: Interaction.h:53
const double aperture
Aperture angle.
Definition: IRSensor.h:102
Vector absSmartPos
Current position of the center of the smartRadius in absolute (world) coordinates, updated on init()
Definition: IRSensor.h:121
double smartRadius
Radius for the smallest circle enclosing all rays.
Definition: IRSensor.h:117
double distanceToPolygon(double rayAngle, const Polygone &p) const
Returns distance to PhysicalObject po for angle rayAngle.
Definition: IRSensor.cpp:323
double getRayValue(unsigned i) const
Return the value of a ray.
Definition: IRSensor.h:164
std::vector< double > rayAngles
The angle for each ray relative to the sensor orientation in relative (robot) coordinates.
Definition: IRSensor.h:127
A robot is a PhysicalObject that has additional interactions and a controller.
Definition: PhysicalEngine.h:379
Point getAbsSmartPos(void) const
Return current position of the center of the smartRadius, i.e. center of the smallest circle enclosin...
Definition: IRSensor.h:181
const double noiseSd
Standard deviation of Gaussian noise in the response space.
Definition: IRSensor.h:114