Ask Your Question
0

No link elements found in urdf file

asked 2021-09-26 22:25:02 -0600

Acehomie gravatar image

updated 2021-09-27 10:07:47 -0600

Hi, I'm new to ROS and am trying to follow this tutorial: https://github.com/Apress/Robot-Opera...

I am running Ubuntu 20.04 + ROS noetic.

When I try to launch my xacro in Rviz I get this error:`

[ERROR] [1632711304.025022765]: No link el

ements found in urdf file
    [robot_state_publisher-2] process has died [pid 3129, exit code 1, cmd /opt/ros/noetic/lib/robot_state_publisher/robot_state_publisher __name:=robot_state_publisher __log:=/home/randal/.ros/log/5000ceae-1f3e-11ec-b087-5fe0994d9aa9/robot_state_publisher-2.log].
    log file: /home/randal/.ros/log/5000ceae-1f3e-11ec-b087-5fe0994d9aa9/robot_state_publisher-2*.log
    [ERROR] [1632711304.485687357]: No link elements found in urdf file`

How I'm attempting to launch Rviz:

roslaunch mobile_robot_description view_robot.launch

Rviz does launch, but I'm not able to see the model

My xacro:

<?xml version="1.0" ?>
<!-- 
 This is a standalone URDF model of 2WD smart car robot 
 -->


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


  <property name="M_PI" value="3.1415926535897931" />
  <property name="M_PI_2" value="1.570796327" />
  <property name="DEG_TO_RAD" value="0.017453293" />

  <xacro:macro name="mobile_robot">

    <link name="base_footprint"/>
    <!--
   Base link is set at the bottom of the base mould.
   This is done to be compatible with the way base link
   was configured for turtlebot 1. Refer to

   https://github.com/turtlebot/turtlebot/issues/40

   To put the base link at the more oft used wheel
   axis, set the z-distance from the base_footprint
   to 0.352.
  -->
<joint name="base_joint" type="fixed">
  <origin xyz="0 0 0.0102" rpy="0 0 -${M_PI/2}" />
  <parent link="base_footprint"/>
  <child link="base_link" />
</joint>

<link name="base_link">
  <visual>
    <geometry>
      <!-- new mesh -->
      <mesh filename="package://mobile_robot_description/meshes/chassis.dae" scale="0.001 0.001 0.001"/> 

    </geometry>

 <origin xyz="-0.07 -0.12 0.352" rpy="0 0 0"/>

  </visual>

  <collision>
    <geometry>
    <box size="0.14 0.23 0.1" />
    </geometry>
    <origin xyz="0.0 -0.02 0" rpy="0 0 0"/>
  </collision>

  <inertial>
    <!-- COM experimentally determined -->
    <origin xyz="-0.07 -0.12 0"/>
    <mass value="2.4"/> <!-- 2.4/2.6 kg for small/big battery pack -->

    <inertia ixx="0.019995" ixy="0.0" ixz="0.0"
             iyy="0.019995" iyz="0.0" 
             izz="0.03675" />
      </inertial>
    </link>

<!-- Wheel and caster wheel link  -->


        <!-- NOTE This may prevent gazebo from working with this model -->
      <joint name="left_wheel_joint" type="fixed">
        <origin xyz="-0.06 0 0" rpy="0 0 0"/>
        <parent link="base_link"/>
        <child link="left_wheel_link"/>
        <axis xyz="1 0 0"/>

            <limit effort="100" velocity="100"/>
            <joint_properties damping="0.0" friction="0.0"/>
      </joint>


  <link name="left_wheel_link">
    <inertial>
      <origin xyz="0 0 0"/>
      <mass value="0.01" />
      <inertia ixx="0.001" ixy="0.0" ixz="0.0"
        iyy="0.001" iyz="0.0" izz="0.001" />
    </inertial>

    <visual>
      <origin xyz="0 0 ...
(more)
edit retag flag offensive close merge delete

Comments

Can you send a snapshot of your RVIZ settings. Make sure Fixed Frame and Robot Model are selected.

osilva gravatar image osilva  ( 2021-09-27 09:17:16 -0600 )edit

I added to the main post above. When RVIZ launches my Robot Model is selected but gives me error "Failed to parse URDF model" The Fixed Frame seems to be set to "odom"?

Acehomie gravatar image Acehomie  ( 2021-09-27 10:12:38 -0600 )edit

Pedantic, but:

When I try to launch my xacro in Rviz

you cannot "launch a xacro in RViz". RViz just visualises whatever you give it. It's an observer, it's not an active entity which loads .xacro files. That's an important difference.

RViz (or really: the "robot model display") tries to load + parse whatever the contents is of the /robot_description parameter, then renders that.

