ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

URDF spawn into Gazebo world error

asked 2017-11-27 06:01:40 -0500

sisko gravatar image

updated 2021-10-26 09:21:45 -0500

lucasw gravatar image

How can I spawn a URDF into a custom Gazebo world, preferably using a launch file?

My task is to launch my custom Gazebo world which has a DEM of Mongolia. I also have to spawn a URDF of a robot into the same Gezebo instance.

For the DEM, I followed this tutorial. Which worked well for me. But then I tried the following command to try spawning my robot:

ubuntu@ubuntu:~/catkin2_ws/src/my-robot$ rosrun gazebo_ros spawn_model -file urdf/01-myfirst.urdf -urdf -z 1 -model my_test

The terminal only shows the following output and nothing else happens:

SpawnModel script started
[INFO] [1511782992.386535, 0.000000]: Loading model XML from file
[INFO] [1511782992.388399, 0.000000]: Waiting for service /gazebo/spawn_urdf_model

When I stop the terminal, i:e Ctrl + C, I get the following output:

>     ^CTraceback (most recent call last):
>       File "/opt/ros/kinetic/lib/gazebo_ros/spawn_model",
> line 313, in <module>
>         sm.callSpawnService()
>       File "/opt/ros/kinetic/lib/gazebo_ros/spawn_model",
> line 271, in callSpawnService
>         initial_pose, self.reference_frame,
> self.gazebo_namespace)
>       File "/opt/ros/kinetic/lib/python2.7/dist-packages/gazebo_ros/gazebo_interface.py",
> line 28, in spawn_urdf_model_client
>         rospy.wait_for_service(gazebo_namespace+'/spawn_urdf_model')
>       File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py",
> line 159, in wait_for_service
>         raise ROSInterruptException("rospy
> shutdown")
>     rospy.exceptions.ROSInterruptException:
> rospy shutdown

Can anyone help me resolve this issue, please?

My package has the following structure:

.
├── CMakeLists.txt
├── launch
│   └── mongolia.launch
├── mongolia_129.dem
├── mongolia.world
├── package.xml
└── urdf
    └── 01-myfirst.urdf

*PS: *

This work fine if I execute:

ubuntu@ubuntu:~/catkin2_ws/src/my-robot$ roslaunch gazebo_ros empty_world.launch
edit retag flag offensive close merge delete

Comments

Thank you so much. That's what I was missing all along

sisko gravatar image sisko  ( 2017-11-28 00:29:12 -0500 )edit

Great... I converted my comment to an answer so that this question will show up as having an answer. It would be great if you could accept the answer.

jarvisschultz gravatar image jarvisschultz  ( 2017-11-28 14:59:52 -0500 )edit

1 Answer

Sort by » oldest newest most voted
6

answered 2017-11-27 21:50:17 -0500

updated 2017-11-28 14:59:19 -0500

Did you also run rosrun gazebo_ros gazebo in a separate terminal? That node should provide the /gazebo/spawn_urdf_model service the spawn_model node is waiting on. Note this node is also started in the empty_world.launch launch file.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2017-11-27 06:01:40 -0500

Seen: 9,345 times

Last updated: Nov 28 '17