Invalid parameter in xacro file
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:
- mybot.xacro (the main one).
- macros.xacro (file with all the macros).
- materials.xacro (file with the materials).
- 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?
I have the same problem. Did you figure it out?