RoboidControl
Loading...
Searching...
No Matches
d:/PlatformIO/RoboidControl/Perception.h
Go to the documentation of this file.
1#pragma once
2
6#include "Sensor.h"
7#include "TrackedObject.h"
8
9// #include <vector.h>
10
11namespace Passer {
12namespace RoboidControl {
13
14class Roboid;
15
18public:
20 Perception();
21
25 Perception(Sensor **sensors, unsigned int sensorCount);
26
28 Roboid *roboid = nullptr;
29
30 unsigned int AddSensor(Sensor *sensor);
31
34 unsigned int GetSensorCount();
35 Sensor *GetSensor(unsigned int sensorId);
41 Sensor *FindSensorOfType(unsigned int sensorType);
42
47 float GetDistance(float direction, float range = 10.0F);
48 float GetDistanceOfType(unsigned char thingType, float horizontalAngle,
49 float range = 10.0F);
59 float GetDistance(float horizontalDirection, float verticalDirection,
60 float range = 10.0F);
61
69 bool ObjectNearby(float direction, float range = 10.0F);
83 // bool ObjectNearby(float horizontalDirection, float verticalDirection,
84 // float range = 10.0F);
85
90 void AddTrackedObject(Sensor *sensor, Polar position,
91 unsigned char objectType = 0x00,
92 unsigned char networkId = 0x00);
94 AddTrackedObject(Sensor *sensor, Spherical position,
95 Quaternion orientation = Quaternion::identity,
96 unsigned char objectId = 0x00, unsigned networkId = 0x00);
97
99 AddTrackedObject(Sensor *sensor, unsigned char networkId,
100 unsigned char objectId, Spherical position,
101 Quaternion orientation = Quaternion::identity);
102
103 bool IsInteresting(float distance);
104
105 InterestingThing *FindTrackedObject(char objectId);
106 InterestingThing *FindTrackedObject(unsigned char networkId,
107 unsigned char objectId);
108
113 unsigned char TrackedObjectCount();
120
121 unsigned char ThingsOfType(unsigned char objectType,
122 InterestingThing *buffer[],
123 unsigned char bufferSize);
124 InterestingThing *ThingOfType(unsigned char objectType);
125
127
128 // mainly used for confidence update
129
135 void Update(float currentTimeMs);
136
144 void UpdatePose(Polar translation);
148 void UpdatePose(Quaternion rotation);
149
154 float nearbyDistance = 0.02F;
155
156public:
158 Sensor **sensors = nullptr;
160 unsigned int sensorCount = 0;
161
163 unsigned char lastObjectId = 1;
164
165 static unsigned char maxObjectCount; // = 7; // 7 is typically the maximum
166 // number of object which can
167 // be tracked by a human
169};
170
171} // namespace RoboidControl
172} // namespace Passer
173using namespace Passer::RoboidControl;
An object tracked by the roboid.
Definition TrackedObject.h:12
Module to which keeps track of objects around the roboid.
Definition Perception.h:17
unsigned char lastObjectId
Definition Perception.h:163
unsigned int sensorCount
The number of Sensors used for Perception.
Definition Perception.h:160
void Update(float currentTimeMs)
Update the state of the perception.
Definition Perception.cpp:466
Sensor ** sensors
The Sensors used for Perception.
Definition Perception.h:158
float nearbyDistance
Objects with a distance closed that this value will be considered nearby.
Definition Perception.h:154
bool ObjectNearby(float direction, float range=10.0F)
Checks if an object is nearby.
Definition Perception.cpp:173
InterestingThing * GetMostInterestingThing()
Definition Perception.cpp:451
float GetDistanceOfType(unsigned char thingType, float horizontalAngle, float range=10.0F)
Definition Perception.cpp:129
unsigned char TrackedObjectCount()
Retrieve the number of objects currently being tracked by the roboid.
Definition Perception.cpp:403
Roboid * roboid
The roboid of this perception system.
Definition Perception.h:28
float GetDistance(float direction, float range=10.0F)
Gets the distance to the closest object.
Sensor * GetSensor(unsigned int sensorId)
Definition Perception.cpp:38
InterestingThing ** trackedObjects
Definition Perception.h:168
unsigned int GetSensorCount()
Get the number of Sensors.
Definition Perception.cpp:36
static unsigned char maxObjectCount
Definition Perception.h:165
Sensor * FindSensorOfType(unsigned int sensorType)
Find the first sensor of the given type.
Definition Perception.cpp:62
void UpdatePose(Polar translation)
Update the position/orientation of the preceived objects from the given roboid translation.
Definition Perception.cpp:518
void AddTrackedObject(Sensor *sensor, Polar position, unsigned char objectType=0x00, unsigned char networkId=0x00)
Checks if an object is nearby.
Perception()
Default Constructor.
Definition Perception.cpp:18
InterestingThing * ThingOfType(unsigned char objectType)
Definition Perception.cpp:439
bool IsInteresting(float distance)
Definition Perception.cpp:366
unsigned int AddSensor(Sensor *sensor)
Definition Perception.cpp:46
float lastUpdateTimeMs
Definition Perception.h:162
InterestingThing ** GetTrackedObjects()
Retreive the objects currently tracked by the roboid.
Definition Perception.cpp:412
unsigned char ThingsOfType(unsigned char objectType, InterestingThing *buffer[], unsigned char bufferSize)
Definition Perception.cpp:416
InterestingThing * FindTrackedObject(char objectId)
Definition Perception.cpp:377
A Roboid is used to control autonomous robots.
Definition Roboid.h:14
A sensor is a thing which can perform measurements in the environment.
Definition Sensor.h:9
Definition Accelerometer.h:7
Definition AbsoluteEncoder.h:5