RoboidControl
|
Module to which keeps track of objects around the roboid. More...
#include <Perception.h>
Public Member Functions | |
Perception () | |
Default Constructor. | |
Perception (Sensor **sensors, unsigned int sensorCount) | |
Create a perception setup with the given Sensors. | |
unsigned int | AddSensor (Sensor *sensor) |
unsigned int | GetSensorCount () |
Get the number of Sensors. | |
Sensor * | GetSensor (unsigned int sensorId) |
Sensor * | FindSensorOfType (unsigned int sensorType) |
Find the first sensor of the given type. | |
float | GetDistance (float direction, float range=10.0F) |
Gets the distance to the closest object. | |
float | GetDistanceOfType (unsigned char thingType, float horizontalAngle, float range=10.0F) |
float | GetDistance (float horizontalDirection, float verticalDirection, float range=10.0F) |
Gets the distance to the closest object. | |
bool | ObjectNearby (float direction, float range=10.0F) |
Checks if an object is nearby. | |
void | AddTrackedObject (Sensor *sensor, Polar position, unsigned char objectType=0x00, unsigned char networkId=0x00) |
Checks if an object is nearby. | |
InterestingThing * | AddTrackedObject (Sensor *sensor, Spherical position, Quaternion orientation=Quaternion::identity, unsigned char objectId=0x00, unsigned networkId=0x00) |
InterestingThing * | AddTrackedObject (Sensor *sensor, unsigned char networkId, unsigned char objectId, Spherical position, Quaternion orientation=Quaternion::identity) |
bool | IsInteresting (float distance) |
InterestingThing * | FindTrackedObject (char objectId) |
InterestingThing * | FindTrackedObject (unsigned char networkId, unsigned char objectId) |
unsigned char | TrackedObjectCount () |
Retrieve the number of objects currently being tracked by the roboid. | |
InterestingThing ** | GetTrackedObjects () |
Retreive the objects currently tracked by the roboid. | |
unsigned char | ThingsOfType (unsigned char objectType, InterestingThing *buffer[], unsigned char bufferSize) |
InterestingThing * | ThingOfType (unsigned char objectType) |
InterestingThing * | GetMostInterestingThing () |
void | Update (float currentTimeMs) |
Update the state of the perception. | |
void | UpdatePose (Polar translation) |
Update the position/orientation of the preceived objects from the given roboid translation. | |
void | UpdatePose (Quaternion rotation) |
Update the orientation of the perceived objecst from the given roboid rotation. | |
Public Attributes | |
Roboid * | roboid = nullptr |
The roboid of this perception system. | |
float | nearbyDistance = 0.02F |
Objects with a distance closed that this value will be considered nearby. | |
Sensor ** | sensors = nullptr |
The Sensors used for Perception. | |
unsigned int | sensorCount = 0 |
The number of Sensors used for Perception. | |
float | lastUpdateTimeMs = 0 |
unsigned char | lastObjectId = 1 |
InterestingThing ** | trackedObjects |
Static Public Attributes | |
static unsigned char | maxObjectCount = 7 |
Module to which keeps track of objects around the roboid.
Perception::Perception | ( | ) |
Default Constructor.
Perception::Perception | ( | Sensor ** | sensors, |
unsigned int | sensorCount | ||
) |
Create a perception setup with the given Sensors.
sensors | The Placement of Sensors on the Roboid |
sensorCount | The number of sensors in the placement array |
unsigned int Perception::AddSensor | ( | Sensor * | sensor | ) |
unsigned int Perception::GetSensorCount | ( | ) |
Get the number of Sensors.
Sensor * Perception::GetSensor | ( | unsigned int | sensorId | ) |
Sensor * Perception::FindSensorOfType | ( | unsigned int | sensorType | ) |
Find the first sensor of the given type.
sensorType | The type of sensor as is defined in the Thing class (for example Thing::SensorType) |
float Passer::RoboidControl::Perception::GetDistance | ( | float | direction, |
float | range = 10.0F |
||
) |
Gets the distance to the closest object.
direction | The direction to look for objects |
range | The range in which objects should be looked for |
float Perception::GetDistanceOfType | ( | unsigned char | thingType, |
float | horizontalAngle, | ||
float | range = 10.0F |
||
) |
float Perception::GetDistance | ( | float | horizontalDirection, |
float | verticalDirection, | ||
float | range = 10.0F |
||
) |
Gets the distance to the closest object.
horizontalDirection | The direction in the horizontal plane to look for objects |
verticalDirection | The direction in the vertical plane to look for objects |
range | The range in which objects should be looked for |
The directions can be thought of as the polar angle (vertical) and azimuthal angle (horizontal) in the spherical coordinate system.
bool Perception::ObjectNearby | ( | float | direction, |
float | range = 10.0F |
||
) |
Checks if an object is nearby.
direction | The direction to look for objects |
range | The range in which objects should be looked for |
Wether an object is closeby depends on the sensor. This can be a sensor like a Switch or a DistanceSensor. The latter uses the DistanceSensor::triggerDistance to check if an object is nearby.
void Passer::RoboidControl::Perception::AddTrackedObject | ( | Sensor * | sensor, |
Polar | position, | ||
unsigned char | objectType = 0x00 , |
||
unsigned char | networkId = 0x00 |
||
) |
Checks if an object is nearby.
horizontalDirection | The direction in the horizontal plane to look for objects |
verticalDirection | The direction in the vertical plane to look for objects |
range | The range in which objects should be looked for |
Wether an object is closeby depends on the sensor. This can be a sensor like a Switch or a DistanceSensor. The latter uses the DistanceSensor::triggerDistance to check if an object is nearby.
The directions can be thought of as the polar angle (vertical) and azimuthal angle (horizontal) in the spherical coordinate system.
Add or update an object detected by the given sensor
sensor | The sensor which has detected the object |
position | The position of the sensor in polar coordinates local to the roboid |
InterestingThing * Perception::AddTrackedObject | ( | Sensor * | sensor, |
Spherical | position, | ||
Quaternion | orientation = Quaternion::identity , |
||
unsigned char | objectId = 0x00 , |
||
unsigned | networkId = 0x00 |
||
) |
InterestingThing * Perception::AddTrackedObject | ( | Sensor * | sensor, |
unsigned char | networkId, | ||
unsigned char | objectId, | ||
Spherical | position, | ||
Quaternion | orientation = Quaternion::identity |
||
) |
bool Perception::IsInteresting | ( | float | distance | ) |
InterestingThing * Perception::FindTrackedObject | ( | char | objectId | ) |
InterestingThing * Perception::FindTrackedObject | ( | unsigned char | networkId, |
unsigned char | objectId | ||
) |
unsigned char Perception::TrackedObjectCount | ( | ) |
Retrieve the number of objects currently being tracked by the roboid.
InterestingThing ** Perception::GetTrackedObjects | ( | ) |
Retreive the objects currently tracked by the roboid.
The returned array this should never be a nullptr, but each array entry may be a nullptr when less than maxObjectCount objects is currently being tracked.
unsigned char Perception::ThingsOfType | ( | unsigned char | objectType, |
InterestingThing * | buffer[], | ||
unsigned char | bufferSize | ||
) |
InterestingThing * Perception::ThingOfType | ( | unsigned char | objectType | ) |
InterestingThing * Perception::GetMostInterestingThing | ( | ) |
void Perception::Update | ( | float | currentTimeMs | ) |
Update the state of the perception.
currentTimeMs | The current time in milliseconds |
This will update the perceptoin of object. It will retrieve the latest state for each sensor and update the confidence of the tracked objects.
void Perception::UpdatePose | ( | Polar | translation | ) |
Update the position/orientation of the preceived objects from the given roboid translation.
translation | The translation of the roboid in world space in polar coordinates |
This function will be called through Roboid::SetPosition. It is advised to use that function to update the roboid position instead of this function.
void Perception::UpdatePose | ( | Quaternion | rotation | ) |
Update the orientation of the perceived objecst from the given roboid rotation.
rotation | The rotation of the roboid in world space |
Roboid* Passer::RoboidControl::Perception::roboid = nullptr |
The roboid of this perception system.
float Passer::RoboidControl::Perception::nearbyDistance = 0.02F |
Objects with a distance closed that this value will be considered nearby.
This value is used by the ObjectNearby function to select the objects
Sensor** Passer::RoboidControl::Perception::sensors = nullptr |
The Sensors used for Perception.
unsigned int Passer::RoboidControl::Perception::sensorCount = 0 |
The number of Sensors used for Perception.
float Passer::RoboidControl::Perception::lastUpdateTimeMs = 0 |
unsigned char Passer::RoboidControl::Perception::lastObjectId = 1 |
|
static |
InterestingThing** Passer::RoboidControl::Perception::trackedObjects |