diff --git a/Gazebo_Distributed_MPI/gazebo/physics/World.cc b/Gazebo_Distributed_MPI/gazebo/physics/World.cc index b4c8f0d..5184b17 100644 --- a/Gazebo_Distributed_MPI/gazebo/physics/World.cc +++ b/Gazebo_Distributed_MPI/gazebo/physics/World.cc @@ -1851,47 +1851,26 @@ void World::ModelUpdateSingleLoop() { // Update all the models /// original part - //for (unsigned int i = 0; i < this->dataPtr->rootElement->GetChildCount(); i++) - // this->dataPtr->rootElement->GetChild(i)->Update(); + for (unsigned int i = 0; i < this->dataPtr->rootElement->GetChildCount(); i++) + this->dataPtr->rootElement->GetChild(i)->Update(); /// original part - // test by zhangshuai 2019.07.09 ----Begin - // for (unsigned int i = 0; i < this->dataPtr->rootElement->GetChildCount(); i++) + // // Modified by zhangshuai for MPI 2019.07.11 ----Begin + // if (this->flag == 1) // { - // this->dataPtr->rootElement->GetChild(i)->Update(); - // std::cout << "GetChildCount() : " << this->dataPtr->rootElement->GetChildCount() << std::endl; - // std::cout << "GetChild(" << i << ") : " << this->dataPtr->rootElement->GetChild(i)->GetName() << std::endl; - // std::cout << "rootElement->GetName() : " << this->dataPtr->rootElement->GetName() << std::endl; - // std::cout << "this->GetModelCount() : " << this->GetModelCount() << std::endl; + // for (unsigned int i = 0; i < this->GetOwnModelCount(); i++) + // { + // this->GetOwnModel(i)->Update(); + // } // } - // test by zhangshuai 2019.07.09 ----End - - // test by zhangshuai 2019.07.10 ----Begin - // for (unsigned int i = 0; i < this->GetModelCount(); i++) + // else // { - // this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModel(i)->Update(); - // this->GetModel(i)->Update(); - // std::cout << "this->GetModelCount() : " << this->GetModelCount() << std::endl; - // std::cout << "this->GetModel(i)->GetName() : " << this->GetModel(i)->GetName() << std::endl; + // for (unsigned int i = 0; i < this->dataPtr->rootElement->GetChildCount(); i++) + // { + // this->dataPtr->rootElement->GetChild(i)->Update(); + // } // } - // test by zhangshuai 2019.07.10 ----End - - // Modified by zhangshuai for MPI 2019.07.11 ----Begin - if (this->flag == 1) - { - for (unsigned int i = 0; i < this->GetOwnModelCount(); i++) - { - this->GetOwnModel(i)->Update(); - } - } - else - { - for (unsigned int i = 0; i < this->dataPtr->rootElement->GetChildCount(); i++) - { - this->dataPtr->rootElement->GetChild(i)->Update(); - } - } - // Modified by zhangshuai for MPI 2019.07.11 ----End + // // Modified by zhangshuai for MPI 2019.07.11 ----End } ////////////////////////////////////////////////// @@ -1920,9 +1899,9 @@ void World::LoadPlugins() if (this->flag == 1) { // Judge if the model to load is simulated in this gazebo - for (unsigned int i = 0; i < this->GetOwnModelCount(); i++) + for (unsigned int j = 0; j < this->GetOwnModelCount(); j++) { - if (model->GetName() == this->GetOwnModel(i)->GetName()) + if (model->GetName() == this->GetOwnModel(j)->GetName()) model->LoadPlugins(); } }