Gazebo | Ignition | Community
Ask Your Question

Problems to spawn an URDF model with gazebo_ros

asked 2013-07-04 10:51:59 -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


Ben B gravatar imageBen B ( 2013-07-04 12:25:09 -0500 )edit

yep, i had problems with connection ans seems that I send it twice. Sorry, i didn't realized.

E1000i gravatar imageE1000i ( 2013-07-08 02:55:51 -0500 )edit

Thanks. Sorry I can't help with your question. I don't use the ROS version of Gazebo. For what it's worth, the standalone Gazebo seems to have fewer bugs and contains more features.

Ben B gravatar imageBen B ( 2013-07-08 17:41:47 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2021-05-04 23:22:44 -0500

Looks like you are trying to rin the launch file without having Gazebo open. So run:

roslaunch gazebo_launch empty_world.launch

and then in a new terminal run your launch file once gazebo has opened:

roslaunch <package_name> <launch_file_name>
edit flag offensive delete link more

answered 2019-09-29 06:04:01 -0500

I had got the same problem while following the code from the tutorial from the construct site :2 wheeled robot using ROS

In the section 1.4, when i used the code given their.Unfortunately, It also got stuck at:

[INFO] [1569840617.521753, 0.000000]: Loading model XML from ros parameter robot_description [INFO] [1569840617.526059, 0.000000]: Waiting for service /gazebo/spawn_urdf_model

Then I added these few lines in my launch file after:



<!-- these are the arguments you can pass this launch file, for example paused:=true -->
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>

<!-- We resume the logic in empty_world.launch -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="debug" value="$(arg debug)" />
<arg name="gui" value="$(arg gui)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="headless" value="$(arg headless)"/>
<!-- arg name="world_name" value="$(find task_1)/world/"/ -->

After this my model runs in the gazebo and works fine.

Hope it may be helpful. Thanks.

edit flag offensive delete link more


Could you please explain how this made the error go away, or how you stumbled upon this?

Jaskaran Singh Sodhi gravatar imageJaskaran Singh Sodhi ( 2020-04-20 21:06:34 -0500 )edit

thank your sir

danu gravatar imagedanu ( 2021-01-13 10:44:34 -0500 )edit

This just worked for me, thanks!

pacman2 gravatar imagepacman2 ( 2021-01-28 18:51:36 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2013-07-04 10:51:59 -0500

Seen: 15,915 times

Last updated: Jul 04 '13