Add GetThingsOfType
This commit is contained in:
parent
ba1dd195a6
commit
c000cb3a0f
@ -277,6 +277,25 @@ InterestingThing **Perception::GetTrackedObjects() {
|
|||||||
return this->trackedObjects;
|
return this->trackedObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char Perception::GetThingsOfType(unsigned char objectType,
|
||||||
|
InterestingThing *buffer[],
|
||||||
|
unsigned char bufferSize) {
|
||||||
|
unsigned char thingCount = 0;
|
||||||
|
for (unsigned char objIx = 0; objIx < maxObjectCount; objIx++) {
|
||||||
|
InterestingThing *thing = this->trackedObjects[objIx];
|
||||||
|
if (thing == nullptr)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (thing->type == objectType) {
|
||||||
|
buffer[thingCount] = thing;
|
||||||
|
thingCount++;
|
||||||
|
if (thingCount >= bufferSize)
|
||||||
|
return bufferSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return thingCount;
|
||||||
|
}
|
||||||
|
|
||||||
InterestingThing *Perception::GetMostInterestingThing() {
|
InterestingThing *Perception::GetMostInterestingThing() {
|
||||||
InterestingThing *closestObject = nullptr;
|
InterestingThing *closestObject = nullptr;
|
||||||
float closestDistance = INFINITY;
|
float closestDistance = INFINITY;
|
||||||
|
@ -103,6 +103,10 @@ public:
|
|||||||
/// currently being tracked.
|
/// currently being tracked.
|
||||||
InterestingThing **GetTrackedObjects();
|
InterestingThing **GetTrackedObjects();
|
||||||
|
|
||||||
|
unsigned char GetThingsOfType(unsigned char objectType,
|
||||||
|
InterestingThing *buffer[],
|
||||||
|
unsigned char bufferSize);
|
||||||
|
|
||||||
InterestingThing *GetMostInterestingThing();
|
InterestingThing *GetMostInterestingThing();
|
||||||
|
|
||||||
// mainly used for confidence update
|
// mainly used for confidence update
|
||||||
|
Loading…
x
Reference in New Issue
Block a user