Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using xacro to automate inertial calculations sequence/float error

Running Ubuntu 16.04 with ROS-Kinetic I am trying to automatically calculate inertial values for a simulated robot. The purpose is to be able to change the dimensions and have the inertia automatically calculated. Here is my macro

<xacro:macro name="cuboid_inertial" params="mass length width height">
    <inertial>
      <mass value="${mass}"/>
      <inertia 
                ixx="${(0.83)*mass*(width+height)}" 
                ixy="0.0" 
                ixz="0.0" 
                iyy="${(0.83)*mass*(length+height)}" 
                iyz="0.0" 
                izz="${(0.83)*mass)*(width+length)}" />
    </inertial>
</xacro:macro>

I have xacro properties as follows.

  <xacro:property name="base_link_length" value="0.50"/>
  <xacro:property name="base_link_width" value="0.30"/>
  <xacro:property name="base_link_height" value="0.35"/>
  <xacro:property name="base_link_length_sqrd" value="${base_link_length}*${base_link_length}"/>
  <xacro:property name="base_link_width_sqrd" value="${base_link_width}*${base_link_width}"/>
  <xacro:property name="base_link_height_sqrd" value="${base_link_height}*${base_link_height}"/>

When I try to run the macro it comes up with an error. My link tags...

  <link name="base_link">
    <visual>
      <geometry>
        <box size="${base_link_length} ${base_link_width} ${base_link_height}"/>
      </geometry>
      <material name="grey"/>
    </visual>
    <collision>
      <geometry>
        <box size="${base_link_length} ${base_link_width} ${base_link_height}"/>
      </geometry>
    </collision>
        <xacro:cuboid_inertial mass="{base_link_mass}" length="{base_link_length_sqrd}" width="{base_link_width_sqrd}" height="{base_link_height_sqrd}"/>
  </link>

The error is

xacro: Traditional processing is deprecated. Switch to --inorder processing! To check for compatibility of your document, use option --check-order. For more infos, see http://wiki.ros.org/xacro#Processing_Order can't multiply sequence by non-int of type 'float' when evaluating expression '(0.83)mass(width+height)' when instantiating macro: cuboid_inertial (/home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro) in file: /home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro Invalid tag: Cannot load command parameter [robot_description]: command [/opt/ros/kinetic/lib/xacro/xacro '/home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro'] returned with code [2].

Param xml is The traceback for the exception was written to the log file

I am assuming it is trying to multiply a sequence to a float but I am not sure what the sequence is when my parameters are clearly defined as ints.

Using xacro to automate inertial calculations sequence/float error

Running Ubuntu 16.04 with ROS-Kinetic I am trying to automatically calculate inertial values for a simulated robot. The purpose is to be able to change the dimensions and have the inertia automatically calculated. Here is my macro

<xacro:macro name="cuboid_inertial" params="mass length width height"> <inertial> <mass value="${mass}"/> <inertia ixx="${(0.83)*mass*(width+height)}" ixx="${0.83*mass*(${width}+${height})}" ixy="0.0" ixz="0.0" iyy="${(0.83)*mass*(length+height)}" iyy="${0.83*mass*(${length}+${height})}" iyz="0.0" izz="${(0.83)*mass)*(width+length)}" /> izz="${0.83*mass*(${width}+${length})}"/> </inertial> </xacro:macro>

</xacro:macro>

I have xacro properties as follows.

  <xacro:property name="base_link_length" value="0.50"/>
  <xacro:property name="base_link_width" value="0.30"/>
  <xacro:property name="base_link_height" value="0.35"/>
  <xacro:property name="base_link_length_sqrd" value="${base_link_length}*${base_link_length}"/>
  <xacro:property name="base_link_width_sqrd" value="${base_link_width}*${base_link_width}"/>
  <xacro:property name="base_link_height_sqrd" value="${base_link_height}*${base_link_height}"/>

When I try to run the macro it comes up with an error. My link tags...

  <link name="base_link">
    <visual>
      <geometry>
        <box size="${base_link_length} ${base_link_width} ${base_link_height}"/>
      </geometry>
      <material name="grey"/>
    </visual>
    <collision>
      <geometry>
        <box size="${base_link_length} ${base_link_width} ${base_link_height}"/>
      </geometry>
    </collision>
        <xacro:cuboid_inertial mass="{base_link_mass}" length="{base_link_length_sqrd}" width="{base_link_width_sqrd}" height="{base_link_height_sqrd}"/>
  </link>

The error is

xacro: Traditional processing is deprecated. Switch to --inorder processing! To check for compatibility of your document, use option --check-order. For more infos, see http://wiki.ros.org/xacro#Processing_Order can't multiply sequence by non-int of type 'float' when evaluating expression '(0.83)mass(width+height)' when instantiating macro: cuboid_inertial (/home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro) in file: /home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro Invalid tag: Cannot load command parameter [robot_description]: command [/opt/ros/kinetic/lib/xacro/xacro '/home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro'] returned with code [2].

