Bugfixes
This commit is contained in:
parent
c52d009c91
commit
7dfd2b0004
@ -19,7 +19,7 @@ void ControlledMotor::SetTargetSpeed(float speed) {
|
|||||||
// : Motor::Direction::Clockwise;
|
// : Motor::Direction::Clockwise;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlledMotor::Update(float currentTimeMs) {
|
void ControlledMotor::Update(unsigned long currentTimeMs) {
|
||||||
this->actualSpeed = encoder->GetRevolutionsPerSecond(currentTimeMs);
|
this->actualSpeed = encoder->GetRevolutionsPerSecond(currentTimeMs);
|
||||||
if (this->currentTargetSpeed < 0)
|
if (this->currentTargetSpeed < 0)
|
||||||
this->actualSpeed = -this->actualSpeed;
|
this->actualSpeed = -this->actualSpeed;
|
||||||
|
@ -35,8 +35,8 @@ void NetworkSync::ReceiveNetworkId() {
|
|||||||
// delay(100);
|
// delay(100);
|
||||||
PublishModel(roboid);
|
PublishModel(roboid);
|
||||||
// delay(100);
|
// delay(100);
|
||||||
if (roboid->actuation != nullptr)
|
if (roboid->childCount > 0)
|
||||||
PublishRelativeThing(roboid->actuation, true);
|
PublishRelativeThing(roboid->GetChild(0), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::NewObject(InterestingThing *thing) {
|
void NetworkSync::NewObject(InterestingThing *thing) {
|
||||||
@ -89,11 +89,11 @@ void NetworkSync::PublishModel(Roboid *roboid) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned char ix = 0;
|
unsigned char ix = 0;
|
||||||
buffer[ix++] = 0x90; // modelMsg
|
buffer[ix++] = 0x90; // modelMsg
|
||||||
buffer[ix++] = 0x00; // objectId
|
buffer[ix++] = 0x00; // objectId
|
||||||
Spherical s = Spherical(roboid->modelPosition);
|
Spherical s = Spherical::zero; //(roboid->modelPosition);
|
||||||
SendSpherical(buffer, &ix, s);
|
SendSpherical(buffer, &ix, s);
|
||||||
SendFloat16(buffer, &ix, roboid->modelScale);
|
SendFloat16(buffer, &ix, 1); // roboid->modelScale);
|
||||||
|
|
||||||
buffer[ix++] = len;
|
buffer[ix++] = len;
|
||||||
for (int urlIx = 0; urlIx < len; urlIx++)
|
for (int urlIx = 0; urlIx < len; urlIx++)
|
||||||
@ -111,11 +111,11 @@ void NetworkSync::PublishModel(Thing *thing) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned char ix = 0;
|
unsigned char ix = 0;
|
||||||
buffer[ix++] = 0x90; // modelMsg
|
buffer[ix++] = 0x90; // modelMsg
|
||||||
buffer[ix++] = thing->id; // objectId
|
buffer[ix++] = thing->id; // objectId
|
||||||
Spherical s = Spherical(thing->modelPosition);
|
Spherical s = Spherical::zero; // Spherical(thing->modelPosition);
|
||||||
SendSpherical(buffer, &ix, s);
|
SendSpherical(buffer, &ix, s);
|
||||||
SendFloat16(buffer, &ix, thing->modelScale);
|
SendFloat16(buffer, &ix, 1); // thing->modelScale);
|
||||||
|
|
||||||
buffer[ix++] = len;
|
buffer[ix++] = len;
|
||||||
for (int urlIx = 0; urlIx < len; urlIx++)
|
for (int urlIx = 0; urlIx < len; urlIx++)
|
||||||
@ -168,7 +168,7 @@ void NetworkSync::SendPose(Roboid *roboid, bool recurse) {
|
|||||||
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
// delay(10);
|
// delay(10);
|
||||||
Thing *child = roboid->actuation;
|
Thing *child = roboid->GetChild(0); // actuation;
|
||||||
if (child != nullptr)
|
if (child != nullptr)
|
||||||
SendPose(child, true);
|
SendPose(child, true);
|
||||||
}
|
}
|
||||||
@ -213,8 +213,8 @@ void NetworkSync::PublishTrackedObjects(Roboid *roboid,
|
|||||||
InterestingThing *obj = objects[objIx];
|
InterestingThing *obj = objects[objIx];
|
||||||
if (obj == nullptr)
|
if (obj == nullptr)
|
||||||
continue;
|
continue;
|
||||||
if (obj->sensor->type == Thing::ExternalType)
|
// if (obj->sensor->type == Thing::ExternalType)
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
if (obj->confidence > 0) {
|
if (obj->confidence > 0) {
|
||||||
PublishTrackedObject(roboid, obj);
|
PublishTrackedObject(roboid, obj);
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
void SendPose(Roboid *roboid, bool recurse = true);
|
void SendPose(Roboid *roboid, bool recurse = true);
|
||||||
void SendPose(Thing *thing, bool recurse = true);
|
void SendPose(Thing *thing, bool recurse = true);
|
||||||
|
|
||||||
virtual void SendText(const char *s) {};
|
virtual void SendText(const char *s);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Roboid *roboid;
|
Roboid *roboid;
|
||||||
|
7
Thing.h
7
Thing.h
@ -76,6 +76,10 @@ public:
|
|||||||
/// @param currentTimeMs The current clock time in milliseconds
|
/// @param currentTimeMs The current clock time in milliseconds
|
||||||
virtual void Update(unsigned long currentTimeMs) {}
|
virtual void Update(unsigned long currentTimeMs) {}
|
||||||
|
|
||||||
|
unsigned char childCount = 0;
|
||||||
|
|
||||||
|
const char *modelUrl = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// @brief Bitmask for Motor type
|
/// @brief Bitmask for Motor type
|
||||||
static const unsigned int MotorType = 0x8000;
|
static const unsigned int MotorType = 0x8000;
|
||||||
@ -99,10 +103,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Thing *parent = nullptr;
|
Thing *parent = nullptr;
|
||||||
unsigned char childCount = 0;
|
|
||||||
Thing **children = nullptr;
|
Thing **children = nullptr;
|
||||||
|
|
||||||
const char *modelUrl = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace RoboidControl
|
} // namespace RoboidControl
|
||||||
|
Loading…
x
Reference in New Issue
Block a user