RoboidControl for Arduino
Loading...
Searching...
No Matches
Public Member Functions | Protected 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.
 
template<unsigned int sensorCount>
 Perception (Placement(&sensors)[sensorCount])
 Template to make it possible to leave out ths sensorCount.
 
 Perception (Placement *sensors, unsigned int sensorCount)
 Create a perception setup with the given Sensors.
 
unsigned int GetSensorCount ()
 Get the number of Sensors.
 
SensorGetSensor (unsigned int sensorIx)
 Get a specific Sensor on the Roboid.
 
PlacementGetSensorPlacement (unsigned int sensorIx)
 Get the placement of a specific Sensor.
 
float DistanceForward (float direction=90)
 Distance to the closest object on the front of the Roboid.
 
float DistanceLeft ()
 Distance to the closest object on the left.
 
float DistanceLeft (float angle)
 Distance to the closest object on the left.
 
float DistanceRight ()
 Distance to the closest object on the right.
 
float DistanceRight (float angle)
 Distance to the closest object on the right.
 
float DistanceUp ()
 Distance to the closest object above the Roboid.
 
float DistanceUp (float angle)
 Distance to the closest object above the Roboid within the give range.
 
float DistanceDown ()
 Disatnce to the closest object under the Roboid.
 
float DistanceDown (float angle)
 Distance to the closest object under th4e Roboid within the given range.
 
bool SwitchOn (float fromAngle, float toAngle)
 Checks if an object is close within the give range in the horizontal plane.
 

Protected Attributes

PlacementsensorPlacements = nullptr
 The Placement of the Sensors used for Perception.
 
unsigned int sensorCount = 0
 The number of Sensors used for Perception.
 

Detailed Description

Module to which keeps track of objects around the roboid.

Constructor & Destructor Documentation

◆ Perception() [1/3]

Perception::Perception ( )

Default Constructor.

◆ Perception() [2/3]

template<unsigned int sensorCount>
Passer::RoboidControl::Perception::Perception ( Placement(&)  sensors[sensorCount])
inline

Template to make it possible to leave out ths sensorCount.

Template Parameters
sensorCount
Parameters
sensorsAn array of sensor placements

◆ Perception() [3/3]

Perception::Perception ( Placement 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

◆ 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  sensorIx)

Get a specific Sensor on the Roboid.

Parameters
sensorIdThe index of the Sensor
Returns
The requested Sensor or a nullptr when no Sensor with the given index could be found

◆ GetSensorPlacement()

Placement * Passer::RoboidControl::Perception::GetSensorPlacement ( unsigned int  sensorIx)

Get the placement of a specific Sensor.

Parameters
motorIxThe index of the Sensor
Returns
Returns the Placement or a nullptr when no Placement with the given index could be found

◆ DistanceForward()

float Perception::DistanceForward ( float  direction = 90)

Distance to the closest object on the front of the Roboid.

Parameters
directionThe direction relative to the forward direction in which the object should be present
Returns
The distance to the closest object within the given range, INFINITY when no object is detected

◆ DistanceLeft() [1/2]

float Passer::RoboidControl::Perception::DistanceLeft ( )
inline

Distance to the closest object on the left.

Returns
distance in meters, INFINITY when no object is detected.
Note
An object is on the left when the angle is between -180 and 0 degrees.
An object dead straight (0 degrees) is not reported.

◆ DistanceLeft() [2/2]

float Perception::DistanceLeft ( float  angle)

Distance to the closest object on the left.

Parameters
anglethe maximum angle on the left used for detection.
Returns
distance in meters, INFINITY when no object is detected.
Note
An object is on the left when the angle is between -angle and 0 degrees.
An object dead straight (0 degrees) is not reported.
When an object is beyond angle meters, it is not reported.

◆ DistanceRight() [1/2]

float Passer::RoboidControl::Perception::DistanceRight ( )
inline

Distance to the closest object on the right.

Returns
distance in meters, INFINITY when no object is detected
Note
An object is on the right when the angle is between 0 and 180 degrees
An object dead straight (0 degrees) is not reported

◆ DistanceRight() [2/2]

float Perception::DistanceRight ( float  angle)

Distance to the closest object on the right.

Parameters
anglethe maximum angle on the left used for detection.
Returns
distance in meters, INFINITY when no object is detected
Note
An object is on the left when the angle is between 0 and angle degrees.
An object dead straight (0 degrees) is not reported.
When an object is beyond angle meters, it is not reported.

◆ DistanceUp() [1/2]

float Passer::RoboidControl::Perception::DistanceUp ( )
inline

Distance to the closest object above the Roboid.

Returns
distance in meters, INFINITY when no object is detected

◆ DistanceUp() [2/2]

float Perception::DistanceUp ( float  angle)

Distance to the closest object above the Roboid within the give range.

Parameters
angleThe angle relative to the upward direction to indicate the range
Returns
distance in meters, INFINITY when no object is detected

◆ DistanceDown() [1/2]

float Passer::RoboidControl::Perception::DistanceDown ( )
inline

Disatnce to the closest object under the Roboid.

Returns
distance in meters, INFINITY when no object is detected

◆ DistanceDown() [2/2]

float Perception::DistanceDown ( float  angle)

Distance to the closest object under th4e Roboid within the given range.

Parameters
angleThe angle relative to the downward direciton to indicate the range
Returns
distance in meters, INFINITY when no object is detected

◆ SwitchOn()

bool Perception::SwitchOn ( float  fromAngle,
float  toAngle 
)

Checks if an object is close within the give range in the horizontal plane.

Parameters
fromAngleStart angle in the horizontal plane
toAngleEnd angle in the horizontal plane
Returns
True is an object is closeby
Note
Whether an object is closeby depends on the Distance Sensor
Remarks
This function is likely to change in the near future

Member Data Documentation

◆ sensorPlacements

Placement* Passer::RoboidControl::Perception::sensorPlacements = nullptr
protected

The Placement of the Sensors used for Perception.

◆ sensorCount

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

The number of Sensors used for Perception.


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