Removed unused variable
This commit is contained in:
parent
b6abc6725c
commit
6eefd5892c
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
#include "RoboidControl/NetworkSync.h"
|
#include "RoboidControl/NetworkSync.h"
|
||||||
|
|
||||||
void NetworkPerception::ProcessPacket(Roboid *roboid, unsigned char *buffer,
|
void NetworkPerception::ProcessPacket(Roboid* roboid,
|
||||||
|
unsigned char* buffer,
|
||||||
int packetsize) {
|
int packetsize) {
|
||||||
// printf("packet received, type = 0x%02x %d %d %d %d\n", buffer[0],
|
// printf("packet received, type = 0x%02x %d %d %d %d\n", buffer[0],
|
||||||
// buffer[2], buffer[3], buffer[4], buffer[5]);
|
// buffer[2], buffer[3], buffer[4], buffer[5]);
|
||||||
@ -12,7 +13,7 @@ void NetworkPerception::ProcessPacket(Roboid *roboid, unsigned char *buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Int32 NetworkPerception::ReceiveInt32(unsigned char *data, int startIndex) {
|
Int32 NetworkPerception::ReceiveInt32(unsigned char* data, int startIndex) {
|
||||||
Int32 a = Int32((UInt32)(data[startIndex + 3]) << 24 |
|
Int32 a = Int32((UInt32)(data[startIndex + 3]) << 24 |
|
||||||
(UInt32)(data[startIndex + 2]) << 16 |
|
(UInt32)(data[startIndex + 2]) << 16 |
|
||||||
(UInt32)(data[startIndex + 1]) << 8 |
|
(UInt32)(data[startIndex + 1]) << 8 |
|
||||||
@ -20,13 +21,13 @@ Int32 NetworkPerception::ReceiveInt32(unsigned char *data, int startIndex) {
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
float NetworkPerception::ReceiveFloat100(unsigned char *data, int startIndex) {
|
float NetworkPerception::ReceiveFloat100(unsigned char* data, int startIndex) {
|
||||||
Int32 intValue = ReceiveInt32(data, startIndex);
|
Int32 intValue = ReceiveInt32(data, startIndex);
|
||||||
float f = (float)intValue / 100.0F;
|
float f = (float)intValue / 100.0F;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 NetworkPerception::ReceiveVector3(unsigned char *data, int startIndex) {
|
Vector3 NetworkPerception::ReceiveVector3(unsigned char* data, int startIndex) {
|
||||||
float x = ReceiveFloat100(data, startIndex);
|
float x = ReceiveFloat100(data, startIndex);
|
||||||
float y = ReceiveFloat100(data, startIndex + 4);
|
float y = ReceiveFloat100(data, startIndex + 4);
|
||||||
float z = ReceiveFloat100(data, startIndex + 8);
|
float z = ReceiveFloat100(data, startIndex + 8);
|
||||||
@ -34,9 +35,9 @@ Vector3 NetworkPerception::ReceiveVector3(unsigned char *data, int startIndex) {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkPerception::ReceiveObject(unsigned char *data, Roboid *roboid) {
|
void NetworkPerception::ReceiveObject(unsigned char* data, Roboid* roboid) {
|
||||||
unsigned char objectId = data[1];
|
unsigned char objectId = data[1];
|
||||||
char poseType = data[2];
|
// char poseType = data[2];
|
||||||
Vector3 worldPosition = ReceiveVector3(data, 3);
|
Vector3 worldPosition = ReceiveVector3(data, 3);
|
||||||
Vector3 worldAngles = ReceiveVector3(data, 15);
|
Vector3 worldAngles = ReceiveVector3(data, 15);
|
||||||
Quaternion worldOrientation = Quaternion::Euler(worldAngles);
|
Quaternion worldOrientation = Quaternion::Euler(worldAngles);
|
||||||
@ -48,7 +49,7 @@ void NetworkPerception::ReceiveObject(unsigned char *data, Roboid *roboid) {
|
|||||||
// worldPosition.z, worldDirection.x, worldDirection.z);
|
// worldPosition.z, worldDirection.x, worldDirection.z);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Vector3 myPosition = roboid->GetPosition(); // Vector3::zero;
|
Vector3 myPosition = roboid->GetPosition(); // Vector3::zero;
|
||||||
Vector2 myPosition2 = Vector3::ProjectHorizontalPlane(myPosition);
|
Vector2 myPosition2 = Vector3::ProjectHorizontalPlane(myPosition);
|
||||||
Quaternion myOrientation = roboid->GetOrientation();
|
Quaternion myOrientation = roboid->GetOrientation();
|
||||||
Vector3 myDirection = myOrientation * Vector3::forward;
|
Vector3 myDirection = myOrientation * Vector3::forward;
|
||||||
|
@ -8,16 +8,16 @@ namespace Passer {
|
|||||||
namespace RoboidControl {
|
namespace RoboidControl {
|
||||||
|
|
||||||
class NetworkPerception : public Sensor {
|
class NetworkPerception : public Sensor {
|
||||||
public:
|
public:
|
||||||
void ProcessPacket(Roboid *roboid, unsigned char *buffer, int packetsize);
|
void ProcessPacket(Roboid* roboid, unsigned char* buffer, int packetsize);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ReceiveObject(unsigned char *data, Roboid *roboid);
|
void ReceiveObject(unsigned char* data, Roboid* roboid);
|
||||||
|
|
||||||
Int32 ReceiveInt32(unsigned char *data, int startIndex);
|
Int32 ReceiveInt32(unsigned char* data, int startIndex);
|
||||||
float ReceiveFloat100(unsigned char *data, int startIndex);
|
float ReceiveFloat100(unsigned char* data, int startIndex);
|
||||||
Vector3 ReceiveVector3(unsigned char *data, int startIndex);
|
Vector3 ReceiveVector3(unsigned char* data, int startIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace RoboidControl
|
} // namespace RoboidControl
|
||||||
} // namespace Passer
|
} // namespace Passer
|
Loading…
x
Reference in New Issue
Block a user