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