diff --git a/Gazebo_Distributed_MPI/gazebo/physics/World.cc b/Gazebo_Distributed_MPI/gazebo/physics/World.cc index 523af92..0fd780f 100644 --- a/Gazebo_Distributed_MPI/gazebo/physics/World.cc +++ b/Gazebo_Distributed_MPI/gazebo/physics/World.cc @@ -965,9 +965,6 @@ void World::Update() for (int k = 0; k < tmp_gazebo_id; k++) displs[tmp_gazebo_id] = displs[tmp_gazebo_id] + bufferLen[k]; - std::cout << "*************$$$$$$$$$ bufferLen:" << bufferLen[tmp_gazebo_id] << " $$$$$$$$$$***************" << std::endl; - std::cout << "*************$$$$$$$$$ displs: " << displs[tmp_gazebo_id] << " $$$$$$$$$$***************" << std::endl; - if (this->gazeboLocalID == tmp_gazebo_id) { sendBuffer = new char[bufferLen[tmp_gazebo_id] + 1]; @@ -984,8 +981,6 @@ void World::Update() receiveBuffer = new char[receiveBufferLen + 1]; receiveBuffer[receiveBufferLen] = '\0'; - std::cout << "*************$$$$$$$$$ bufferLen:" << receiveBufferLen << " $$$$$$$$$$***************" << std::endl; - // Added by zhangshuai 2019.04.03 for count time ----Begin #ifdef USE_COUNT_TIME gettimeofday(&tv, NULL); @@ -1018,12 +1013,12 @@ void World::Update() // Added by zhangshuai 2019.04.03 for count time ----End //receive and get information from other processes - for (int tmp_gazebo_id = 0; tmp_gazebo_id < this->distribution->GetGazeboCount(); tmp_gazebo_id++) + for (int tmp_gazebo_id = 0; tmp_gazebo_id < tmp_gazebo_count; tmp_gazebo_id++) { if (this->gazeboLocalID != tmp_gazebo_id) { - std::string receive_messages; - for (int j = displs[tmp_gazebo_id]; j < bufferLen[tmp_gazebo_id]; j++) + std::string receive_messages = ""; + for (int j = displs[tmp_gazebo_id]; j < (displs[tmp_gazebo_id] + bufferLen[tmp_gazebo_id]); j++) { receive_messages.push_back(receiveBuffer[j]); } @@ -1037,7 +1032,6 @@ void World::Update() { math::Pose tmp_pose; std::string tmp_model_name = modelPoseListReceive.pose(i).name(); - std::cout << "*************$$$$$$$$$ model_name:" << tmp_model_name << " $$$$$$$$$$***************" << std::endl; tmp_pose.pos.x = modelPoseListReceive.pose(i).position().x(); tmp_pose.pos.y = modelPoseListReceive.pose(i).position().y(); tmp_pose.pos.z = modelPoseListReceive.pose(i).position().z(); diff --git a/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_launch.sh b/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_launch.sh index 4a0669d..b94a9dd 100755 --- a/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_launch.sh +++ b/Gazebo_Distributed_MPI/mpi_run/MPI_Gazebo_launch.sh @@ -81,7 +81,7 @@ do echo "${hosts[$i]}:start_good" done -sleep 3m +sleep 5m #登入各节点kill相关进程以结束仿真(1.目前方式比较暴力,后续改进;2.cd ~/MPI 还要进行灵活性优化) for((i=0;i