diff --git a/NetworkSync.cpp b/NetworkSync.cpp index ccaa630..22a2a05 100644 --- a/NetworkSync.cpp +++ b/NetworkSync.cpp @@ -43,6 +43,15 @@ void NetworkSync::ReceiveNetworkId() { } } +void NetworkSync::BroadcastState(Roboid *roboid) +{ + // if (roboid->updated == false) + // return; + + SendPose(roboid); + BroadcastPerception(roboid); +} + void NetworkSync::NewObject(InterestingThing* thing) { if (thing == nullptr || thing->networkId != 0x00) return; @@ -201,6 +210,13 @@ void NetworkSync::PublishClient() { #endif } +void NetworkSync::BroadcastPerception(Roboid *roboid) { + if (roboid->perception == nullptr) + return; + + PublishTrackedObjects(roboid, roboid->perception->GetTrackedObjects()); +} + void NetworkSync::PublishTrackedObjects(Roboid* roboid, InterestingThing** objects) { if (networkId == 0) // We're not connected to a site yet diff --git a/NetworkSync.h b/NetworkSync.h index 13f9d59..47432e5 100644 --- a/NetworkSync.h +++ b/NetworkSync.h @@ -58,6 +58,8 @@ class NetworkSync { void ReceiveNetworkId(); + void BroadcastState(Roboid* roboid); + void SendInvestigate(InterestingThing* thing); void SendPoseMsg(Buffer sendBuffer, Roboid* roboid); @@ -65,6 +67,7 @@ class NetworkSync { // void PublishNewObject(); void PublishRelativeThing(Thing* thing, bool recurse = false); + void BroadcastPerception(Roboid *roboid); void PublishTrackedObjects(Roboid* roboid, InterestingThing** objects); virtual void SendPosition(Vector3 worldPosition) {};