gvdhoorn gravatar image gvdhoorn  ( 2021-09-27 10:15:46 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2021-09-27 10:13:01 -0600

gvdhoorn gravatar image

updated 2021-09-27 10:17:10 -0600

robot_model.xacro only defines a xacro:macro, but that macro is never called (or: the model is never instantiated).

You only have <xacro:macro name="mobile_robot"> [..] </xacro:macro>, but nowhere a <xacro:mobile_robot />.

It's like creating a C++ / Python class, but then ever instantiating it, so there is no object.

This is a classical mistake when using xacro.

The original file (here) doesn't appear to be a xacro:macro (notice how that line is commented, just as line 202, which would close the xacro:macro).

edit flag offensive delete link more

Comments

Yeah, I removed the comments to get RVIZ to open. If I try to use the original file RVIZ won't load and I get :

name 'M_PI' is not defined 
when evaluating expression 'M_PI/2'
when processing file: /home/randal/catkin_ws/src/mobile_robot_description/urdf/robot_model.xacro
RLException: Invalid <param> tag: Cannot load command parameter [robot_description]: command [['/opt/ros/noetic/lib/xacro/xacro', '/home/randal/catkin_ws/src/mobile_robot_description/urdf/robot_model.xacro']] returned with code [2]. 

Param xml is <param name="robot_description" command="$(find xacro)/xacro '$(find mobile_robot_description)/urdf/robot_model.xacro'"/>
The traceback for the exception was written to the log file
Acehomie gravatar image Acehomie  ( 2021-09-27 10:43:11 -0600 )edit

Yeah, I removed the comments to get RVIZ to open

ah, ok. And you did not believe that to be important information to mention?

gvdhoorn gravatar image gvdhoorn  ( 2021-09-27 10:50:38 -0600 )edit

Hi, I'm new to ROS

I tried to provide as much info as I though was relevant. I provided both what I was using and the original file. I figured that getting RVIZ to open was a step in the right direction and maybe there was something small I was missing.

Acehomie gravatar image Acehomie  ( 2021-09-27 10:59:43 -0600 )edit
1

Changing files without explicitly telling the people you ask for help what you changed is not a good idea. This is independent of whether you're new to ROS or not.

In any case: the problem you show is likely caused by the fact that the .xacro you're trying to load is incompatible with the Noetic version of xacro. As a first step, prefix things like property with xacro:. It might start to work then.

You'll probably still get warnings about black not being defined, but things should at least load.

I'm not sure it's worth it trying to fix that .xacro/URDF. There seem to be many problems with it, and the book author doesn't seem too active there.

Perhaps the regular URDF tutorials would be easier?

gvdhoorn gravatar image gvdhoorn  ( 2021-09-27 11:05:04 -0600 )edit

Ok, dually noted.

This seems to at least get RVIZ to open again, but still can't see the model. But this unblocks my current issue and at least gives me some more error codes I can start googling.

I was hoping to be able to use this as I've already built the model.

Yes, I've tried the regular tutorial, but was also getting errors. So, I figured if I'm going to spend time debugging something maybe better to work with the actual model in lieu of trying to model this from scratch + try to debug the tutorial. I appreciate the help though, thank you.

Acehomie gravatar image Acehomie  ( 2021-09-27 11:39:31 -0600 )edit

Yes, I've tried the regular tutorial, but was also getting errors

have you posted a question about that?

Those tutorials should work. If they don't, either something is not working on your end, or there is a problem with the tutorial and that should be fixed.

Without people reporting issues, they cannot be fixed.

This seems to at least get RVIZ to open again, but still can't see the model. [..] [This] at least gives me some more error codes [..]

What sort of errors? I just ran the resulting urdf through check_urdf, and that only complained about the materials not being defined (as I already mentioned). But those are not errors, just warnings.

gvdhoorn gravatar image gvdhoorn  ( 2021-09-27 11:49:27 -0600 )edit

I haven't posted a question, I will try to.

The errors don't show in the terminal they only show in RVIZ, there are only warns in the terminal. Kind of weird to copy from RVIZ so forgive my formatting here, but I'm getting what look to be some transform errors:

No transform from [robot_caster_back_link] to [odom]
No transform from [right_wheel_link] to [odom]
No transform from [left_wheel_link] to [odom]
No transform from [base_link] to [odom]
No transform from [base_footprint] to [odom]
  • one for the chassis DAE

    package://mobile_robot_description/meshes/body/chasis.daeetries: • for link 'base_link': Could not load mesh resource 'package://mobile_robot_description/meshes/body/chasis.dae'

Acehomie gravatar image Acehomie  ( 2021-09-27 12:00:41 -0600 )edit
1

These are errors with the robot_model.xacro? Not with the main tutorials?

These are all things that have been discussed before here on ROS Answers. In general: use Google to search, make sure to append site:answers.ros.org to your query string.

For RViz: make sure to change the Fixed Frame setting to an existing TF frame (it's a drop down, pick one).

For the mesh error: make sure that file exists, in the directory specified in your URDF.

gvdhoorn gravatar image gvdhoorn  ( 2021-09-27 12:05:15 -0600 )edit

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

Stats

Asked: 2021-09-26 22:25:02 -0600

Seen: 44 times

Last updated: Sep 27