ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can use either the /gazebo/spawn_urdf_model service (for .urdf files) or the /gazebo/spawn_gazebo_model service (for gazebo .xml files). In your code you need a service client for the service, e.g., for urdf models:
ros::ServiceClient gazebo_spawn_clt_ = nh_.serviceClient<gazebo_msgs::spawnmodel>("/gazebo/spawn_urdf_model");
Then you need to read the contents of the urdf file into a string (here, std::string model) and use it to call the service:
gazebo_spawn_clt_.call(model);
2 | No.2 Revision |
You can use either the /gazebo/spawn_urdf_model service (for .urdf files) or the /gazebo/spawn_gazebo_model service (for gazebo .xml files). In your code you need a service client for the service, e.g., for urdf models:
ros::ServiceClient gazebo_spawn_clt_ = nh_.serviceClient<gazebo_msgs::spawnmodel>("/gazebo/spawn_urdf_model");node_handle_.serviceClient<gazebo_msgs::spawnmodel>("/gazebo/spawn_urdf_model");
Then you need to read the contents of the urdf file into a string (here, std::string model) and use it to call the service:
gazebo_spawn_clt_.call(model);
3 | No.3 Revision |
You can use either the /gazebo/spawn_urdf_model service (for .urdf files) or the /gazebo/spawn_gazebo_model service (for gazebo .xml files). In your code you need a service client for the service, e.g., for urdf models:
ros::ServiceClient gazebo_spawn_clt_ = node_handle_.serviceClient<gazebo_msgs::spawnmodel>("/gazebo/spawn_urdf_model");nh_.serviceClient<gazebo_msgs::spawnmodel>("/gazebo/spawn_urdf_model");
Then you need to read the contents of the urdf file into a string (here, std::string model) and use it to call the service:
gazebo_spawn_clt_.call(model);
4 | No.4 Revision |
You can use either the /gazebo/spawn_urdf_model service (for .urdf files) or the /gazebo/spawn_gazebo_model service (for gazebo .xml files). In your code you need a service client for the service, e.g., for urdf models:
ros::ServiceClient gazebo_spawn_clt_ = nh_.serviceClient<gazebo_msgs::spawnmodel>("/gazebo/spawn_urdf_model");node_handle_.serviceClient< gazebo_msgs::SpawnModel> ("/gazebo/spawn_urdf_model");
Then you need to read the contents of the urdf file into a string (here, std::string model) and use it to call the service:
gazebo_spawn_clt_.call(model);
5 | No.5 Revision |
You can use either the /gazebo/spawn_urdf_model service (for .urdf files) or the /gazebo/spawn_gazebo_model service (for gazebo .xml files). In your code you need a service client for the service, e.g., for urdf models:
ros::ServiceClient gazebo_spawn_clt_ = node_handle_.serviceClient< gazebo_msgs::SpawnModel> ("/gazebo/spawn_urdf_model");
Then you need to read the contents of the urdf file into the model_xml field of a string (here, std::string model) and use it gazebo_msgs::SpawnModel service. The generated service then can be used to call the service:your client:
gazebo_spawn_clt_.call(model);gazebo_spawn_clt_.call(spawn_model_srv);