29 static const double timeout = 0.000001;
48 if (!ros::isInitialized())
56 ros::init_options::NoSigintHandler
60 this->
rosNode.reset(
new ros::NodeHandle(
"gazebo_client"));
62 ros::AdvertiseServiceOptions reset_simulation_aso =
63 ros::AdvertiseServiceOptions::create<std_srvs::Empty>(
64 "/" + std::string(
"my_robot") +
"/reset_simulation_terrain",
78 std_srvs::Empty::Response &_res)
82 physics::Model_V models = this->
world->Models();
97 for (
auto ptr : models)
99 std::string name = ptr->GetName();
100 std::cout << name << std::endl;
103 models = this->
world->Models();
105 for (
auto ptr: models)
107 std::string name = ptr->GetName();
108 std::cout << name << std::endl;
111 this->
world->RemoveModel(
"terrain");
112 this->
world->InsertModelFile(
"model://terrain_description");
113 this->
world->DisableAllModels();
114 this->
world->EnableAllModels();
115 this->
world->Reset();
117 std_srvs::Empty srv_call;
virtual void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf)
The Load function is called by Gazebo when the plugin is inserted into simulation.
ros::CallbackQueue rosProcessQueue
ROS callbackque that helps process messages.
ros::ServiceServer resetSimService
ROS Reset Simulation Service.
physics::WorldPtr world
Pointer to the world.
std::unique_ptr< ros::NodeHandle > rosNode
Node used for ROS transport.
void ProcessQueueThread()
std::thread rosProcessQueueThread
Thread running the rosProcessQueue.
ros::ServiceClient tetrapodResetService
void InitRosQueueThreads()
bool ResetSimulation(const std_srvs::Empty::Request &_req, std_srvs::Empty::Response &_res)