From 973375692c42eaed6e60027f76cc6a4cb1832357 Mon Sep 17 00:00:00 2001 From: zhangshuai Date: Thu, 18 Jul 2019 20:47:23 +0800 Subject: [PATCH] 1. MPI_Allgatherv, version 0.5.3 2. modify the logical bug, make robots that not computed in local gazebo become static --- .../gazebo/physics/World.cc | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Gazebo_Distributed_MPI/gazebo/physics/World.cc b/Gazebo_Distributed_MPI/gazebo/physics/World.cc index 110de1d..51fcc5d 100644 --- a/Gazebo_Distributed_MPI/gazebo/physics/World.cc +++ b/Gazebo_Distributed_MPI/gazebo/physics/World.cc @@ -1352,15 +1352,30 @@ ModelPtr World::LoadModel(sdf::ElementPtr _sdf, BasePtr _parent) // Added by zhangshuai for MPI 2019.07.11 ----Begin if (this->flag == 1) { - for (unsigned int i = 0; i < this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelCount(); i++) + int tmp_gazebo_count = this->distribution->GetGazeboCount(); + for (int tmp_gazebo_id = 0; tmp_gazebo_id < tmp_gazebo_count; tmp_gazebo_id++) { - if (model->GetName() == this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetModelName(i)) + if (this->gazeboLocalID == tmp_gazebo_id) { - this->dataPtr->ownModels.push_back(model); + unsigned int tmp_model_count = this->distribution->GetGazeboIDPtr(tmp_gazebo_id)->GetModelCount(); + for (unsigned int j = 0; j < tmp_model_count; j++) + { + if (model->GetName() == this->distribution->GetGazeboIDPtr(tmp_gazebo_id)->GetModelName(j)) + { + this->dataPtr->ownModels.push_back(model); + } + } } else { - model->SetStatic(true); // Added by zhangshuai for MPI 2019.07.18 + unsigned int tmp_model_count = this->distribution->GetGazeboIDPtr(tmp_gazebo_id)->GetModelCount(); + for (unsigned int j = 0; j < tmp_model_count; j++) + { + if (model->GetName() == this->distribution->GetGazeboIDPtr(tmp_gazebo_id)->GetModelName(j)) + { + model->SetStatic(true); + } + } } } }