1. MPI_Allgatherv, version 0.5.3

2. modify the logical bug, make robots that not computed in local gazebo become static
This commit is contained in:
zhangshuai 2019-07-18 20:47:23 +08:00
parent 90bfe4dc1d
commit 973375692c
1 changed files with 19 additions and 4 deletions

View File

@ -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);
}
}
}
}
}