RoboidControl
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Passer::RoboidControl::Perception Class Reference

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.
 
SensorGetSensor (unsigned int sensorId)
 
SensorFindSensorOfType (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.
 
InterestingThingAddTrackedObject (Sensor *sensor, Spherical position, Quaternion orientation=Quaternion::identity, unsigned char objectId=0x00, unsigned networkId=0x00)
 
InterestingThingAddTrackedObject (Sensor *sensor, unsigned char networkId, unsigned char objectId, Spherical position, Quaternion orientation=Quaternion::identity)
 
bool IsInteresting (float distance)
 
InterestingThingFindTrackedObject (char objectId)
 
InterestingThingFindTrackedObject (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)
 
InterestingThingThingOfType (unsigned char objectType)
 
InterestingThingGetMostInterestingThing ()
 
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

Roboidroboid = 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
 

Detailed Description

Module to which keeps track of objects around the roboid.

Constructor & Destructor Documentation

◆ Perception() [1/2]

Perception::Perception ( )

Default Constructor.

◆ Perception() [2/2]

Perception::Perception ( Sensor **  sensors,
unsigned int  sensorCount 
)

Create a perception setup with the given Sensors.

Parameters
sensorsThe Placement of Sensors on the Roboid
sensorCountThe number of sensors in the placement array

Member Function Documentation

◆ AddSensor()

unsigned int Perception::AddSensor ( Sensor sensor)

◆ GetSensorCount()

unsigned int Perception::GetSensorCount ( )

Get the number of Sensors.

Returns
The number of sensors, zero when no sensors are present

◆ GetSensor()

Sensor * Perception::GetSensor ( unsigned int  sensorId)

◆ FindSensorOfType()

Sensor * Perception::FindSensorOfType ( unsigned int  sensorType)

Find the first sensor of the given type.

Parameters
sensorTypeThe type of sensor as is defined in the Thing class (for example Thing::SensorType)
Returns
The first sensor found or a nullptr which no sensor has been found of the given type

◆ GetDistance() [1/2]

float Passer::RoboidControl::Perception::GetDistance ( float  direction,
float  range = 10.0F 
)

Gets the distance to the closest object.

Parameters
directionThe direction to look for objects
rangeThe range in which objects should be looked for
Returns
The distance to the closest object in meters

◆ GetDistanceOfType()

float Perception::GetDistanceOfType ( unsigned char  thingType,
float  horizontalAngle,
float  range = 10.0F 
)

◆ GetDistance() [2/2]

float Perception::GetDistance ( float  horizontalDirection,
float  verticalDirection,
float  range = 10.0F 
)

Gets the distance to the closest object.

Parameters
horizontalDirectionThe direction in the horizontal plane to look for objects
verticalDirectionThe direction in the vertical plane to look for objects
rangeThe range in which objects should be looked for
Returns
The distance to the closest object in meters

The directions can be thought of as the polar angle (vertical) and azimuthal angle (horizontal) in the spherical coordinate system.

◆ ObjectNearby()

bool Perception::ObjectNearby ( float  direction,
float  range = 10.0F 
)

Checks if an object is nearby.

Parameters
directionThe direction to look for objects
rangeThe range in which objects should be looked for
Returns
True when an object is close, False otherwise

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.

◆ AddTrackedObject() [1/3]

void Passer::RoboidControl::Perception::AddTrackedObject ( Sensor sensor,
Polar  position,
unsigned char  objectType = 0x00,
unsigned char  networkId = 0x00 
)

Checks if an object is nearby.

Parameters
horizontalDirectionThe direction in the horizontal plane to look for objects
verticalDirectionThe direction in the vertical plane to look for objects
rangeThe range in which objects should be looked for
Returns
True when an object is close, False otherwise

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

Parameters
sensorThe sensor which has detected the object
positionThe position of the sensor in polar coordinates local to the roboid

◆ AddTrackedObject() [2/3]

InterestingThing * Perception::AddTrackedObject ( Sensor sensor,
Spherical  position,
Quaternion  orientation = Quaternion::identity,
unsigned char  objectId = 0x00,
unsigned  networkId = 0x00 
)

◆ AddTrackedObject() [3/3]

InterestingThing * Perception::AddTrackedObject ( Sensor sensor,
unsigned char  networkId,
unsigned char  objectId,
Spherical  position,
Quaternion  orientation = Quaternion::identity 
)

◆ IsInteresting()

bool Perception::IsInteresting ( float  distance)

◆ FindTrackedObject() [1/2]

InterestingThing * Perception::FindTrackedObject ( char  objectId)

◆ FindTrackedObject() [2/2]

InterestingThing * Perception::FindTrackedObject ( unsigned char  networkId,
unsigned char  objectId 
)

◆ TrackedObjectCount()

unsigned char Perception::TrackedObjectCount ( )

Retrieve the number of objects currently being tracked by the roboid.

Returns
The object of objects, which is always lower than maxObjectCount

◆ GetTrackedObjects()

InterestingThing ** Perception::GetTrackedObjects ( )

Retreive the objects currently tracked by the roboid.

Returns
An array of current objects

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.

◆ ThingsOfType()

unsigned char Perception::ThingsOfType ( unsigned char  objectType,
InterestingThing buffer[],
unsigned char  bufferSize 
)

◆ ThingOfType()

InterestingThing * Perception::ThingOfType ( unsigned char  objectType)

◆ GetMostInterestingThing()

InterestingThing * Perception::GetMostInterestingThing ( )

◆ Update()

void Perception::Update ( float  currentTimeMs)

Update the state of the perception.

Parameters
currentTimeMsThe 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.

◆ UpdatePose() [1/2]

void Perception::UpdatePose ( Polar  translation)

Update the position/orientation of the preceived objects from the given roboid translation.

Parameters
translationThe 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.

◆ UpdatePose() [2/2]

void Perception::UpdatePose ( Quaternion  rotation)

Update the orientation of the perceived objecst from the given roboid rotation.

Parameters
rotationThe rotation of the roboid in world space

Member Data Documentation

◆ roboid

Roboid* Passer::RoboidControl::Perception::roboid = nullptr

The roboid of this perception system.

◆ nearbyDistance

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

◆ sensors

Sensor** Passer::RoboidControl::Perception::sensors = nullptr

The Sensors used for Perception.

◆ sensorCount

unsigned int Passer::RoboidControl::Perception::sensorCount = 0

The number of Sensors used for Perception.

◆ lastUpdateTimeMs

float Passer::RoboidControl::Perception::lastUpdateTimeMs = 0

◆ lastObjectId

unsigned char Passer::RoboidControl::Perception::lastObjectId = 1

◆ maxObjectCount

unsigned char Perception::maxObjectCount = 7
static

◆ trackedObjects

InterestingThing** Passer::RoboidControl::Perception::trackedObjects

The documentation for this class was generated from the following files: