Gazebo | Ignition | Community
Ask Your Question
0

Can't spawn xacro model in Gazebo

asked 2016-05-05 07:44:44 -0600

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:

<launch>
<!-- 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/abb_irb14000.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"/>
</include>

<param name="robot_description" command="$(find xacro)/xacro.py $(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"/>  
</launch>

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
1

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

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

Comments

I thought that gazebo supported the xacro format because the PR2 robot uses it. I tried converting the xacro file with the xacro.py 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 -0600 )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 -0600 )edit
0

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

pap-x gravatar image

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

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: http://pastebin.com/PgTpGhbp

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

edit flag offensive delete link more

Comments

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

karthikj219 gravatar imagekarthikj219 ( 2016-05-18 22:23:18 -0600 )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 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-05 07:44:44 -0600

Seen: 3,045 times

Last updated: May 17 '16