Xacro filling in parameters without specifying

asked 2015-12-18 08:47:27 -0500

zerochill gravatar image

Hey everybody,

I came across the following strange feature. I have two seperate files. One that includes definitions of parts, another that put everything together.

First file:

  <xacro:macro name="cobot_body" params="parent_link"> 
    <xacro:body />         <!-- no parameters used in "call" here -->
  <xacro:macro name="body" param="parent_link">
   <link name="body_link">
      <origin xyz="0 0 0" rpy="0 0 ${pi/2}" />
        <box size="1.0 1.0 1.0" />

   <joint name="body_base_joint" type="fixed">
      <parent link="${parent_link}" />  
      <child link="body_link" />
      <origin xyz="0 0 0.045" rpy="0 0 0" />


Second file:

<?xml version="1.0"?>
<robot name="cobot_mapping" xmlns:xacro="http://ros.org/wiki/xacro">

 <xacro:include filename="$(find cobot_description)/urdf/cobot_library.urdf.xacro" />

 <cobot_body parent_link="platform_link"/>


When I run this, the parameter of "parent_link" has the value that I specified in the second file. However, I didn't specify in the first file that this parameter should be used.

Is this intended or not?

edit retag flag offensive close merge delete