I had a problem when switching from URDF to XACRO.
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> ...