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 unexpected EOF while parsing (<string>, line 1) when evaluating expression '(.82)*${mass'
Somehow the error you posted doesn't seem to correspond to the code you posted in your macro. Your numbers are different and your parentheses and braces are different.
This seems like a duplicate of #q293296. If it is, please close either this one, or #q293296, so we avoid split discussions.