0
$\begingroup$

Rosanswers logo

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

rosrun xacro xacro.py a.urdf.xacro > a.urdf

also

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

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

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<property name="base_mass" value="3.7000" />
<xacro:macro name="hunter">
    <xacro:macro name="hunter_robot" >
        <link name="base_link" />
    </xacro:macro>
</xacro:macro>
</robot>

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="http://www.ros.org/wiki/xacro">
</robot>

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


Originally posted by Alireza on ROS Answers with karma: 717 on 2015-01-18

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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="http://ros.org/wiki/xacro">
  <xacro:include filename="$(find hunter_pkg)/a.urdf.xacro"/>
  <xacro:hunter/>
</robot>

Then convert / use as normal.

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


Originally posted by gvdhoorn with karma: 86574 on 2015-01-18

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.