diff --git a/ControlledMotor.cpp b/ControlledMotor.cpp index 467d24e..bec227e 100644 --- a/ControlledMotor.cpp +++ b/ControlledMotor.cpp @@ -19,7 +19,7 @@ void ControlledMotor::SetTargetSpeed(float speed) { // : Motor::Direction::Clockwise; } -void ControlledMotor::Update(float currentTimeMs) { +void ControlledMotor::Update(unsigned long currentTimeMs) { this->actualSpeed = encoder->GetRevolutionsPerSecond(currentTimeMs); if (this->currentTargetSpeed < 0) this->actualSpeed = -this->actualSpeed; diff --git a/NetworkSync.cpp b/NetworkSync.cpp index aa5a3b4..4fc116b 100644 --- a/NetworkSync.cpp +++ b/NetworkSync.cpp @@ -35,8 +35,8 @@ void NetworkSync::ReceiveNetworkId() { // delay(100); PublishModel(roboid); // delay(100); - if (roboid->actuation != nullptr) - PublishRelativeThing(roboid->actuation, true); + if (roboid->childCount > 0) + PublishRelativeThing(roboid->GetChild(0), true); } void NetworkSync::NewObject(InterestingThing *thing) { @@ -89,11 +89,11 @@ void NetworkSync::PublishModel(Roboid *roboid) { return; unsigned char ix = 0; - buffer[ix++] = 0x90; // modelMsg - buffer[ix++] = 0x00; // objectId - Spherical s = Spherical(roboid->modelPosition); + buffer[ix++] = 0x90; // modelMsg + buffer[ix++] = 0x00; // objectId + Spherical s = Spherical::zero; //(roboid->modelPosition); SendSpherical(buffer, &ix, s); - SendFloat16(buffer, &ix, roboid->modelScale); + SendFloat16(buffer, &ix, 1); // roboid->modelScale); buffer[ix++] = len; for (int urlIx = 0; urlIx < len; urlIx++) @@ -111,11 +111,11 @@ void NetworkSync::PublishModel(Thing *thing) { return; unsigned char ix = 0; - buffer[ix++] = 0x90; // modelMsg - buffer[ix++] = thing->id; // objectId - Spherical s = Spherical(thing->modelPosition); + buffer[ix++] = 0x90; // modelMsg + buffer[ix++] = thing->id; // objectId + Spherical s = Spherical::zero; // Spherical(thing->modelPosition); SendSpherical(buffer, &ix, s); - SendFloat16(buffer, &ix, thing->modelScale); + SendFloat16(buffer, &ix, 1); // thing->modelScale); buffer[ix++] = len; for (int urlIx = 0; urlIx < len; urlIx++) @@ -168,7 +168,7 @@ void NetworkSync::SendPose(Roboid *roboid, bool recurse) { if (recurse) { // delay(10); - Thing *child = roboid->actuation; + Thing *child = roboid->GetChild(0); // actuation; if (child != nullptr) SendPose(child, true); } @@ -213,8 +213,8 @@ void NetworkSync::PublishTrackedObjects(Roboid *roboid, InterestingThing *obj = objects[objIx]; if (obj == nullptr) continue; - if (obj->sensor->type == Thing::ExternalType) - continue; + // if (obj->sensor->type == Thing::ExternalType) + // continue; if (obj->confidence > 0) { PublishTrackedObject(roboid, obj); diff --git a/NetworkSync.h b/NetworkSync.h index 4b7128c..be233bb 100644 --- a/NetworkSync.h +++ b/NetworkSync.h @@ -72,7 +72,7 @@ public: void SendPose(Roboid *roboid, bool recurse = true); void SendPose(Thing *thing, bool recurse = true); - virtual void SendText(const char *s) {}; + virtual void SendText(const char *s); protected: Roboid *roboid; diff --git a/Thing.h b/Thing.h index 436ae0a..5631852 100644 --- a/Thing.h +++ b/Thing.h @@ -76,6 +76,10 @@ public: /// @param currentTimeMs The current clock time in milliseconds virtual void Update(unsigned long currentTimeMs) {} + unsigned char childCount = 0; + + const char *modelUrl = nullptr; + protected: /// @brief Bitmask for Motor type static const unsigned int MotorType = 0x8000; @@ -99,10 +103,7 @@ protected: }; Thing *parent = nullptr; - unsigned char childCount = 0; Thing **children = nullptr; - - const char *modelUrl = nullptr; }; } // namespace RoboidControl