diff --git a/LinearAlgebra b/LinearAlgebra index a646e93..09e25a8 160000 --- a/LinearAlgebra +++ b/LinearAlgebra @@ -1 +1 @@ -Subproject commit a646e936ee878af6954e43a66a7b66b0b208fcf9 +Subproject commit 09e25a8a218690157ba46ca5f7ccd5f33eab1c07 diff --git a/NetworkSync.cpp b/NetworkSync.cpp index b9764d8..2ef3298 100644 --- a/NetworkSync.cpp +++ b/NetworkSync.cpp @@ -49,8 +49,9 @@ void NetworkSync::PublishState(Roboid* roboid) { // if (roboid->updated == false) // return; - SendPose(roboid); - // PublishPerception(roboid); + if (roboid->GetVelocity().magnitude() > 0) + SendPose(roboid); + PublishPerception(roboid); } void NetworkSync::NewObject(InterestingThing* thing) { @@ -235,12 +236,15 @@ void NetworkSync::PublishClient() { } void NetworkSync::PublishState(Sensor* sensor) { + float* value = (float*)sensor->GetValue(); + if (value == nullptr) + return; + unsigned char ix = 0; buffer[ix++] = StateMsg; buffer[ix++] = sensor->type; - float* value = (float*)sensor->GetValue(); SendFloat16(buffer, &ix, *value); - SendBuffer(ix); + PublishBuffer(ix); } void NetworkSync::PublishPerception(Roboid* roboid) { @@ -253,7 +257,6 @@ void NetworkSync::PublishPerception(Roboid* roboid) { Sensor* sensor = perception->sensors[sensorIx]; if (sensor == nullptr) continue; - // sensor->PublishState(); PublishState(sensor); } PublishTrackedObjects(roboid, roboid->perception->GetTrackedObjects()); @@ -532,3 +535,5 @@ void NetworkSync::SendInt32(unsigned char* data, } void NetworkSync::SendBuffer(unsigned char bufferSize) {} + +void NetworkSync::PublishBuffer(unsigned char bufferSize) {} \ No newline at end of file diff --git a/NetworkSync.h b/NetworkSync.h index cdebd38..0d59d32 100644 --- a/NetworkSync.h +++ b/NetworkSync.h @@ -126,6 +126,7 @@ class NetworkSync { unsigned char buffer[256]; virtual void SendBuffer(unsigned char bufferSize); + virtual void PublishBuffer(unsigned char bufferSize); void PublishClient(); }; diff --git a/Perception.cpp b/Perception.cpp index c1f4829..e7ae8a1 100644 --- a/Perception.cpp +++ b/Perception.cpp @@ -16,6 +16,9 @@ unsigned char Perception::maxObjectCount = 7; // 7 is typically the maximum // be tracked by a human Perception::Perception() { + this->sensorCount = 0; + this->sensors = new Sensor*[0]; + this->trackedObjects = new InterestingThing*[maxObjectCount]; for (unsigned char objIx = 0; objIx < maxObjectCount; objIx++) this->trackedObjects[objIx] = nullptr; diff --git a/Roboid.cpp b/Roboid.cpp index 85b2b4f..8ecfb5d 100644 --- a/Roboid.cpp +++ b/Roboid.cpp @@ -126,6 +126,10 @@ void Roboid::SetOrientation2D(float angle) { this->worldAngleAxis = AngleAxis(angle, Direction::up); } +Vector3 Passer::RoboidControl::Roboid::GetVelocity() { + return Vector3(); +} + void Roboid::AddChild(Thing* child) { Thing::AddChild(child); if (child->IsSensor()) { diff --git a/Roboid.h b/Roboid.h index d99eb25..13ba6c0 100644 --- a/Roboid.h +++ b/Roboid.h @@ -68,6 +68,8 @@ class Roboid : public Thing { virtual void SetOrientation(Quaternion worldOrientation); void SetOrientation2D(float angle); + virtual Vector3 GetVelocity(); + virtual void AddChild(Thing* child) override; private: