From fabd662ff92928a0ee4faa1aafd709d8245b300e Mon Sep 17 00:00:00 2001 From: chapulina Date: Fri, 2 Jun 2017 11:55:32 -0700 Subject: [PATCH] make sure pre-existing models are not mistaken to be insertions --- gazebo/physics/World.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gazebo/physics/World.cc b/gazebo/physics/World.cc index 8bbabb234b..4e0a24b9e4 100644 --- a/gazebo/physics/World.cc +++ b/gazebo/physics/World.cc @@ -2139,7 +2139,7 @@ void World::SetState(const WorldState &_state) { boost::mutex::scoped_lock lock(this->dataPtr->factoryDeleteMutex); - // FIXME: We need to publish a light facotry message to update the client, + // FIXME: We need to publish a light factory message to update the client, // see issue #2288 // LightPtr light = this->LoadLight(elem, this->dataPtr->rootElement); // light->Init(); @@ -2551,8 +2551,16 @@ void World::LogWorker() // moving link may never be captured if only diff state is recorded. boost::mutex::scoped_lock bLock(this->dataPtr->logBufferMutex); - auto insertions = diffState.Insertions(); - this->dataPtr->prevStates[currState].SetInsertions(insertions); + static bool firstUpdate = true; + if (!firstUpdate) + { + // The first update thinks there are entities being inserted, + // but they're already present in the first world dump + auto insertions = diffState.Insertions(); + this->dataPtr->prevStates[currState].SetInsertions(insertions); + } + else + firstUpdate = false; auto deletions = diffState.Deletions(); this->dataPtr->prevStates[currState].SetDeletions(deletions);