Param xml is The traceback for the exception was written to the log file

I am assuming it is trying to multiply a sequence to a float but I am not sure what the sequence is when my parameters are clearly defined as ints.

Using xacro to automate inertial calculations sequence/float error

Running Ubuntu 16.04 with ROS-Kinetic I am trying to automatically calculate inertial values for a simulated robot. The purpose is to be able to change the dimensions and have the inertia automatically calculated. Here is my macro

<xacro:macro name="cuboid_inertial" params="mass length width height"> <inertial> <mass value="${mass}"/> <inertia ixx="${0.83*mass*(${width}+${height})}" ixy="0.0" ixz="0.0" iyy="${0.83*mass*(${length}+${height})}" iyz="0.0" izz="${0.83*mass*(${width}+${length})}"/> </inertial> </xacro:macro>

I have xacro properties as follows.

  <xacro:property name="base_link_length" value="0.50"/>
  <xacro:property name="base_link_width" value="0.30"/>
  <xacro:property name="base_link_height" value="0.35"/>
  <xacro:property name="base_link_length_sqrd" value="${base_link_length}*${base_link_length}"/>
  <xacro:property name="base_link_width_sqrd" value="${base_link_width}*${base_link_width}"/>
  <xacro:property name="base_link_height_sqrd" value="${base_link_height}*${base_link_height}"/>

When I try to run the macro it comes up with an error. My link tags...

  <link name="base_link">
    <visual>
      <geometry>
        <box size="${base_link_length} ${base_link_width} ${base_link_height}"/>
      </geometry>
      <material name="grey"/>
    </visual>
    <collision>
      <geometry>
        <box size="${base_link_length} ${base_link_width} ${base_link_height}"/>
      </geometry>
    </collision>
        <xacro:cuboid_inertial mass="{base_link_mass}" length="{base_link_length_sqrd}" width="{base_link_width_sqrd}" height="{base_link_height_sqrd}"/>
  </link>

The error is

xacro: Traditional processing is deprecated. Switch to --inorder processing! To check for compatibility of your document, use option --check-order. For more infos, see http://wiki.ros.org/xacro#Processing_Order can't multiply sequence by non-int of type 'float' is unexpected EOF while parsing (<string>, line 1) when evaluating expression '(0.83)mass(width+height)' when instantiating macro: cuboid_inertial (/home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro) in file: /home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro Invalid tag: Cannot load command parameter [robot_description]: command [/opt/ros/kinetic/lib/xacro/xacro '/home/mrhinelander/catkin_ws/src/kiwi/kiwi_description/urdf/kiwi.urdf.xacro'] returned with code [2].

Param xml is The traceback for the exception was written to the log file

I am assuming it is trying to multiply a sequence to a float but I am not sure what the sequence is when my parameters are clearly defined as ints.'(.82)*${mass'

Using xacro to automate inertial calculations sequence/float error

Running Ubuntu 16.04 with ROS-Kinetic I am trying to automatically calculate inertial values for a simulated robot. The purpose is to be able to change the dimensions and have the inertia automatically calculated. Here is my macro

 <xacro:macro name="cuboid_inertial" params="mass length width height">
    <inertial>
      <mass value="${mass}"/>
      <inertia  ixx="${0.83*mass*(${width}+${height})}"  ixy="0.0"  ixz="0.0"  iyy="${0.83*mass*(${length}+${height})}"  iyz="0.0" izz="${0.83*mass*(${width}+${length})}"/>

                izz="${0.83*mass*(${width}+${length})}" />
    </inertial>
</xacro:macro>

</xacro:macro>

I have xacro properties as follows.

  <xacro:property name="base_link_length" value="0.50"/>
  <xacro:property name="base_link_width" value="0.30"/>
  <xacro:property name="base_link_height" value="0.35"/>
  <xacro:property name="base_link_length_sqrd" value="${base_link_length}*${base_link_length}"/>
  <xacro:property name="base_link_width_sqrd" value="${base_link_width}*${base_link_width}"/>
  <xacro:property name="base_link_height_sqrd" value="${base_link_height}*${base_link_height}"/>

When I try to run the macro it comes up with an error. My link tags...

  <link name="base_link">
    <visual>
      <geometry>
        <box size="${base_link_length} ${base_link_width} ${base_link_height}"/>
      </geometry>
      <material name="grey"/>
    </visual>
    <collision>
      <geometry>
        <box size="${base_link_length} ${base_link_width} ${base_link_height}"/>
      </geometry>
    </collision>
        <xacro:cuboid_inertial mass="{base_link_mass}" length="{base_link_length_sqrd}" width="{base_link_width_sqrd}" height="{base_link_height_sqrd}"/>
  </link>

The error is unexpected EOF while parsing (<string>, line 1) when evaluating expression '(.82)*${mass'