No link elements found in urdf file

asked 2021-12-09 16:00:02 -0500

Aviad gravatar image

Hello everyone,

I'm struggling a lot with launching my urdf file. I have been working on melodic with that urdf files perfectly but since I moved to work with noetic I can't run it. I have been searching on google and here but nothing helps me. I hope that someone here could help me with that issue.

I tried to put xacro:macro in every place but it didn't solved. In my last attempt, I kept just one link in my file and it didn't solve the problem. Just when I use urdf without ant macro I could run it well.

so here are my 3 files:

launch file:

        <?xml version="1.0"?>
    <launch>

    <!-- Load the URDF/Xacro model of your robot -->
    <arg name="urdf_file" default="$(find xacro)/xacro '$(find robot_model)/urdf/robot.urdf.xacro'" />
        <param name="robot_description" command="$(arg urdf_file)" />

     <!--Publish the robot state -->
    <node name="robot_state_publisher" pkg="robot_state_publisher"  type="robot_state_publisher">
        <param name="publish_frequency" value="20.0"/>
    </node>


<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="rate" value="20.0"/>
</node>

</launch>

robot.urdf.xacro:

<?xml version="1.0"?>

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

   <!-- Include all component files -->
   <include filename="$(find robot_model)/urdf/materials.urdf.xacro" />


<include filename="$(find robot_model)/urdf/base.urdf.xacro" />


<!-- Add the drive wheels -->
   <wheel parent="base" suffix="fr" reflects="1"  reflectd="1" color="Black"   type="fixed"/>
   <wheel parent="base" suffix="fl" reflects="-1" reflectd="1" color="Black"   type="fixed"/>
   <rear_wheel parent="base" suffix="br" reflects="1"  reflectd="-1" color="Black"  type="fixed"/>
   <rear_wheel parent="base" suffix="bl" reflects="-1" reflectd="-1" color="Black"  type="fixed"/>
<!-- Add the base and wheels -->
   <base name="base" color="Green"/>


</robot>

base.urdf.xacro:

<?xml version="1.0"?>

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

  <!-- Define a number of dimensions using properties -->
  <property name="base_size_x" value="1.09" />
  <property name="base_size_y" value="1.8" />
  <property name="base_size_z" value="1.0" />
  <property name="wheel_length" value="0.8" />
  <property name="wheel_radius" value="0.5" />
  <property name="wheel_offset_x" value="1.5" />
  <property name="wheel_offset_y" value="0.8" />
  <property name="wheel_offset_z" value="0.49" />
   <property name="rear_wheel_offset_x" value="0.5" />
  <property name="rear_wheel_offset_y" value="0.75" />
  <property name="rear_wheel_offset_z" value="0.65" />
  <property name="PI" value="3.1415" />

  <!-- define a front wheel -->
  <macro name="wheel" params="suffix parent reflects reflectd color type">
    <joint name="${parent}_${suffix}_wheel_joint" type="${type}">
      <axis xyz="0 0 1" />
      <limit effort="100" velocity="100"/>
      <safety_controller k_velocity="10" />
      <origin xyz="${reflectd*wheel_offset_x} ${reflects*(wheel_offset_y)} ${wheel_offset_z}" rpy="0 0 0" />
    <parent link="${parent}_link"/>
      <child link="${parent}_${suffix}_wheel_link"/>
    </joint>

    <link name="${parent}_${suffix ...
(more)
edit retag flag offensive close merge delete

Comments

I struggled a lot with this before. Not sure the changes were done between versions so what I opted to do with smaller urdfis to get rid of macro all together. Make sure when check_urdf tool passes then add them back one at the time.

osilva gravatar image osilva  ( 2021-12-09 16:23:46 -0500 )edit

By getting rid of the macro what I mean is add each component manually

osilva gravatar image osilva  ( 2021-12-09 16:26:41 -0500 )edit

But one thing I’ll try before doing all that. Sorry I just noticed to change to xacro:property

osilva gravatar image osilva  ( 2021-12-09 16:30:36 -0500 )edit

Also please this discussion: https://github.com/ros/xacro/issues/270

osilva gravatar image osilva  ( 2021-12-10 08:45:37 -0500 )edit