Merged changes

This commit is contained in:
Pascal Serrarens 2024-08-29 13:53:09 +02:00
parent 86a795dd81
commit b2adaac890
3 changed files with 13 additions and 12 deletions

View File

@ -105,8 +105,8 @@ void NetworkPerception::ReceivePlane(unsigned char* data, Roboid* roboid) {
// worldPosition.y, worldPosition.z, roboidPosition.x, // worldPosition.y, worldPosition.z, roboidPosition.x,
// roboidPosition.y, roboidPosition.z, position.distance, // roboidPosition.y, roboidPosition.z, position.distance,
// (float)position.horizontalAngle, (float)position.verticalAngle); // (float)position.horizontalAngle, (float)position.verticalAngle);
printf("Received plane %f (%f %f)\n", position.distance, // printf("Received plane %f (%f %f)\n", position.distance,
position.horizontal.ToFloat(), position.vertical.ToFloat()); // (float)position.horizontalAngle, (float)position.verticalAngle);
roboid->perception->AddTrackedObject(this, position, Quaternion::identity, roboid->perception->AddTrackedObject(this, position, Quaternion::identity,
0x80, 0x80, networkId); 0x80, 0x80, networkId);
} }

View File

@ -196,12 +196,13 @@ bool Perception::ObjectNearby(float direction, float range) {
// #include <WifiSync.h> // #include <WifiSync.h>
// This function is deprecated // This function is deprecated
/*
void Perception::AddTrackedObject(Sensor* sensor, void Perception::AddTrackedObject(Sensor* sensor,
Polar position, Spherical16 position,
unsigned char thingType, unsigned char thingType,
unsigned char networkId) { unsigned char networkId) {
Spherical16 sPos = // Spherical16 sPos =
Spherical16(position.distance, Angle16(position.angle.ToFloat()), 0); // Spherical16(position.distance, Angle16(position.angle.ToFloat()), 0);
Quaternion orientation = Quaternion::identity; Quaternion orientation = Quaternion::identity;
AddTrackedObject(sensor, sPos, orientation, 0x00, thingType, networkId); AddTrackedObject(sensor, sPos, orientation, 0x00, thingType, networkId);
/* /*
@ -277,15 +278,15 @@ void Perception::AddTrackedObject(Sensor* sensor,
// No available slot, delete trackedobject // No available slot, delete trackedobject
delete obj; delete obj;
} }
*/
} }
*/
InterestingThing* Perception::AddTrackedObject(Sensor* sensor, InterestingThing* Perception::AddTrackedObject(Sensor* sensor,
Spherical16 position, Spherical16 position,
Quaternion orientation, Quaternion orientation,
unsigned char thingType, unsigned char thingType,
unsigned char thingId, unsigned char thingId,
unsigned networkId) { unsigned char networkId) {
InterestingThing* thing = new InterestingThing(sensor, position, orientation); InterestingThing* thing = new InterestingThing(sensor, position, orientation);
if (thingId != 0x00) if (thingId != 0x00)
thing->id = thingId; thing->id = thingId;

View File

@ -89,17 +89,17 @@ class Perception {
/// @param sensor The sensor which has detected the object /// @param sensor The sensor which has detected the object
/// @param position The position of the sensor in polar coordinates local to /// @param position The position of the sensor in polar coordinates local to
/// the roboid /// the roboid
void AddTrackedObject(Sensor* sensor, // void AddTrackedObject(Sensor* sensor,
Polar position, // Spherical16 position,
unsigned char objectType = 0xFF, // unsigned char objectType = 0x00,
unsigned char networkId = 0x00); // unsigned char networkId = 0x00);
InterestingThing* AddTrackedObject( InterestingThing* AddTrackedObject(
Sensor* sensor, Sensor* sensor,
Spherical16 position, Spherical16 position,
Quaternion orientation = Quaternion::identity, Quaternion orientation = Quaternion::identity,
unsigned char objectType = 0xFF, unsigned char objectType = 0xFF,
unsigned char objectId = 0x00, unsigned char objectId = 0x00,
unsigned networkId = 0x00); unsigned char networkId = 0x00);
InterestingThing* AddTrackedObject( InterestingThing* AddTrackedObject(
Sensor* sensor, Sensor* sensor,