ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

I had a problem when switching from URDF to XACRO.

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

Ace_Eca gravatar image

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

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="http://www.ros.org/wiki/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">
      <inertial>
     <mass value="${mass}" />
     <inertia ixx="0.5" ixy="0.0" ixz="0.0"
          iyy="0.5" iyz="0.0"
          izz="0.5" />
  </inertial>
  </xacro:macro>

  <link name="base_link">
  <visual>
    <geometry>
  <cylinder length="${base_link_length}" radius="${base_link_radius}"/>
    </geometry>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <material name="yellow">
  <color rgba="1 1 0 1"/>
    </material>
  </visual>
  <collision>
    <geometry>
  <cylinder length="${base_link_length+0.02}" radius="2"/>
    </geometry>
    <origin rpy="0 0 0" xyz="0 0 0"/>
  </collision>
 <xacro:inertial_matrix mass="1"/>
 </link>
 <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"/>
</joint>
<link name="pan_link">
  <visual>
    <geometry>
  <cylinder length="${pan_link_length}" radius="${pan_link_radius}"/>
    </geometry>
    <origin rpy="0 0 0" xyz="0 0 0.09"/>
    <material name="red">
      <color rgba="0 0 1 1"/>
    </material>
  </visual>
  <collision>
    <geometry>
  <cylinder length="${pan_link_length}" radius="${pan_link_radius+2}"/>
    </geometry>
    <origin rpy="0 0 0" xyz="0 0 0.09"/>
 </collision>
    <xacro:inertial_matrix mass="1"/>
</link>
<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> ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

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

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: http://wiki.ros.org/urdf/Tutorials/Us...

edit flag offensive delete link more

Comments

Hello, my launch.

<launch>
<arg name="model"/>
<param name="robot_description" command="$(find xacro)/xacro.py $(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" />
</launch>
Ace_Eca gravatar image Ace_Eca  ( 2020-03-31 11:08:57 -0600 )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 -0600 )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 -0600 )edit
  • /rosdistro: kinetic
    • /rosversion: 1.12.14
Ace_Eca gravatar image Ace_Eca  ( 2020-03-31 12:26:45 -0600 )edit
0

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

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

Question Tools

1 follower

Stats

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

Seen: 1,059 times

Last updated: Apr 01 '20