0
$\begingroup$

I am encountering an issue in ROS2 Iron that wasn't present in ROS2 Galactic, related to the conversion of a URDF file (generated from XACRO) to SDF, specifically regarding the inertia elements. I am using ROS2 Iron on Ubuntu 22.04

Problem Description:

In ROS2 Galactic, the conversion of my URDF file (generated from a XACRO file with inertia calculations) to SDF was successful. However, after upgrading to ROS2 Iron, the same URDF to SDF conversion process leads to errors.

Steps Taken:

1- I created a simple XACRO file with basic inertia calculations and successfully converted it to a URDF file using the command:

xacro simple_wheel.xacro > simple_wheel.urdf 

2 - When converting the generated URDF file to SDF using the following command:

gz sdf -p simple_wheel.urdf > simple_wheel.sdf 

3- I received errors related to the inertia elements:

Error: Inertial: inertia element ixx is not a valid double at line 334 in ./urdf_parser/src/link.cpp Error: Could not parse inertial element for Link [simple_wheel] at line 435 in ./urdf_parser/src/link.cpp 

The URDF file includes correctly formatted inertia elements, but they seem to be misinterpreted during the SDF conversion.

Specific Questions:

  1. Are there known issues or changes in ROS2 Iron affecting the URDF to SDF conversion process, especially regarding inertia elements?
  2. Do I need to follow a different procedure or use specific tools in ROS2 Iron for accurate SDF conversion?
  3. Is there a recommended workaround or solution to ensure that inertia elements are correctly processed during the URDF to SDF conversion in ROS2 Iron?

XACRO File Snippet for Reference:

<?xml version="1.0"?> <robot name="simple_robot" xmlns:xacro="http://www.ros.org/wiki/xacro"> <xacro:property name="wheel_mass" value="74"/> <xacro:property name="wheel_radius" value="0.536"/> <xacro:property name="ixx_iyy_inertia" value="0.5 * ${wheel_mass} * ${wheel_radius} * ${wheel_radius}"/> <xacro:property name="izz_inertia" value="${wheel_mass} * ${wheel_radius} * ${wheel_radius}"/> <!-- link definitions --> </robot> 

I appreciate any insights or suggestions

$\endgroup$

1 Answer 1

0
$\begingroup$

I needed to put the calculated value directly instead sum the xacros variables....did not find another way to fix it.

The fix is below:

 <!-- calculate moments of inertia --> <xacro:property name="wheel_mass" value="74"/> <xacro:property name="wheel_radius" value="0.536"/> <!-- <xacro:property name="ixx_iyy_inertia" value="0.5 * ${wheel_mass} * ${wheel_radius} * ${wheel_radius}"/> <xacro:property name="izz_inertia" value="${wheel_mass} * ${wheel_radius} * ${wheel_radius}"/> --> <xacro:property name="ixx_iyy_inertia" value="10.629952"/> <xacro:property name="izz_inertia" value="21.259904"/> 
$\endgroup$
1
  • $\begingroup$ Please post a code example (using the same code example in your question) to show what you had to do $\endgroup$ Commented Jan 28, 2024 at 11:15

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.