Can't spawn xacro model in Gazebo
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?
Asked by pap-x on 2016-05-05 07:44:44 UTC
Answers
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.
Asked by nkoenig on 2016-05-05 09:28:06 UTC
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?
Asked by pap-x on 2016-05-05 09:58:23 UTC
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.
Asked by nkoenig on 2016-05-18 23:49:32 UTC
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_model with 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?
Asked by pap-x on 2016-05-16 09:04:59 UTC
Comments
Hey, can you link me to the xacro files you used? Thanks in advance.
Asked by karthikj219 on 2016-05-18 22:23:18 UTC
@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...
Asked by pap-x on 2016-05-19 01:13:02 UTC
Comments