Fix issues, add networking documentation
This commit is contained in:
parent
67b6d134e5
commit
a890cdb7fb
@ -99,15 +99,16 @@ void NetworkPerception::ReceivePlane(unsigned char* data, Roboid* roboid) {
|
|||||||
// Vector3::SignedAngle(Vector3::forward, localPosition, Vector3::up);
|
// Vector3::SignedAngle(Vector3::forward, localPosition, Vector3::up);
|
||||||
|
|
||||||
// Polar position = Polar(angle, distance);
|
// Polar position = Polar(angle, distance);
|
||||||
Spherical position = Spherical(localPosition);
|
Spherical16 position = Spherical16::FromVector3(localPosition);
|
||||||
|
|
||||||
// printf("Received plane (%f %f %f) (%f %f %f) %f %f %f\n", worldPosition.x,
|
// printf("Received plane (%f %f %f) (%f %f %f) %f %f %f\n", worldPosition.x,
|
||||||
// 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.horizontalAngle.ToFloat(), position.verticalAngle.ToFloat());
|
position.horizontal.ToFloat(), position.vertical.ToFloat());
|
||||||
roboid->perception->AddTrackedObject(this, position, 0x80, networkId);
|
roboid->perception->AddTrackedObject(this, position, Quaternion::identity,
|
||||||
|
0x80, 0x80, networkId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkPerception::ReceiveSphere(unsigned char* data, Roboid* roboid) {
|
void NetworkPerception::ReceiveSphere(unsigned char* data, Roboid* roboid) {
|
||||||
|
@ -144,7 +144,7 @@ void NetworkSync::SendPose(Roboid* roboid, bool recurse) {
|
|||||||
buffer[ix++] = PoseMsg;
|
buffer[ix++] = PoseMsg;
|
||||||
buffer[ix++] = 0x00;
|
buffer[ix++] = 0x00;
|
||||||
buffer[ix++] = Pose_Position | Pose_Orientation;
|
buffer[ix++] = Pose_Position | Pose_Orientation;
|
||||||
SendSpherical(buffer, &ix, Spherical(roboid->GetPosition()));
|
SendSpherical(buffer, &ix, Spherical::FromVector3(roboid->GetPosition()));
|
||||||
SendQuat32(buffer, &ix, roboid->GetOrientation());
|
SendQuat32(buffer, &ix, roboid->GetOrientation());
|
||||||
SendBuffer(ix);
|
SendBuffer(ix);
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ void NetworkSync::PublishTrackedObject(Roboid* roboid,
|
|||||||
buffer[ix++] = PoseMsg; // Position2DMsg;
|
buffer[ix++] = PoseMsg; // Position2DMsg;
|
||||||
buffer[ix++] = object->id; // objectId;
|
buffer[ix++] = object->id; // objectId;
|
||||||
buffer[ix++] = Pose_Position | Pose_Orientation;
|
buffer[ix++] = Pose_Position | Pose_Orientation;
|
||||||
SendSpherical(buffer, &ix, Spherical(worldPosition));
|
SendSpherical(buffer, &ix, Spherical::FromVector3(worldPosition));
|
||||||
SendQuat32(buffer, &ix, worldOrientation);
|
SendQuat32(buffer, &ix, worldOrientation);
|
||||||
// SendPolar(buffer, &ix, polar); // 3 bytes
|
// SendPolar(buffer, &ix, polar); // 3 bytes
|
||||||
// SendVector3(buffer, &ix, worldPosition);
|
// SendVector3(buffer, &ix, worldPosition);
|
||||||
@ -373,8 +373,8 @@ void NetworkSync::SendPolar(unsigned char* data,
|
|||||||
void NetworkSync::SendSpherical(unsigned char* data,
|
void NetworkSync::SendSpherical(unsigned char* data,
|
||||||
unsigned char* startIndex,
|
unsigned char* startIndex,
|
||||||
Spherical s) {
|
Spherical s) {
|
||||||
SendAngle8(data, (*startIndex)++, s.horizontalAngle.ToFloat());
|
SendAngle8(data, (*startIndex)++, s.horizontal.ToFloat());
|
||||||
SendAngle8(data, (*startIndex)++, s.verticalAngle.ToFloat());
|
SendAngle8(data, (*startIndex)++, s.vertical.ToFloat());
|
||||||
SendFloat16(data, startIndex, s.distance);
|
SendFloat16(data, startIndex, s.distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
README.md
17
README.md
@ -1,2 +1,19 @@
|
|||||||
RoboidControl is a cross platform framework to control autonomous robots. This library contains the generic functionality. Most projects will use one of the platform-specific implementations:
|
RoboidControl is a cross platform framework to control autonomous robots. This library contains the generic functionality. Most projects will use one of the platform-specific implementations:
|
||||||
* [RoboidControl for Arduino](https://gitlab.passervr.com/passer/arduino/roboidcontrol)
|
* [RoboidControl for Arduino](https://gitlab.passervr.com/passer/arduino/roboidcontrol)
|
||||||
|
|
||||||
|
Network Sync Protocol
|
||||||
|
=====================
|
||||||
|
|
||||||
|
The client connects to a Roboid Site using a Serial or WiFi connection.
|
||||||
|
It will then send a 'Client (0xA0)' message to the Site
|
||||||
|
The Site will respond with a 'NetworkId (0xA1)' message containing the NetworkId of this new client.
|
||||||
|
Then the client can start sending normal messages.
|
||||||
|
|
||||||
|
When the client sends a 'Pose (0x10)' message for a thing which is not known by the Site
|
||||||
|
(the networkId/thingId combination is not known), the Site will send an 'Investigate (0x81)'
|
||||||
|
message to the client.
|
||||||
|
The client shall respond with a 'NewThing (0x80)' message containing the type of the thing.
|
||||||
|
Optionally, the client can send a 'ModelURL (0x90)' message containing a link to the OBJ model of the thing.
|
||||||
|
|
||||||
|
The same mechanism work the other way round, when the client receives a pose for an unknown object.
|
||||||
|
The deviation is that the Site will (currently) not send 'ModelURL (0x90)' messages.
|
Loading…
x
Reference in New Issue
Block a user