Ask Your Question
0

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 xacro.py 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">
      <collision>
        <origin xyz="0 0 0" rpy="0 ${PI/2} ${PI/2}" />
        <geometry>
          <cylinder length="${wheelWidth}" radius="${wheelRadius}"/>
        </geometry>
      </collision>

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

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

    <!-- The gazebo tag is an extension to the URDF robot description format,
         used for simulation purposes in the Gazebo simulator. More info:
       http://gazebosim.org/tutorials/?tut=ros_urdf#%3Cgazebo%3EElementsForLinks
     -->
    <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"/>
      <material>Gazebo/Black</material>
    </gazebo>

    <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"/>
    </joint>

    <!-- Transmission is important to link the joints and the controller -->
    <transmission name="${lr}_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="${lr}_wheel_hinge">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
      </joint>
      <actuator name="${lr}Motor">
        <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        <mechanicalReduction>10</mechanicalReduction>
      </actuator>
    </transmission>

  </xacro:macro>

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

Comments

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
0

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

2 followers

Stats

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

Seen: 565 times

Last updated: Jun 20 '19