ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Invalid parameter in xacro file

asked 2019-06-20 05:21:30 -0500

Elric gravatar image

updated 2019-06-20 08:18:10 -0500

I'm using ROS Melodic and Gazebo 9.9.0.

I'm modifying an example that use two parameters in wheel macro, but when I add a third one, pX, it doesn't work.

I have run the following command to test the xacro file:

rosrun xacro mybot.xacro

With the following result:

Invalid parameter "pX"
when instantiating macro: wheel (/home/user1/catkin_ws/src/nav_odom_description/urdf/macros.xacro)
in file: mybot.xacro

I have four xacro files:

  1. mybot.xacro (the main one).
  2. macros.xacro (file with all the macros).
  3. materials.xacro (file with the materials).
    1. mybot.gazebo (file with gazebo related stuff).

You can find all of these files on Github.

This is the wheel macro (in macros.xacro file).

  <xacro:macro name="wheel" params="lr pX tY">
    <link name="${lr}_wheel">
        <origin xyz="0 0 0" rpy="0 ${PI/2} ${PI/2}" />
          <cylinder length="${wheelWidth}" radius="${wheelRadius}"/>

        <origin xyz="0 0 0" rpy="0 ${PI/2} ${PI/2}" />
          <cylinder length="${wheelWidth}" radius="${wheelRadius}"/>
        <material name="black"/>

        <origin xyz="0 0 0" rpy="0 ${PI/2} ${PI/2}" />
        <mass value="${wheelMass}"/>
        <cylinder_inertia m="${wheelMass}" r="${wheelRadius}" h="${wheelWidth}"/>

    <!-- The gazebo tag is an extension to the URDF robot description format,
         used for simulation purposes in the Gazebo simulator. More info:
    <gazebo reference="${lr}_wheel">
      <mu1 value="1.0"/>
      <mu2 value="1.0"/>
      <kp  value="10000000.0" />
      <kd  value="1.0" />
      <fdir1 value="1 0 0"/>

    <joint name="${lr}_wheel_hinge" type="continuous">
      <parent link="chassis"/>
      <child link="${lr}_wheel"/>
      <origin xyz="${-wheelPos+chassisLength/2} ${tY*wheelWidth/2+tY*chassisWidth/2} ${wheelRadius}" rpy="0 0 0" />
      <axis xyz="0 1 0" rpy="0 0 0" />
      <limit effort="100" velocity="100"/>
      <joint_properties damping="0.0" friction="0.0"/>

    <!-- Transmission is important to link the joints and the controller -->
    <transmission name="${lr}_trans">
      <joint name="${lr}_wheel_hinge">
      <actuator name="${lr}Motor">


If I called, from mybot.xacro, with this command:

<wheel lr="left_rear" tY="1"/>

It doesn't throw any error.

But, I called with this one:

<wheel lr="left_rear" pX="1" tY="1"/>

I get the previous error.

What am I doing wrong?

edit retag flag offensive close merge delete


I have the same problem. Did you figure it out?

jaiswalharsh gravatar image jaiswalharsh  ( 2020-07-17 06:05:15 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-07-28 22:16:40 -0500

caleb272 gravatar image

I had this problem it was because the macro name was actuator so it was causing a clash in naming when I used the <actuator name="xyz">....</actuator>

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-06-20 05:21:30 -0500

Seen: 1,064 times

Last updated: Jun 20 '19