Gazebo | Ignition | Community
Ask Your Question

problems spawing an urdf robot with gazebo_ros

asked 2013-07-04 10:48:43 -0500

E1000i gravatar image

Hi there!

I'm working with a custom robot here. We are moving into ROS for controlling and interfacing with many sensors and use moveIt! as trajectory planner. So we are completely newbies here.

I had made the urdf file, which seems to work OK for rviz or movitIt wizard configuration. But despite following the tutorials from wiki the simulator wont come up with the robot.

I'm using ubuntu 12.04 with groovy. Gazebo and gazebo_ros are installed from source and seems to work loading and empty world.

What I tried to execute is the next command, where 'myrobot' is actually the robot name.

rosrun gazebo_ros  spawn_model -file 'rospack find myrobot_description'/urdf/myrobot.urdf -urdf -model myrobot

The comand line output spites:

spawn_model script started
[INFO] [WallTime: 1372951949.703358] Loading model xml from file
[INFO] [WallTime: 1372951949.703925] Waiting for service /gazebo/spawn_urdf_model

And stays there forever. When hit ctrl+c appears that trace back:

Traceback (most recent call last):
File "/home/ros/catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/spawn_model", 
line 292, in <module>sm.callSpawnService()
File "/home/ros/catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/spawn_model", 
line 258, in callSpawnService initial_pose, self.reference_frame, self.gazebo_namespace)
File "/home/ros/catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/src/gazebo_ros/", 
line 27, in spawn_urdf_model_client rospy.wait_for_service(gazebo_namespace+'/spawn_urdf_model')
File "/opt/ros/groovy/lib/python2.7/dist-packages/rospy/impl/", line 162,
in wait_for_service raise ROSInterruptException("rospy shutdown")
rospy.exceptions.ROSInterruptException: rospy shutdown

I even tried with the tutorial for Baxter, but seems there is no URDF in the repository where it is supposed you will get it.

Any hint on how go on. I could not execute moveIt until gazebo works it seems, and after sorting all the configuration and installation troubles, here I get stuck with no clue on how keep going. So all your help will be specially appreciated!

Thanks in advance, and thanks for this great tools.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-07-08 03:35:01 -0500

E1000i gravatar image

Ok, was a terrible mistake from my part. I thing I was trying to spawn the model while gazebo was closed. How embarrasing...

To many hours working I guess.

So run before:

roslaunch gazebo_ros willowgarage_world.launch

and that will do the trick, as expected...

edit flag offensive delete link more


Good solution. I also did not notice that the command should run while gazebo is running. gravatar ( 2019-08-20 10:49:54 -0500 )edit

answered 2018-12-21 00:47:59 -0500

bonag gravatar image

Recently I faced the same issue and I'd like to add a small note here:

Though gazebo can be launched with just typing gazebo in the terminal, this will not work. Because it only starts the GUI and not the services.

Whereas staring gazebo using roslaunch gazebo_ros willowgarage_world.launch takes care of the required services.

Another way to launch is roslaunch gazebo_ros gazebo if you do not want to include a world or a launch file.

Hope this helps!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2013-07-04 10:48:43 -0500

Seen: 10,286 times

Last updated: Jul 08 '13