ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

I had a problem when switching from URDF to XACRO.

asked 2020-03-30 17:04:29 -0500

Ace_Eca gravatar image

updated 2020-03-31 10:48:08 -0500

Hello everyone!!!

I had a problem when switching from URDF to XACRO. I did a urdf check:$ check_urdf pan_tilt_generated.urdf, before generating this: $ pan_tilt_generated.urdf using this command: $ rosrun xacro xacro pan_tilt.xacro --inorder> pan_tilt_generated.urdf.

I can’t find a solution yet. any ideas?

Here such an error is issued by verification:

 ace@ace:~/catkin_ws/src/mastering_ros_robot_description_pkg/urdf$ check_urdf pan_tilt_generated.urdf 
  Error:   radius [] is not a valid float at line 187 in /build/urdfdom-UJ3kd6/urdfdom-0.4.1/urdf_parser/src/link.cpp
    Error:   Could not parse visual element for Link [base_link]  at line 452 in /build/urdfdom-UJ3kd6/urdfdom-0.4.1/urdf_parse/src/link.cpp
    robot name is: pan_tilt
   ---------- Successfully Parsed XML ---------------
  root Link: base_link has 1 child(ren)
     child(1):  pan_link
        child(1):  tilt_link

These errors get the launch of the launch file:

   [ERROR] [1585602978.236429024]: radius [] is not a valid float]
  [ERROR] [1585602978.237213943]: Could not parse visual element for Link [base_link]

but RVIZ, it works and shows the model without errors

this is my code :

<?xml version="1.0"?>
<robot xmlns:xacro="" name="pan_tilt">
  <xacro:property name="base_link_length" value="1" />
  <xacro:property name="base_link_radius" value="2" />

 <xacro:property name="pan_link_length" value="2" />
 <xacro:property name="pan_link_radius" value="1"/>

 <xacro:property name="tilt_link_length" value="2"/>
 <xacro:property name="tilt_link_radius" value="1"/>

 <xacro:macro name="inertial_matrix" params="mass">
     <mass value="${mass}" />
     <inertia ixx="0.5" ixy="0.0" ixz="0.0"
          iyy="0.5" iyz="0.0"
          izz="0.5" />

  <link name="base_link">
  <cylinder length="${base_link_length}" radius="${base_link_radius}"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <material name="yellow">
  <color rgba="1 1 0 1"/>
  <cylinder length="${base_link_length+0.02}" radius="2"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
 <xacro:inertial_matrix mass="1"/>
 <joint name="pan_joint" type="revolute">
   <parent link="base_link"/>
   <child link="pan_link"/>
   <origin xyz="0 0 0.1"/>
   <axis xyz="0 0 1"/>
   <limit effort="300" velocity="0.1" lower="-3.14" upper="3.14"/>
   <dynamics damping="50" friction="1"/>
<link name="pan_link">
  <cylinder length="${pan_link_length}" radius="${pan_link_radius}"/>
    <origin rpy="0 0 0" xyz="0 0 0.09"/>
    <material name="red">
      <color rgba="0 0 1 1"/>
  <cylinder length="${pan_link_length}" radius="${pan_link_radius+2}"/>
    <origin rpy="0 0 0" xyz="0 0 0.09"/>
    <xacro:inertial_matrix mass="1"/>
<joint name="tilt_joint" type="revolute">
  <parent link="pan_link"/>
  <child link="tilt_link"/>
  <origin xyz="0 0 0.2"/>
  <axis xyz="0 1 0"/>
  <limit effort="300" velocity=".1" lower="-4.64" upper="-1.5"/>
  <dynamics damping="50" friction="1"/>
</joint> ...
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2020-03-31 10:55:04 -0500

David Lu gravatar image

It works fine on my machine, so I'm guessing the problem is your launch file. Make sure you are running xacro in your launch file. See also:

edit flag offensive delete link more


Hello, my launch.

<arg name="model"/>
<param name="robot_description" command="$(find xacro)/ $(find  astering_ros_robot_description_pkg)/urdf/pan_tilt.xacro" />

<param name="use_gui" value="true"/>

<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mastering_ros_robot_description_pkg)/config/urdf.rviz"  required="true" />
Ace_Eca gravatar image Ace_Eca  ( 2020-03-31 11:08:57 -0500 )edit

I can not find an explanation for this error, my code starts and works.

 [ ERROR] [1585602978.236429024]: radius [] is not a valid float]
  [ERROR] [1585602978.237213943]: Could not parse visual element for Link [base_link]
Ace_Eca gravatar image Ace_Eca  ( 2020-03-31 11:11:22 -0500 )edit

I still cannot replicate your error. What version of ROS are you using?

David Lu gravatar image David Lu  ( 2020-03-31 11:22:03 -0500 )edit
  • /rosdistro: kinetic
    • /rosversion: 1.12.14
Ace_Eca gravatar image Ace_Eca  ( 2020-03-31 12:26:45 -0500 )edit

answered 2020-04-01 13:04:55 -0500

Ace_Eca gravatar image

So, everything worked without errors. I just updated. I use UBUNTU 16.04, made a full update. sudo apt-get update , apt-get upgrade

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

1 follower


Asked: 2020-03-30 17:04:29 -0500

Seen: 740 times

Last updated: Apr 01 '20