Performance improvements
This commit is contained in:
parent
bc136362f2
commit
643129fdae
@ -32,11 +32,11 @@ void NetworkSync::ReceiveNetworkId() {
|
|||||||
#ifdef RC_DEBUG
|
#ifdef RC_DEBUG
|
||||||
printf("_Received network Id %d\n", this->networkId);
|
printf("_Received network Id %d\n", this->networkId);
|
||||||
#endif
|
#endif
|
||||||
delay(100);
|
// delay(100);
|
||||||
PublishModel(roboid);
|
PublishModel(roboid);
|
||||||
delay(100);
|
// delay(100);
|
||||||
if (roboid->actuationRoot != nullptr)
|
if (roboid->actuation != nullptr)
|
||||||
PublishRelativeThing(roboid->actuationRoot, true);
|
PublishRelativeThing(roboid->actuation, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::NewObject(InterestingThing *thing) {
|
void NetworkSync::NewObject(InterestingThing *thing) {
|
||||||
@ -69,10 +69,10 @@ void NetworkSync::PublishRelativeThing(Thing *thing, bool recurse) {
|
|||||||
SendSpherical(buffer, &ix, thing->position);
|
SendSpherical(buffer, &ix, thing->position);
|
||||||
SendBuffer(ix);
|
SendBuffer(ix);
|
||||||
|
|
||||||
delay(100);
|
// delay(100);
|
||||||
PublishModel(thing);
|
PublishModel(thing);
|
||||||
|
|
||||||
delay(1000);
|
// delay(1000);
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
Thing *child = thing->GetChild(0);
|
Thing *child = thing->GetChild(0);
|
||||||
if (child != nullptr)
|
if (child != nullptr)
|
||||||
@ -167,8 +167,8 @@ void NetworkSync::SendPose(Roboid *roboid, bool recurse) {
|
|||||||
SendBuffer(ix);
|
SendBuffer(ix);
|
||||||
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
delay(10);
|
// delay(10);
|
||||||
Thing *child = roboid->actuationRoot;
|
Thing *child = roboid->actuation;
|
||||||
if (child != nullptr)
|
if (child != nullptr)
|
||||||
SendPose(child, true);
|
SendPose(child, true);
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ void NetworkSync::SendPose(Thing *thing, bool recurse) {
|
|||||||
SendBuffer(ix);
|
SendBuffer(ix);
|
||||||
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
delay(10);
|
// delay(10);
|
||||||
Thing *child = thing->GetChild(0);
|
Thing *child = thing->GetChild(0);
|
||||||
if (child != nullptr)
|
if (child != nullptr)
|
||||||
SendPose(child, true);
|
SendPose(child, true);
|
||||||
@ -202,7 +202,7 @@ void NetworkSync::PublishClient() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// PublishModel(roboid);
|
// PublishModel(roboid);
|
||||||
// if (roboid->actuationRoot != nullptr)
|
// if (roboid->actuation != nullptr)
|
||||||
// PublishRelativeThing(roboid->actuationRoot, false);
|
// PublishRelativeThing(roboid->actuationRoot, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,6 +446,9 @@ InterestingThing *Perception::ThingOfType(unsigned char thingType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
InterestingThing *Perception::GetMostInterestingThing() {
|
InterestingThing *Perception::GetMostInterestingThing() {
|
||||||
|
if (this->trackedObjects == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
InterestingThing *closestObject = nullptr;
|
InterestingThing *closestObject = nullptr;
|
||||||
float closestDistance = INFINITY;
|
float closestDistance = INFINITY;
|
||||||
for (unsigned char objIx = 0; objIx < maxObjectCount; objIx++) {
|
for (unsigned char objIx = 0; objIx < maxObjectCount; objIx++) {
|
||||||
|
12
Roboid.cpp
12
Roboid.cpp
@ -19,7 +19,7 @@ Roboid::Roboid() {
|
|||||||
this->perception->roboid = this;
|
this->perception->roboid = this;
|
||||||
this->propulsion = nullptr;
|
this->propulsion = nullptr;
|
||||||
this->networkSync = nullptr;
|
this->networkSync = nullptr;
|
||||||
this->actuationRoot = nullptr;
|
this->actuation = nullptr;
|
||||||
this->worldPosition = Vector3::zero;
|
this->worldPosition = Vector3::zero;
|
||||||
// this->worldOrientation = Quaternion::identity;
|
// this->worldOrientation = Quaternion::identity;
|
||||||
this->worldAngleAxis = AngleAxis();
|
this->worldAngleAxis = AngleAxis();
|
||||||
@ -37,15 +37,15 @@ Roboid::Roboid(Perception *perception, Propulsion *propulsion) : Roboid() {
|
|||||||
propulsion->roboid = this;
|
propulsion->roboid = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Roboid::Roboid(Perception *perception, ServoMotor *actuationRoot) : Roboid() {
|
Roboid::Roboid(Perception *perception, ServoMotor *actuation) : Roboid() {
|
||||||
this->perception = perception;
|
this->perception = perception;
|
||||||
perception->roboid = this;
|
perception->roboid = this;
|
||||||
this->propulsion = nullptr;
|
this->propulsion = nullptr;
|
||||||
|
|
||||||
this->actuationRoot = actuationRoot;
|
this->actuation = actuation;
|
||||||
}
|
}
|
||||||
|
|
||||||
Roboid::Roboid(ServoMotor *actuationRoot) : actuationRoot(actuationRoot) {}
|
Roboid::Roboid(ServoMotor *actuation) : actuation(actuation) {}
|
||||||
|
|
||||||
void Roboid::Update(float currentTimeMs) {
|
void Roboid::Update(float currentTimeMs) {
|
||||||
if (perception != nullptr)
|
if (perception != nullptr)
|
||||||
@ -64,8 +64,8 @@ void Roboid::Update(float currentTimeMs) {
|
|||||||
Vector3::up));
|
Vector3::up));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actuationRoot != nullptr)
|
if (actuation != nullptr)
|
||||||
actuationRoot->Update(currentTimeMs);
|
actuation->Update(currentTimeMs);
|
||||||
|
|
||||||
if (networkSync != nullptr)
|
if (networkSync != nullptr)
|
||||||
networkSync->NetworkUpdate(this);
|
networkSync->NetworkUpdate(this);
|
||||||
|
4
Roboid.h
4
Roboid.h
@ -20,7 +20,7 @@ public:
|
|||||||
/// @param propulsion The Propulsion implementation to use for this Roboid
|
/// @param propulsion The Propulsion implementation to use for this Roboid
|
||||||
Roboid(Perception *perception, Propulsion *propulsion = nullptr);
|
Roboid(Perception *perception, Propulsion *propulsion = nullptr);
|
||||||
|
|
||||||
Roboid(Perception *perception, ServoMotor *actuationRoot);
|
Roboid(Perception *perception, ServoMotor *actuation);
|
||||||
|
|
||||||
Roboid(ServoMotor *actuationRoot);
|
Roboid(ServoMotor *actuationRoot);
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ public:
|
|||||||
Perception *perception = nullptr;
|
Perception *perception = nullptr;
|
||||||
/// @brief The Propulsion module of this Roboid
|
/// @brief The Propulsion module of this Roboid
|
||||||
Propulsion *propulsion = nullptr;
|
Propulsion *propulsion = nullptr;
|
||||||
ServoMotor *actuationRoot = nullptr;
|
ServoMotor *actuation = nullptr;
|
||||||
|
|
||||||
/// @brief The reference to the module to synchronize states across a network
|
/// @brief The reference to the module to synchronize states across a network
|
||||||
NetworkSync *networkSync = nullptr;
|
NetworkSync *networkSync = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user