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

error in urdf file

asked 2020-06-09 10:16:58 -0500

brunnese gravatar image

Hi,

I'm working on a project where I have to write a urdf file to describe a tool. The robot description is already completed and I only have to write the urdf file of my tool and include it in the robot description. Furthermore I have to include another already existing tool into my description and position it accordingly.

So far I have written the urdf file and a launch file to test the urdf in rviz. They are in a package that includes the package.xml file and CMakeList.txt file (these should be fine) as well as a folder with the mesh stl file.

This is my urdf file:

<?xml version="1.0"?>

<robot name="grinding_tool" xmlns:xacro="http://www.ros.org/wiki/xacro">

<xacro:include filename="$(find compliant_tool)/compliant_tool_description/urdf_src/compliant_tool.urdf.xacro" />

<!-- Useful definitions -->
  <xacro:property name="meshes_path"
                  value="package://grinding_tool/meshes"/>


    <xacro:property name="meshes_scale"
                      value="0.001 0.001 0.001"/>

  <xacro:macro name="grinding_tool" params="parent_name ee_link_name">

  <joint name="assembly_world" type="fixed">
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <parent link="world"/>
      <child link="assembly _tool"/>
  </joint>

<link name="assembly_tool">
    <visual>
      <geometry>
        <mesh filename="${meshes_path}/assembly.stl" scale="${meshes_scale}"/>
      </geometry>
      <material name="gray">
          <color rgba="${105/255} ${105/255} ${105/255} 1.0"/>
      </material>
    </visual>
    <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
       <geometry>
          <box size="0.42 0.17 0.15"/>
       </geometry>
   </collision>
   <inertial>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <mass value="3.3"/>
        <inertia ixx="0.0019"
                 ixy="0" iyy="0.072"
                 ixz="0" iyz="0" izz="0.074"/>
   </inertial>
 </link>

     <xacro:grinding_tool prefix="" joint_limited="true"/>

<!-- postioning the compliant tool in the grinding tool urdf, compliant tool uses ${parent_name} as base line-->  


       <joint name="comp_grind_link" type="fixed">
         <parent link="assembly_tool"/>
         <child link="${parent_name}"/>
          <origin xyz="0 0 0" rpy="0 0 0"/>
        </joint>

      <gazebo reference="tool">
          <mu1 value="200.0"/>
          <mu2 value="100.0"/>
         <kp value="10000000.0" />
         <kd value="1.0" />
         <material>Gazebo/Grey</material>
   </gazebo>

   <gazebo> 
        <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
          <robotNamespace>/</robotNamespace>
        </plugin>
  </gazebo>
</robot>

And the launch file I used is from this website: https://industrial-training-master.readthedocs.io/en/melodic/_source/session3/Workcell-XACRO.html

<?xml version="1.0" encoding="UTF-8"?>

<launch>
  <arg name="gui" default="true"/>
  <param name="robot_description" command="cat '$(find grinding_tool)/urdf_src/grinding_tool2.urdf.xacro'"/>

  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="use_gui" value="$(arg gui)"/>
  </node>

  <node name="rviz" pkg="rviz" type="rviz" if="$(arg gui)"/>
</launch>

When I launch it get an error : error reading end tag and in rviz it says that there is no tf data ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-06-09 12:34:43 -0500

David Lu gravatar image

updated 2020-06-11 15:45:37 -0500

You never close your <xacro:macro> tag.

You can run rosrun xacro xacro FILENAME on your own to check the urdf independently of the rest of the launch file.

Edit: Also, change your launch file line from

<param name="robot_description" command="cat '$(find grinding_tool)/urdf_src/grinding_tool2.urdf.xacro'"/>

to

<param name="robot_description" command="$(find xacro)/xacro '$(find grinding_tool)/urdf_src/grinding_tool2.urdf.xacro'"/>

edit flag offensive delete link more

Comments

Thanks for your help. This solved the end tag error!

I want to open it in rviz to see how it looks. When I just do rosrun xacro xacro grinding_tool2.urdf.xacro it reprints some of the urdf file in the terminal but it doesn't show any errors. But when I try to open it with the launch file it still says that there is no tf data for the fixed frame. Do you maybe know what else I have to fix?

brunnese gravatar image brunnese  ( 2020-06-10 05:12:26 -0500 )edit

Make sure your fixed frame is assembly_tool

David Lu gravatar image David Lu  ( 2020-06-10 09:31:37 -0500 )edit

you mean in the rviz window where it says: "fixed frame: map" and then replace map with 'assembly_tool' ? Because I've tried that already but that didn't solve the problem. It still says "No tf data. Actual error: Fixed Frame [assembly_tool] does not exist. And in the terminal it says "No link elements found in urdf file". So I think the error lies somewhere else...

brunnese gravatar image brunnese  ( 2020-06-10 09:58:10 -0500 )edit

What frames are available?

David Lu gravatar image David Lu  ( 2020-06-10 10:55:34 -0500 )edit

Edited above.

David Lu gravatar image David Lu  ( 2020-06-11 15:45:43 -0500 )edit

the launch file should be fine because I can open my urdf in rviz with this launch file without including the compliant tool. I get errors as soon as I try to include the compliant tool. then it tells me no link element found in urdf and in rviz there are no fixed frames available because there doesn't exist any tf data.

brunnese gravatar image brunnese  ( 2020-06-14 05:26:25 -0500 )edit

You have to be more clear about what works and doesn't work. I don't think the above xacro will work without the change to the launch file.

David Lu gravatar image David Lu  ( 2020-06-15 16:57:57 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-06-09 10:13:47 -0500

Seen: 1,935 times

Last updated: Jun 11 '20