gazebo_ros_api_plugin.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 /*
18  * Desc: External interfaces for Gazebo
19  * Author: Nate Koenig, John Hsu, Dave Coleman
20  * Date: 25 Apr 2010
21  */
22 
23 #ifndef __GAZEBO_ROS_API_PLUGIN_HH__
24 #define __GAZEBO_ROS_API_PLUGIN_HH__
25 
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <signal.h>
29 #include <errno.h>
30 #include <iostream>
31 
32 #include <tinyxml.h>
33 
34 #include <gazebo/physics/physics.hh>
35 #include <gazebo/common/common.hh>
36 #include <gazebo/transport/transport.hh>
37 
38 // ROS
39 #include <ros/ros.h>
40 #include <ros/callback_queue.h>
41 #include <ros/subscribe_options.h>
42 #include <ros/package.h>
43 #include <rosgraph_msgs/Clock.h>
44 
45 // Services
46 #include "std_srvs/Empty.h"
47 
48 #include "gazebo_msgs/JointRequest.h"
49 #include "gazebo_msgs/BodyRequest.h"
50 
51 #include "gazebo_msgs/SpawnModel.h"
52 #include "gazebo_msgs/DeleteModel.h"
53 #include "gazebo_msgs/DeleteLight.h"
54 
55 #include "gazebo_msgs/ApplyBodyWrench.h"
56 
57 #include "gazebo_msgs/SetPhysicsProperties.h"
58 #include "gazebo_msgs/GetPhysicsProperties.h"
59 
60 #include "gazebo_msgs/SetJointProperties.h"
61 
62 #include "gazebo_msgs/GetWorldProperties.h"
63 
64 #include "gazebo_msgs/GetModelProperties.h"
65 #include "gazebo_msgs/GetModelState.h"
66 #include "gazebo_msgs/SetModelState.h"
67 
68 #include "gazebo_msgs/GetJointProperties.h"
69 #include "gazebo_msgs/ApplyJointEffort.h"
70 
71 #include "gazebo_msgs/GetLinkProperties.h"
72 #include "gazebo_msgs/SetLinkProperties.h"
73 #include "gazebo_msgs/SetLinkState.h"
74 #include "gazebo_msgs/GetLinkState.h"
75 
76 #include "gazebo_msgs/GetLightProperties.h"
77 #include "gazebo_msgs/SetLightProperties.h"
78 
79 // Topics
80 #include "gazebo_msgs/ModelState.h"
81 #include "gazebo_msgs/LinkState.h"
82 #include "gazebo_msgs/ModelStates.h"
83 #include "gazebo_msgs/LinkStates.h"
84 #include "gazebo_msgs/PerformanceMetrics.h"
85 
86 #include "geometry_msgs/Vector3.h"
87 #include "geometry_msgs/Wrench.h"
88 #include "geometry_msgs/Pose.h"
89 #include "geometry_msgs/Twist.h"
90 
91 // For model pose transform to set custom joint angles
92 #include <ros/ros.h>
93 #include <gazebo_msgs/SetModelConfiguration.h>
94 #include <boost/shared_ptr.hpp>
95 
96 // For physics dynamics reconfigure
97 #include <dynamic_reconfigure/server.h>
98 #include <gazebo_ros/PhysicsConfig.h>
99 #include "gazebo_msgs/SetPhysicsProperties.h"
100 #include "gazebo_msgs/GetPhysicsProperties.h"
101 
102 #include <boost/algorithm/string.hpp>
103 
104 #ifndef GAZEBO_ROS_HAS_PERFORMANCE_METRICS
105 #if (GAZEBO_MAJOR_VERSION == 11 && GAZEBO_MINOR_VERSION > 1) || \
106  (GAZEBO_MAJOR_VERSION == 9 && GAZEBO_MINOR_VERSION > 14)
107 #define GAZEBO_ROS_HAS_PERFORMANCE_METRICS
108 #endif
109 #endif // ifndef GAZEBO_ROS_HAS_PERFORMANCE_METRICS
110 
111 namespace gazebo
112 {
113 
115 class GazeboRosApiPlugin : public SystemPlugin
116 {
117 public:
120 
123 
125  void shutdownSignal();
126 
133  void Load(int argc, char** argv);
134 
136  void gazeboQueueThread();
137 
139  void advertiseServices();
140 
142  void onLinkStatesConnect();
143 
145  void onModelStatesConnect();
146 
148  void onLinkStatesDisconnect();
149 
152 
153 #ifdef GAZEBO_ROS_HAS_PERFORMANCE_METRICS
154  void onPerformanceMetricsConnect();
156 
158  void onPerformanceMetricsDisconnect();
159 #endif
160 
162  bool spawnURDFModel(gazebo_msgs::SpawnModel::Request &req,
163  gazebo_msgs::SpawnModel::Response &res);
164 
166  bool spawnSDFModel(gazebo_msgs::SpawnModel::Request &req,
167  gazebo_msgs::SpawnModel::Response &res);
168 
170  bool deleteModel(gazebo_msgs::DeleteModel::Request &req,gazebo_msgs::DeleteModel::Response &res);
171 
173  bool deleteLight(gazebo_msgs::DeleteLight::Request &req,gazebo_msgs::DeleteLight::Response &res);
174 
176  bool getModelState(gazebo_msgs::GetModelState::Request &req,gazebo_msgs::GetModelState::Response &res);
177 
179  bool getModelProperties(gazebo_msgs::GetModelProperties::Request &req,gazebo_msgs::GetModelProperties::Response &res);
180 
182  bool getWorldProperties(gazebo_msgs::GetWorldProperties::Request &req,gazebo_msgs::GetWorldProperties::Response &res);
183 
185  bool getJointProperties(gazebo_msgs::GetJointProperties::Request &req,gazebo_msgs::GetJointProperties::Response &res);
186 
188  bool getLinkProperties(gazebo_msgs::GetLinkProperties::Request &req,gazebo_msgs::GetLinkProperties::Response &res);
189 
191  bool getLinkState(gazebo_msgs::GetLinkState::Request &req,gazebo_msgs::GetLinkState::Response &res);
192 
194  bool getLightProperties(gazebo_msgs::GetLightProperties::Request &req,gazebo_msgs::GetLightProperties::Response &res);
195 
197  bool setLightProperties(gazebo_msgs::SetLightProperties::Request &req,gazebo_msgs::SetLightProperties::Response &res);
198 
200  bool setLinkProperties(gazebo_msgs::SetLinkProperties::Request &req,gazebo_msgs::SetLinkProperties::Response &res);
201 
203  bool setPhysicsProperties(gazebo_msgs::SetPhysicsProperties::Request &req,gazebo_msgs::SetPhysicsProperties::Response &res);
204 
206  bool getPhysicsProperties(gazebo_msgs::GetPhysicsProperties::Request &req,gazebo_msgs::GetPhysicsProperties::Response &res);
207 
209  bool setJointProperties(gazebo_msgs::SetJointProperties::Request &req,gazebo_msgs::SetJointProperties::Response &res);
210 
212  bool setModelState(gazebo_msgs::SetModelState::Request &req,gazebo_msgs::SetModelState::Response &res);
213 
215  void updateModelState(const gazebo_msgs::ModelState::ConstPtr& model_state);
216 
218  bool applyJointEffort(gazebo_msgs::ApplyJointEffort::Request &req,gazebo_msgs::ApplyJointEffort::Response &res);
219 
221  bool resetSimulation(std_srvs::Empty::Request &req,std_srvs::Empty::Response &res);
222 
224  bool resetWorld(std_srvs::Empty::Request &req,std_srvs::Empty::Response &res);
225 
227  bool pausePhysics(std_srvs::Empty::Request &req,std_srvs::Empty::Response &res);
228 
230  bool unpausePhysics(std_srvs::Empty::Request &req,std_srvs::Empty::Response &res);
231 
233  bool clearJointForces(gazebo_msgs::JointRequest::Request &req,gazebo_msgs::JointRequest::Response &res);
234  bool clearJointForces(std::string joint_name);
235 
237  bool clearBodyWrenches(gazebo_msgs::BodyRequest::Request &req,gazebo_msgs::BodyRequest::Response &res);
238  bool clearBodyWrenches(std::string body_name);
239 
241  bool setModelConfiguration(gazebo_msgs::SetModelConfiguration::Request &req,gazebo_msgs::SetModelConfiguration::Response &res);
242 
244  bool setLinkState(gazebo_msgs::SetLinkState::Request &req,gazebo_msgs::SetLinkState::Response &res);
245 
247  void updateLinkState(const gazebo_msgs::LinkState::ConstPtr& link_state);
248 
250  bool applyBodyWrench(gazebo_msgs::ApplyBodyWrench::Request &req,gazebo_msgs::ApplyBodyWrench::Response &res);
251 
252 private:
253 
256 
259 
263  void publishSimTime();
264 
266  void publishLinkStates();
267 
269  void publishModelStates();
270 
272  void stripXmlDeclaration(std::string &model_xml);
273 
275  void updateSDFAttributes(TiXmlDocument &gazebo_model_xml,
276  const std::string &model_name,
277  const ignition::math::Vector3d &initial_xyz,
278  const ignition::math::Quaterniond &initial_q);
279 
281  void updateURDFModelPose(TiXmlDocument &gazebo_model_xml,
282  const ignition::math::Vector3d &initial_xyz,
283  const ignition::math::Quaterniond &initial_q);
284 
286  void updateURDFName(TiXmlDocument &gazebo_model_xml, const std::string &model_name);
287 
289  void walkChildAddRobotNamespace(TiXmlNode* model_xml);
290 
292  bool spawnAndConform(TiXmlDocument &gazebo_model_xml, const std::string &model_name,
293  gazebo_msgs::SpawnModel::Response &res);
294 
297  void transformWrench(ignition::math::Vector3d &target_force, ignition::math::Vector3d &target_torque,
298  const ignition::math::Vector3d &reference_force,
299  const ignition::math::Vector3d &reference_torque,
300  const ignition::math::Pose3d &target_to_reference );
301 
303  void physicsReconfigureCallback(gazebo_ros::PhysicsConfig &config, uint32_t level);
304 
307 
309  void onResponse(ConstResponsePtr &response);
310 
311 #ifdef GAZEBO_ROS_HAS_PERFORMANCE_METRICS
312  void onPerformanceMetrics(const boost::shared_ptr<gazebo::msgs::PerformanceMetrics const> &msg);
314 #endif
315  bool isURDF(std::string model_xml);
317 
319  bool isSDF(std::string model_xml);
320 
322  void loadGazeboRosApiPlugin(std::string world_name);
323 
325  ignition::math::Pose3d parsePose(const std::string &str);
326 
328  ignition::math::Vector3d parseVector3(const std::string &str);
329 
330  // track if the desconstructor event needs to occur
332 
333  // detect if sigint event occurs
334  bool stop_;
335  gazebo::event::ConnectionPtr sigint_event_;
336 
337  std::string robot_namespace_;
338 
339  gazebo::transport::NodePtr gazebonode_;
340  gazebo::transport::SubscriberPtr stat_sub_;
341  gazebo::transport::PublisherPtr factory_pub_;
342  gazebo::transport::PublisherPtr factory_light_pub_;
343  gazebo::transport::PublisherPtr light_modify_pub_;
344  gazebo::transport::SubscriberPtr performance_metric_sub_;
345  gazebo::transport::PublisherPtr request_pub_;
346  gazebo::transport::SubscriberPtr response_sub_;
347 
351 
352  gazebo::physics::WorldPtr world_;
353  gazebo::event::ConnectionPtr wrench_update_event_;
354  gazebo::event::ConnectionPtr force_update_event_;
355  gazebo::event::ConnectionPtr time_update_event_;
356  gazebo::event::ConnectionPtr pub_link_states_event_;
357  gazebo::event::ConnectionPtr pub_model_states_event_;
358  gazebo::event::ConnectionPtr load_gazebo_ros_api_plugin_event_;
359 
395 
396  // ROS comm
398 
399  // physics dynamic reconfigure
405  dynamic_reconfigure::Server<gazebo_ros::PhysicsConfig>::CallbackType physics_reconfigure_callback_;
406 
409  gazebo::common::Time last_pub_clock_time_;
410 
412  boost::mutex lock_;
413 
415 
417  {
418  public:
419  gazebo::physics::LinkPtr body;
420  ignition::math::Vector3d force;
421  ignition::math::Vector3d torque;
424  };
425 
427  {
428  public:
429  gazebo::physics::JointPtr joint;
430  double force; // should this be a array?
433  };
434 
435  std::vector<GazeboRosApiPlugin::WrenchBodyJob*> wrench_body_jobs_;
436  std::vector<GazeboRosApiPlugin::ForceJointJob*> force_joint_jobs_;
437 
439  std::map<std::string, unsigned int> access_count_get_model_state_;
440 
443 };
444 }
445 #endif
gazebo::GazeboRosApiPlugin::applyJointEffort
bool applyJointEffort(gazebo_msgs::ApplyJointEffort::Request &req, gazebo_msgs::ApplyJointEffort::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1671
response
const std::string response
gazebo::GazeboRosApiPlugin::apply_body_wrench_service_
ros::ServiceServer apply_body_wrench_service_
Definition: gazebo_ros_api_plugin.h:375
gazebo::GazeboRosApiPlugin::WrenchBodyJob::force
ignition::math::Vector3d force
Definition: gazebo_ros_api_plugin.h:420
gazebo::GazeboRosApiPlugin::set_link_state_topic_
ros::Subscriber set_link_state_topic_
Definition: gazebo_ros_api_plugin.h:387
gazebo::GazeboRosApiPlugin::setLinkProperties
bool setLinkProperties(gazebo_msgs::SetLinkProperties::Request &req, gazebo_msgs::SetLinkProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1402
gazebo::GazeboRosApiPlugin::lock_
boost::mutex lock_
A mutex to lock access to fields that are used in ROS message callbacks.
Definition: gazebo_ros_api_plugin.h:412
gazebo::GazeboRosApiPlugin::last_pub_clock_time_
gazebo::common::Time last_pub_clock_time_
Definition: gazebo_ros_api_plugin.h:409
ros::Publisher
gazebo::GazeboRosApiPlugin::getLinkProperties
bool getLinkProperties(gazebo_msgs::GetLinkProperties::Request &req, gazebo_msgs::GetLinkProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1174
gazebo::GazeboRosApiPlugin::updateLinkState
void updateLinkState(const gazebo_msgs::LinkState::ConstPtr &link_state)
Definition: gazebo_ros_api_plugin.cpp:1918
gazebo::GazeboRosApiPlugin::set_link_properties_service_
ros::ServiceServer set_link_properties_service_
Definition: gazebo_ros_api_plugin.h:372
gazebo::GazeboRosApiPlugin::clear_body_wrenches_service_
ros::ServiceServer clear_body_wrenches_service_
Definition: gazebo_ros_api_plugin.h:386
gazebo::GazeboRosApiPlugin::gazeboQueueThread
void gazeboQueueThread()
ros queue thread for this node
Definition: gazebo_ros_api_plugin.cpp:257
gazebo::GazeboRosApiPlugin::pub_model_states_
ros::Publisher pub_model_states_
Definition: gazebo_ros_api_plugin.h:390
gazebo::GazeboRosApiPlugin::reset_world_service_
ros::ServiceServer reset_world_service_
Definition: gazebo_ros_api_plugin.h:382
gazebo::GazeboRosApiPlugin::unpausePhysics
bool unpausePhysics(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1731
boost::shared_ptr
gazebo
Definition: gazebo_ros_api_plugin.h:111
gazebo::GazeboRosApiPlugin::isSDF
bool isSDF(std::string model_xml)
utility for checking if string is in SDF format
Definition: gazebo_ros_api_plugin.cpp:2083
gazebo::GazeboRosApiPlugin::stat_sub_
gazebo::transport::SubscriberPtr stat_sub_
Definition: gazebo_ros_api_plugin.h:340
gazebo::GazeboRosApiPlugin::setJointProperties
bool setJointProperties(gazebo_msgs::SetJointProperties::Request &req, gazebo_msgs::SetJointProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1531
gazebo::GazeboRosApiPlugin::resetSimulation
bool resetSimulation(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1713
gazebo::GazeboRosApiPlugin::pub_performance_metrics_connection_count_
int pub_performance_metrics_connection_count_
Definition: gazebo_ros_api_plugin.h:394
gazebo::GazeboRosApiPlugin::delete_light_service_
ros::ServiceServer delete_light_service_
Definition: gazebo_ros_api_plugin.h:363
gazebo::GazeboRosApiPlugin::pub_link_states_
ros::Publisher pub_link_states_
Definition: gazebo_ros_api_plugin.h:389
gazebo::GazeboRosApiPlugin::ForceJointJob
Definition: gazebo_ros_api_plugin.h:426
gazebo::GazeboRosApiPlugin::robot_namespace_
std::string robot_namespace_
Definition: gazebo_ros_api_plugin.h:337
gazebo::GazeboRosApiPlugin::world_
gazebo::physics::WorldPtr world_
Definition: gazebo_ros_api_plugin.h:352
gazebo::GazeboRosApiPlugin::Load
void Load(int argc, char **argv)
Gazebo-inherited load function.
Definition: gazebo_ros_api_plugin.cpp:117
gazebo::GazeboRosApiPlugin::onModelStatesDisconnect
void onModelStatesDisconnect()
Callback for a subscriber disconnecting from ModelStates ros topic.
Definition: gazebo_ros_api_plugin.cpp:612
gazebo::GazeboRosApiPlugin::physics_reconfigure_thread_
boost::shared_ptr< boost::thread > physics_reconfigure_thread_
Definition: gazebo_ros_api_plugin.h:400
ros.h
gazebo::GazeboRosApiPlugin::request_pub_
gazebo::transport::PublisherPtr request_pub_
Definition: gazebo_ros_api_plugin.h:345
gazebo::GazeboRosApiPlugin::set_model_state_service_
ros::ServiceServer set_model_state_service_
Definition: gazebo_ros_api_plugin.h:377
gazebo::GazeboRosApiPlugin::physics_reconfigure_srv_
boost::shared_ptr< dynamic_reconfigure::Server< gazebo_ros::PhysicsConfig > > physics_reconfigure_srv_
Definition: gazebo_ros_api_plugin.h:404
gazebo::GazeboRosApiPlugin::plugin_loaded_
bool plugin_loaded_
Definition: gazebo_ros_api_plugin.h:331
gazebo::GazeboRosApiPlugin::updateURDFName
void updateURDFName(TiXmlDocument &gazebo_model_xml, const std::string &model_name)
Update the model name of the URDF file before sending to Gazebo.
Definition: gazebo_ros_api_plugin.cpp:2605
gazebo::GazeboRosApiPlugin::light_modify_pub_
gazebo::transport::PublisherPtr light_modify_pub_
Definition: gazebo_ros_api_plugin.h:343
gazebo::GazeboRosApiPlugin::get_light_properties_service_
ros::ServiceServer get_light_properties_service_
Definition: gazebo_ros_api_plugin.h:370
gazebo::GazeboRosApiPlugin::wrench_body_jobs_
std::vector< GazeboRosApiPlugin::WrenchBodyJob * > wrench_body_jobs_
Definition: gazebo_ros_api_plugin.h:435
gazebo::GazeboRosApiPlugin::get_link_properties_service_
ros::ServiceServer get_link_properties_service_
Definition: gazebo_ros_api_plugin.h:368
gazebo::GazeboRosApiPlugin::publishLinkStates
void publishLinkStates()
Definition: gazebo_ros_api_plugin.cpp:2191
gazebo::GazeboRosApiPlugin::applyBodyWrench
bool applyBodyWrench(gazebo_msgs::ApplyBodyWrench::Request &req, gazebo_msgs::ApplyBodyWrench::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1940
gazebo::GazeboRosApiPlugin::WrenchBodyJob::start_time
ros::Time start_time
Definition: gazebo_ros_api_plugin.h:422
gazebo::GazeboRosApiPlugin::pub_model_states_event_
gazebo::event::ConnectionPtr pub_model_states_event_
Definition: gazebo_ros_api_plugin.h:357
gazebo::GazeboRosApiPlugin::getWorldProperties
bool getWorldProperties(gazebo_msgs::GetWorldProperties::Request &req, gazebo_msgs::GetWorldProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1108
gazebo::GazeboRosApiPlugin::reset_simulation_service_
ros::ServiceServer reset_simulation_service_
Definition: gazebo_ros_api_plugin.h:381
gazebo::GazeboRosApiPlugin::physics_reconfigure_initialized_
bool physics_reconfigure_initialized_
Definition: gazebo_ros_api_plugin.h:401
gazebo::GazeboRosApiPlugin::time_update_event_
gazebo::event::ConnectionPtr time_update_event_
Definition: gazebo_ros_api_plugin.h:355
gazebo::GazeboRosApiPlugin::getModelState
bool getModelState(gazebo_msgs::GetModelState::Request &req, gazebo_msgs::GetModelState::Response &res)
Definition: gazebo_ros_api_plugin.cpp:933
gazebo::GazeboRosApiPlugin::clearBodyWrenches
bool clearBodyWrenches(gazebo_msgs::BodyRequest::Request &req, gazebo_msgs::BodyRequest::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1765
gazebo::GazeboRosApiPlugin::factory_pub_
gazebo::transport::PublisherPtr factory_pub_
Definition: gazebo_ros_api_plugin.h:341
gazebo::GazeboRosApiPlugin::get_joint_properties_service_
ros::ServiceServer get_joint_properties_service_
Definition: gazebo_ros_api_plugin.h:367
gazebo::GazeboRosApiPlugin::spawn_urdf_model_service_
ros::ServiceServer spawn_urdf_model_service_
Definition: gazebo_ros_api_plugin.h:361
gazebo::GazeboRosApiPlugin::get_world_properties_service_
ros::ServiceServer get_world_properties_service_
Definition: gazebo_ros_api_plugin.h:366
gazebo::GazeboRosApiPlugin::setPhysicsProperties
bool setPhysicsProperties(gazebo_msgs::SetPhysicsProperties::Request &req, gazebo_msgs::SetPhysicsProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1432
gazebo::GazeboRosApiPlugin::setModelConfiguration
bool setModelConfiguration(gazebo_msgs::SetModelConfiguration::Request &req, gazebo_msgs::SetModelConfiguration::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1794
gazebo::GazeboRosApiPlugin::physics_reconfigure_callback_
dynamic_reconfigure::Server< gazebo_ros::PhysicsConfig >::CallbackType physics_reconfigure_callback_
Definition: gazebo_ros_api_plugin.h:405
gazebo::GazeboRosApiPlugin::onLinkStatesConnect
void onLinkStatesConnect()
Callback for a subscriber connecting to LinkStates ros topic.
Definition: gazebo_ros_api_plugin.cpp:564
gazebo::GazeboRosApiPlugin::deleteLight
bool deleteLight(gazebo_msgs::DeleteLight::Request &req, gazebo_msgs::DeleteLight::Response &res)
delete a given light by name
Definition: gazebo_ros_api_plugin.cpp:886
gazebo::GazeboRosApiPlugin::advertiseServices
void advertiseServices()
advertise services
Definition: gazebo_ros_api_plugin.cpp:266
gazebo::GazeboRosApiPlugin::access_count_get_model_state_
std::map< std::string, unsigned int > access_count_get_model_state_
index counters to count the accesses on models via GetModelState
Definition: gazebo_ros_api_plugin.h:439
gazebo::GazeboRosApiPlugin::physics_reconfigure_set_client_
ros::ServiceClient physics_reconfigure_set_client_
Definition: gazebo_ros_api_plugin.h:402
ros::ServiceServer
gazebo::GazeboRosApiPlugin::WrenchBodyJob::duration
ros::Duration duration
Definition: gazebo_ros_api_plugin.h:423
gazebo::GazeboRosApiPlugin::deleteModel
bool deleteModel(gazebo_msgs::DeleteModel::Request &req, gazebo_msgs::DeleteModel::Response &res)
delete model given name
Definition: gazebo_ros_api_plugin.cpp:815
gazebo::GazeboRosApiPlugin::parseVector3
ignition::math::Vector3d parseVector3(const std::string &str)
convert xml to Pose
Definition: gazebo_ros_api_plugin.cpp:2524
gazebo::GazeboRosApiPlugin::physics_reconfigure_get_client_
ros::ServiceClient physics_reconfigure_get_client_
Definition: gazebo_ros_api_plugin.h:403
gazebo::GazeboRosApiPlugin::sigint_event_
gazebo::event::ConnectionPtr sigint_event_
Definition: gazebo_ros_api_plugin.h:335
gazebo::GazeboRosApiPlugin::updateSDFAttributes
void updateSDFAttributes(TiXmlDocument &gazebo_model_xml, const std::string &model_name, const ignition::math::Vector3d &initial_xyz, const ignition::math::Quaterniond &initial_q)
Update the model name and pose of the SDF file before sending to Gazebo.
Definition: gazebo_ros_api_plugin.cpp:2396
gazebo::GazeboRosApiPlugin::pub_clock_
ros::Publisher pub_clock_
Definition: gazebo_ros_api_plugin.h:407
gazebo::GazeboRosApiPlugin::resetWorld
bool resetWorld(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1719
gazebo::GazeboRosApiPlugin::factory_light_pub_
gazebo::transport::PublisherPtr factory_light_pub_
Definition: gazebo_ros_api_plugin.h:342
ros::CallbackQueue
gazebo::GazeboRosApiPlugin::set_model_configuration_service_
ros::ServiceServer set_model_configuration_service_
Definition: gazebo_ros_api_plugin.h:379
gazebo::GazeboRosApiPlugin::getLinkState
bool getLinkState(gazebo_msgs::GetLinkState::Request &req, gazebo_msgs::GetLinkState::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1232
gazebo::GazeboRosApiPlugin::spawnURDFModel
bool spawnURDFModel(gazebo_msgs::SpawnModel::Request &req, gazebo_msgs::SpawnModel::Response &res)
Function for inserting a URDF into Gazebo from ROS Service Call.
Definition: gazebo_ros_api_plugin.cpp:623
gazebo::GazeboRosApiPlugin::set_light_properties_service_
ros::ServiceServer set_light_properties_service_
Definition: gazebo_ros_api_plugin.h:371
gazebo::GazeboRosApiPlugin
A plugin loaded within the gzserver on startup.
Definition: gazebo_ros_api_plugin.h:115
gazebo::GazeboRosApiPlugin::spawnSDFModel
bool spawnSDFModel(gazebo_msgs::SpawnModel::Request &req, gazebo_msgs::SpawnModel::Response &res)
Both SDFs and converted URDFs get sent to this function for further manipulation from a ROS Service c...
Definition: gazebo_ros_api_plugin.cpp:702
gazebo::GazeboRosApiPlugin::updateModelState
void updateModelState(const gazebo_msgs::ModelState::ConstPtr &model_state)
Definition: gazebo_ros_api_plugin.cpp:1663
gazebo::GazeboRosApiPlugin::onModelStatesConnect
void onModelStatesConnect()
Callback for a subscriber connecting to ModelStates ros topic.
Definition: gazebo_ros_api_plugin.cpp:571
gazebo::GazeboRosApiPlugin::set_model_state_topic_
ros::Subscriber set_model_state_topic_
Definition: gazebo_ros_api_plugin.h:388
gazebo::GazeboRosApiPlugin::getJointProperties
bool getJointProperties(gazebo_msgs::GetJointProperties::Request &req, gazebo_msgs::GetJointProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1128
gazebo::GazeboRosApiPlugin::pub_performance_metrics_
ros::Publisher pub_performance_metrics_
Definition: gazebo_ros_api_plugin.h:391
ros::ServiceClient
gazebo::GazeboRosApiPlugin::enable_ros_network_
bool enable_ros_network_
enable the communication of gazebo information using ROS service/topics
Definition: gazebo_ros_api_plugin.h:442
gazebo::GazeboRosApiPlugin::world_created_
bool world_created_
Definition: gazebo_ros_api_plugin.h:414
gazebo::GazeboRosApiPlugin::loadGazeboRosApiPlugin
void loadGazeboRosApiPlugin(std::string world_name)
Connect to Gazebo via its plugin interface, get a pointer to the world, start events.
Definition: gazebo_ros_api_plugin.cpp:166
gazebo::GazeboRosApiPlugin::setLinkState
bool setLinkState(gazebo_msgs::SetLinkState::Request &req, gazebo_msgs::SetLinkState::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1842
gazebo::GazeboRosApiPlugin::pub_model_states_connection_count_
int pub_model_states_connection_count_
Definition: gazebo_ros_api_plugin.h:393
gazebo::GazeboRosApiPlugin::updateURDFModelPose
void updateURDFModelPose(TiXmlDocument &gazebo_model_xml, const ignition::math::Vector3d &initial_xyz, const ignition::math::Quaterniond &initial_q)
Update the model pose of the URDF file before sending to Gazebo.
Definition: gazebo_ros_api_plugin.cpp:2557
gazebo::GazeboRosApiPlugin::GazeboRosApiPlugin
GazeboRosApiPlugin()
Constructor.
Definition: gazebo_ros_api_plugin.cpp:32
gazebo::GazeboRosApiPlugin::physicsReconfigureCallback
void physicsReconfigureCallback(gazebo_ros::PhysicsConfig &config, uint32_t level)
Used for the dynamic reconfigure callback function template.
Definition: gazebo_ros_api_plugin.cpp:2292
gazebo::GazeboRosApiPlugin::pub_link_states_connection_count_
int pub_link_states_connection_count_
Definition: gazebo_ros_api_plugin.h:392
gazebo::GazeboRosApiPlugin::gazebo_callback_queue_thread_
boost::shared_ptr< boost::thread > gazebo_callback_queue_thread_
Definition: gazebo_ros_api_plugin.h:350
package.h
gazebo::GazeboRosApiPlugin::force_update_event_
gazebo::event::ConnectionPtr force_update_event_
Definition: gazebo_ros_api_plugin.h:354
gazebo::GazeboRosApiPlugin::parsePose
ignition::math::Pose3d parsePose(const std::string &str)
convert xml to Pose
Definition: gazebo_ros_api_plugin.cpp:2491
gazebo::GazeboRosApiPlugin::transformWrench
void transformWrench(ignition::math::Vector3d &target_force, ignition::math::Vector3d &target_torque, const ignition::math::Vector3d &reference_force, const ignition::math::Vector3d &reference_torque, const ignition::math::Pose3d &target_to_reference)
helper function for applyBodyWrench shift wrench from reference frame to target frame
Definition: gazebo_ros_api_plugin.cpp:1926
gazebo::GazeboRosApiPlugin::apply_joint_effort_service_
ros::ServiceServer apply_joint_effort_service_
Definition: gazebo_ros_api_plugin.h:378
callback_queue.h
gazebo::GazeboRosApiPlugin::performance_metric_sub_
gazebo::transport::SubscriberPtr performance_metric_sub_
Definition: gazebo_ros_api_plugin.h:344
gazebo::GazeboRosApiPlugin::clear_joint_forces_service_
ros::ServiceServer clear_joint_forces_service_
Definition: gazebo_ros_api_plugin.h:385
gazebo::GazeboRosApiPlugin::walkChildAddRobotNamespace
void walkChildAddRobotNamespace(TiXmlNode *model_xml)
Definition: gazebo_ros_api_plugin.cpp:2623
gazebo::GazeboRosApiPlugin::setLightProperties
bool setLightProperties(gazebo_msgs::SetLightProperties::Request &req, gazebo_msgs::SetLightProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1346
gazebo::GazeboRosApiPlugin::load_gazebo_ros_api_plugin_event_
gazebo::event::ConnectionPtr load_gazebo_ros_api_plugin_event_
Definition: gazebo_ros_api_plugin.h:358
gazebo::GazeboRosApiPlugin::get_physics_properties_service_
ros::ServiceServer get_physics_properties_service_
Definition: gazebo_ros_api_plugin.h:374
gazebo::GazeboRosApiPlugin::stop_
bool stop_
Definition: gazebo_ros_api_plugin.h:334
gazebo::GazeboRosApiPlugin::pausePhysics
bool pausePhysics(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1725
gazebo::GazeboRosApiPlugin::set_link_state_service_
ros::ServiceServer set_link_state_service_
Definition: gazebo_ros_api_plugin.h:380
gazebo::GazeboRosApiPlugin::delete_model_service_
ros::ServiceServer delete_model_service_
Definition: gazebo_ros_api_plugin.h:362
gazebo::GazeboRosApiPlugin::async_ros_spin_
boost::shared_ptr< ros::AsyncSpinner > async_ros_spin_
Definition: gazebo_ros_api_plugin.h:397
gazebo::GazeboRosApiPlugin::~GazeboRosApiPlugin
~GazeboRosApiPlugin()
Destructor.
Definition: gazebo_ros_api_plugin.cpp:46
ros::Time
gazebo::GazeboRosApiPlugin::WrenchBodyJob
Definition: gazebo_ros_api_plugin.h:416
gazebo::GazeboRosApiPlugin::publishModelStates
void publishModelStates()
Definition: gazebo_ros_api_plugin.cpp:2248
gazebo::GazeboRosApiPlugin::unpause_physics_service_
ros::ServiceServer unpause_physics_service_
Definition: gazebo_ros_api_plugin.h:384
gazebo::GazeboRosApiPlugin::shutdownSignal
void shutdownSignal()
\bried Detect if sig-int shutdown signal is recieved
Definition: gazebo_ros_api_plugin.cpp:111
gazebo::GazeboRosApiPlugin::pub_clock_frequency_
int pub_clock_frequency_
Definition: gazebo_ros_api_plugin.h:408
gazebo::GazeboRosApiPlugin::WrenchBodyJob::body
gazebo::physics::LinkPtr body
Definition: gazebo_ros_api_plugin.h:419
gazebo::GazeboRosApiPlugin::set_joint_properties_service_
ros::ServiceServer set_joint_properties_service_
Definition: gazebo_ros_api_plugin.h:376
gazebo::GazeboRosApiPlugin::wrench_update_event_
gazebo::event::ConnectionPtr wrench_update_event_
Definition: gazebo_ros_api_plugin.h:353
gazebo::GazeboRosApiPlugin::spawn_sdf_model_service_
ros::ServiceServer spawn_sdf_model_service_
Definition: gazebo_ros_api_plugin.h:360
gazebo::GazeboRosApiPlugin::pause_physics_service_
ros::ServiceServer pause_physics_service_
Definition: gazebo_ros_api_plugin.h:383
gazebo::GazeboRosApiPlugin::publishSimTime
void publishSimTime()
Callback to WorldUpdateBegin that publishes /clock. If pub_clock_frequency_ <= 0 (default behavior),...
Definition: gazebo_ros_api_plugin.cpp:2169
gazebo::GazeboRosApiPlugin::ForceJointJob::start_time
ros::Time start_time
Definition: gazebo_ros_api_plugin.h:431
gazebo::GazeboRosApiPlugin::getModelProperties
bool getModelProperties(gazebo_msgs::GetModelProperties::Request &req, gazebo_msgs::GetModelProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1042
gazebo::GazeboRosApiPlugin::onResponse
void onResponse(ConstResponsePtr &response)
Unused.
Definition: gazebo_ros_api_plugin.cpp:225
gazebo::GazeboRosApiPlugin::ForceJointJob::duration
ros::Duration duration
Definition: gazebo_ros_api_plugin.h:432
gazebo::GazeboRosApiPlugin::nh_
boost::shared_ptr< ros::NodeHandle > nh_
Definition: gazebo_ros_api_plugin.h:348
gazebo::GazeboRosApiPlugin::gazebo_queue_
ros::CallbackQueue gazebo_queue_
Definition: gazebo_ros_api_plugin.h:349
gazebo::GazeboRosApiPlugin::setModelState
bool setModelState(gazebo_msgs::SetModelState::Request &req, gazebo_msgs::SetModelState::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1583
gazebo::GazeboRosApiPlugin::getLightProperties
bool getLightProperties(gazebo_msgs::GetLightProperties::Request &req, gazebo_msgs::GetLightProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1312
gazebo::GazeboRosApiPlugin::pub_link_states_event_
gazebo::event::ConnectionPtr pub_link_states_event_
Definition: gazebo_ros_api_plugin.h:356
gazebo::GazeboRosApiPlugin::get_link_state_service_
ros::ServiceServer get_link_state_service_
Definition: gazebo_ros_api_plugin.h:369
gazebo::GazeboRosApiPlugin::onLinkStatesDisconnect
void onLinkStatesDisconnect()
Callback for a subscriber disconnecting from LinkStates ros topic.
Definition: gazebo_ros_api_plugin.cpp:601
gazebo::GazeboRosApiPlugin::gazebonode_
gazebo::transport::NodePtr gazebonode_
Definition: gazebo_ros_api_plugin.h:339
gazebo::GazeboRosApiPlugin::stripXmlDeclaration
void stripXmlDeclaration(std::string &model_xml)
Definition: gazebo_ros_api_plugin.cpp:2382
gazebo::GazeboRosApiPlugin::get_model_state_service_
ros::ServiceServer get_model_state_service_
Definition: gazebo_ros_api_plugin.h:364
gazebo::GazeboRosApiPlugin::WrenchBodyJob::torque
ignition::math::Vector3d torque
Definition: gazebo_ros_api_plugin.h:421
gazebo::GazeboRosApiPlugin::set_physics_properties_service_
ros::ServiceServer set_physics_properties_service_
Definition: gazebo_ros_api_plugin.h:373
gazebo::GazeboRosApiPlugin::getPhysicsProperties
bool getPhysicsProperties(gazebo_msgs::GetPhysicsProperties::Request &req, gazebo_msgs::GetPhysicsProperties::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1479
ros::Duration
gazebo::GazeboRosApiPlugin::wrenchBodySchedulerSlot
void wrenchBodySchedulerSlot()
Definition: gazebo_ros_api_plugin.cpp:2095
subscribe_options.h
gazebo::GazeboRosApiPlugin::forceJointSchedulerSlot
void forceJointSchedulerSlot()
Definition: gazebo_ros_api_plugin.cpp:2134
gazebo::GazeboRosApiPlugin::isURDF
bool isURDF(std::string model_xml)
utility for checking if string is in URDF format
Definition: gazebo_ros_api_plugin.cpp:2073
gazebo::GazeboRosApiPlugin::physicsReconfigureThread
void physicsReconfigureThread()
waits for the rest of Gazebo to be ready before initializing the dynamic reconfigure services
Definition: gazebo_ros_api_plugin.cpp:2365
gazebo::GazeboRosApiPlugin::get_model_properties_service_
ros::ServiceServer get_model_properties_service_
Definition: gazebo_ros_api_plugin.h:365
gazebo::GazeboRosApiPlugin::force_joint_jobs_
std::vector< GazeboRosApiPlugin::ForceJointJob * > force_joint_jobs_
Definition: gazebo_ros_api_plugin.h:436
gazebo::GazeboRosApiPlugin::ForceJointJob::joint
gazebo::physics::JointPtr joint
Definition: gazebo_ros_api_plugin.h:429
gazebo::GazeboRosApiPlugin::ForceJointJob::force
double force
Definition: gazebo_ros_api_plugin.h:430
gazebo::GazeboRosApiPlugin::spawnAndConform
bool spawnAndConform(TiXmlDocument &gazebo_model_xml, const std::string &model_name, gazebo_msgs::SpawnModel::Response &res)
Definition: gazebo_ros_api_plugin.cpp:2651
ros::Subscriber
gazebo::GazeboRosApiPlugin::clearJointForces
bool clearJointForces(gazebo_msgs::JointRequest::Request &req, gazebo_msgs::JointRequest::Response &res)
Definition: gazebo_ros_api_plugin.cpp:1737
gazebo::GazeboRosApiPlugin::response_sub_
gazebo::transport::SubscriberPtr response_sub_
Definition: gazebo_ros_api_plugin.h:346


gazebo_ros
Author(s): John Hsu, Nate Koenig, Dave Coleman
autogenerated on Wed Jun 26 2024 02:49:52