The ChirpIrSensor class represents the distance sensors on the Chirp robot. More...
#include <irsensor.h>
Public Member Functions | |
ChirpIrSensor (PhysicalObject *robot, QPointF position, float rotationAngle, float reach, float maxValue, float sensorWidth, uint rays) | |
unsigned | value () |
Gets the distance value of the sensor. More... | |
PhysicalObject * | objectHit () |
Gets the closest object hit by the ray. More... | |
void | update () |
Called by the parent robot each step to update the value of the sensor. More... | |
Private Attributes | |
PhysicalObject * | _parentBody |
QPointF | _position |
float | _maxDistance |
float | _maxValue |
QVector< float > | _fractions |
float | _baseAngle |
float | _sensorWidth |
uint | _rays |
IrSensorRayCastCallback | _callback |
The ChirpIrSensor class represents the distance sensors on the Chirp robot.
These are infrared LEDs with a phototransistor to measure reflected light from the LEDs. It gives a measure of distance from an object, but requires close proximity before the value changes much.
|
explicit |
References _baseAngle, _fractions, _maxDistance, _maxValue, _parentBody, _position, _rays, _sensorWidth, and DEGTORAD.
|
virtual |
Gets the closest object hit by the ray.
Implements Sensor.
References _callback, and IrSensorRayCastCallback::objectHit().
|
virtual |
Called by the parent robot each step to update the value of the sensor.
Implements Sensor.
References _baseAngle, _callback, _fractions, _maxDistance, _parentBody, _position, _rays, _sensorWidth, PhysicalObject::body(), IrSensorRayCastCallback::fraction(), and IrSensorRayCastCallback::reset().
|
virtual |
Gets the distance value of the sensor.
Implements Sensor.
References _fractions, _maxValue, clamp(), and max().
|
private |
Referenced by ChirpIrSensor(), and update().
|
private |
Referenced by objectHit(), and update().
|
private |
Referenced by ChirpIrSensor(), update(), and value().
|
private |
Referenced by ChirpIrSensor(), and update().
|
private |
Referenced by ChirpIrSensor(), and value().
|
private |
Referenced by ChirpIrSensor(), and update().
|
private |
Referenced by ChirpIrSensor(), and update().
|
private |
Referenced by ChirpIrSensor(), and update().
|
private |
Referenced by ChirpIrSensor(), and update().