From 837f077c850f8880b347619761f932fd849ac27a Mon Sep 17 00:00:00 2001 From: zhangshuai Date: Mon, 8 Apr 2019 08:40:23 +0800 Subject: [PATCH] Add judgement of flag to decide whether load distribution element --- Gazebo_Distributed/gazebo/physics/World.cc | 9 +- .../launch/hector_10_single_gazebo.launch | 126 +++++++ .../launch/hector_2_single_gazebo.launch | 39 ++ .../launch/hector_30_single_gazebo.launch | 346 ++++++++++++++++++ .../launch/hector_4_single_gazebo.launch | 61 +++ .../worlds/kunming_airport.world | 2 +- 6 files changed, 579 insertions(+), 4 deletions(-) create mode 100644 Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_10_single_gazebo.launch create mode 100644 Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_2_single_gazebo.launch create mode 100644 Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_30_single_gazebo.launch create mode 100644 Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_4_single_gazebo.launch diff --git a/Gazebo_Distributed/gazebo/physics/World.cc b/Gazebo_Distributed/gazebo/physics/World.cc index e09ee2e..b3c0743 100644 --- a/Gazebo_Distributed/gazebo/physics/World.cc +++ b/Gazebo_Distributed/gazebo/physics/World.cc @@ -283,10 +283,13 @@ void World::Load(sdf::ElementPtr _sdf) std::cout << "================= gazebo_local_ID: " << gazeboLocalID << "\t Port: " << port << "\t Flag: " << flag << " =================" << std::endl; - DistributionPtr distribution_tmp(new physics::Distribution()); + if (1 == this->flag) + { + DistributionPtr distribution_tmp(new physics::Distribution()); - this->distribution = distribution_tmp; - this->distribution->Load(distributionElem); + this->distribution = distribution_tmp; + this->distribution->Load(distributionElem); + } std::cout << "================= gazebo_counts: " << this->distribution->GetGazeboCount() << " =================" << std::endl; std::cout << "================= gazebo_ID: " << this->distribution->GetGazeboIDPtr(gazeboLocalID)->GetGazeboID() << " =================" << std::endl; diff --git a/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_10_single_gazebo.launch b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_10_single_gazebo.launch new file mode 100644 index 0000000..fb6ebb7 --- /dev/null +++ b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_10_single_gazebo.launch @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_2_single_gazebo.launch b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_2_single_gazebo.launch new file mode 100644 index 0000000..d174d72 --- /dev/null +++ b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_2_single_gazebo.launch @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_30_single_gazebo.launch b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_30_single_gazebo.launch new file mode 100644 index 0000000..ffaec28 --- /dev/null +++ b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_30_single_gazebo.launch @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_4_single_gazebo.launch b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_4_single_gazebo.launch new file mode 100644 index 0000000..9f8ad8c --- /dev/null +++ b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/launch/hector_4_single_gazebo.launch @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport.world b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport.world index 77c5639..de9ca87 100644 --- a/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport.world +++ b/Gazebo_Hector_Test/src/hector_quadrotor/hector_quadrotor_gazebo/worlds/kunming_airport.world @@ -31,7 +31,7 @@ - + bebop_0 bebop_1