ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2 generates empty urdf file

asked 2015-01-18 06:27:52 -0600

Alireza gravatar image

updated 2015-01-18 06:29:27 -0600

I am using following command to convert *.urdf.xacro to *.urdf in ROS indigo,ubuntu 14.04:

rosrun xacro a.urdf.xacro > a.urdf


rosrun xacro -o a.urdf a.urdf.xacro

content of a.urdf.xacro(just for test):

<?xml version="1.0"?>
<robot xmlns:xacro="">
<property name="base_mass" value="3.7000" />
<xacro:macro name="hunter">
    <xacro:macro name="hunter_robot" >
        <link name="base_link" />

and the content of generated urdf:

<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from a.urdf.xacro                   | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<robot xmlns:xacro="">

I have faced this problem in two different machines. any idea?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-01-18 06:52:09 -0600

gvdhoorn gravatar image

a.urdf.xacro only defines the hunter xacro macro, but that macro is never called (and thus your robot never instantiated).

I typically create a 'top level' .xacro file for this (something like hunter.xacro fi) which is empty, apart from a call to the macro. In your case:

<?xml version="1.0" ?>
<robot name="hunter" xmlns:xacro="">
  <xacro:include filename="$(find hunter_pkg)/a.urdf.xacro"/>

Then convert / use as normal.

In my experience, keeping your xacro macro definitions separate makes it easier to include them in other, composite, xacros.

edit flag offensive delete link more

Question Tools



Asked: 2015-01-18 06:27:52 -0600

Seen: 2,009 times

Last updated: Jan 18 '15