RoboidControl for Arduino
Loading...
Searching...
No Matches
Perception.h
Go to the documentation of this file.
1#pragma once
2
3#include "Placement.h"
4#include "Sensor.h"
5
6namespace Passer {
7namespace RoboidControl {
8
11 public:
13 Perception();
14
18 template <unsigned int sensorCount>
19 inline Perception(Placement (&sensors)[sensorCount]) {
20 Perception(sensors, sensorCount);
21 }
25 Perception(Placement* sensors, unsigned int sensorCount);
26
29 unsigned int GetSensorCount();
34 Sensor* GetSensor(unsigned int sensorIx);
39 Placement* GetSensorPlacement(unsigned int sensorIx);
40
46 float DistanceForward(float direction = 90);
47
53 float DistanceLeft() { return DistanceLeft(180); }
61 float DistanceLeft(float angle);
62
68 float DistanceRight() { return DistanceRight(180); }
76 float DistanceRight(float angle);
77
80 float DistanceUp() { return DistanceUp(180); }
86 float DistanceUp(float angle);
89 float DistanceDown() { return DistanceDown(180); }
95 float DistanceDown(float angle);
96
104 bool SwitchOn(float fromAngle, float toAngle);
105
106 protected:
110 unsigned int sensorCount = 0;
111};
112
113} // namespace RoboidControl
114} // namespace Passer
115using namespace Passer::RoboidControl;
Module to which keeps track of objects around the roboid.
Definition Perception.h:10
unsigned int sensorCount
The number of Sensors used for Perception.
Definition Perception.h:110
float DistanceForward(float direction=90)
Distance to the closest object on the front of the Roboid.
Definition Perception.cpp:28
Sensor * GetSensor(unsigned int sensorIx)
Get a specific Sensor on the Roboid.
Definition Perception.cpp:17
Placement * sensorPlacements
The Placement of the Sensors used for Perception.
Definition Perception.h:108
unsigned int GetSensorCount()
Get the number of Sensors.
Definition Perception.cpp:13
float DistanceUp()
Distance to the closest object above the Roboid.
Definition Perception.h:80
Perception(Placement(&sensors)[sensorCount])
Template to make it possible to leave out ths sensorCount.
Definition Perception.h:19
Perception()
Default Constructor.
Definition Perception.cpp:6
float DistanceRight()
Distance to the closest object on the right.
Definition Perception.h:68
bool SwitchOn(float fromAngle, float toAngle)
Checks if an object is close within the give range in the horizontal plane.
Definition Perception.cpp:115
Placement * GetSensorPlacement(unsigned int sensorIx)
Get the placement of a specific Sensor.
float DistanceLeft()
Distance to the closest object on the left.
Definition Perception.h:53
float DistanceDown()
Disatnce to the closest object under the Roboid.
Definition Perception.h:89
A plament is used to specify where a Thing is placed on the Roboid.
Definition Placement.h:38
A sensor is a thing which can perform measurements in the environment.
Definition Sensor.h:9
Definition DRV8833.h:7
Definition DRV8833.h:6