Gazebo | Ignition | Community
Ask Your Question

Can't spawn xacro model in Gazebo

asked 2016-05-05 07:44:44 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I have a robot model in xacro format and I want to insert it in a gazebo simulation. Following similar steps with the PR2 tutorial I tried creating the following launch file:

<!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find abb_irb14000_support)/world/"/>
    <!-- more default parameters can be changed here -->
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>

<param name="robot_description" command="$(find xacro)/ $(find my_model_desc)/urdf/my_model.urdf.xacro"/>

<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model my_model -param robot_description"/>  

Although gazebo opens with no errors and the model name is displayed on the left toolbar, nothing shows inside the simulation environment and the model has no links or whatsoever. What's wrong?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-05-05 09:28:06 -0500

nkoenig gravatar image

xacro is a ROS only tool. You will have to convert a xacro file to a URDF. Then gazebo will convert the URDF to SDF for you automatically.

edit flag offensive delete link more


I thought that gazebo supported the xacro format because the PR2 robot uses it. I tried converting the xacro file with the converter to urdf but it messed up the location of the arms.. Is there another way?

pap-x gravatar imagepap-x ( 2016-05-05 09:58:23 -0500 )edit

This can be confusing. Xacro is a ros tool, but gazebo is a standalone application outside of ros. Gazebo can use urdf since urdf has been made a standalone package. This is not true for xacro, so gazebo uses an sdf version of pr2. You probably should use xacro in ros, and convert to urdf when interfacing with gazebo.

nkoenig gravatar imagenkoenig ( 2016-05-18 23:49:32 -0500 )edit

answered 2016-05-16 09:04:59 -0500

pap-x gravatar image

updated 2016-05-17 01:04:55 -0500

I tried converting it to urdf format but I still can't load it in Gazebo, although I can visualize it with Rviz. I tried creating a model in the .gazebo/models folder or spawning it with gazebo_ros spawn_modelwith no luck. It either loads an empty model or nothing. The model urdf is here:

Is there any other way to import my model to gazebo?

edit flag offensive delete link more


Hey, can you link me to the xacro files you used? Thanks in advance.

karthikj219 gravatar imagekarthikj219 ( 2016-05-18 22:23:18 -0500 )edit

@karthikj219 Thank you for your help! I converted the urdf to sdf manually, it was a painful process but I managed to get my model on gazebo...

pap-x gravatar imagepap-x ( 2016-05-19 01:13:02 -0500 )edit

Question Tools

1 follower


Asked: 2016-05-05 07:44:44 -0500

Seen: 3,033 times

Last updated: May 17 '16