Hi, I'm new to ROS and am trying to follow this tutorial: https://github.com/Apress/Robot-Operating-System-Abs-Begs/tree/master/chapter_6/mobile_robot_description
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 0" rpy="0 ${M_PI/2} 0" />
<geometry>
<cylinder radius="0.0325" length = "0.02"/>
</geometry>
<material name ="black" />
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 ${M_PI/2} 0" />
<geometry>
<cylinder radius="0.0325" length = "0.02"/>
</geometry>
</collision>
</link>
<link name="right_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 0" rpy="0 ${M_PI/2} 0" />
<geometry>
<cylinder radius="0.0325" length = "0.02"/>
</geometry>
<material name ="black" />
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 ${M_PI/2} 0" />
<geometry>
<cylinder radius="0.0325" length = "0.02"/>
</geometry>
</collision>
</link>
<!-- Fixed because we never rotate it anyway, it is just for show -->
<!-- NOTE This may prevent gazebo from working with this model -->
<joint name="right_wheel_joint" type="fixed">
<origin xyz="0.06 0 0" rpy="0 0 0"/>
<parent link="base_link"/>
<child link="right_wheel_link"/>
<axis xyz="1 0 0"/>
</joint>
<!--
<joint name="caster_front_joint" type="fixed">
<parent link="base_link"/>
<child link="chefbot_caster_front_link"/>
<origin xyz="0.115 0.0 0.007" rpy="${-M_PI/2} 0 0"/>
</joint>
<link name="chefbot_caster_front_link">
<collision>
<geometry>
<cylinder length="0.0176" radius="0.017"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0"/>
</collision>
<inertial>
<mass value="0.01" />
<origin xyz="0 0 0" />
<inertia ixx="0.001" ixy="0.0" ixz="0.0"
iyy="0.001" iyz="0.0"
izz="0.001" />
</inertial>
</link>
-->
<joint name="robot_caster_back_joint" type="fixed">
<parent link="base_link"/>
<child link="robot_caster_back_link"/>
<origin xyz="0 -0.1 0" rpy="0 0 0"/>
</joint>
<link name="robot_caster_back_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 -0.01" rpy="0 0 0" />
<geometry>
<cylinder radius="0.01" length = "0.035"/>
</geometry>
<material name ="black" />
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 ${M_PI/2} 0" />
<geometry>
<cylinder radius="0.01" length = "0.1"/>
</geometry>
</collision>
</link>
</xacro:macro>
My launch file:
<launch>
<arg name="model" />
<!-- Parsing xacro and setting robot_description parameter -->
<param name="robot_description" command="$(find xacro)/xacro '$(find mobile_robot_description)/urdf/robot_model.xacro'" />
<!-- Starting robot state publish which will publish tf -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
<!-- Launch visualization in rviz -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mobile_robot_description)/config/robot.rviz" required="true" />
</launch>
RVIZ settings file:
Panels:
- Class: rviz/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /TF1
- /TF1/Frames1
- /RobotModel1
- /RobotModel1/Links1
- /Axes1
- /Pose1
Splitter Ratio: 0.5
Tree Height: 747
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.588679
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: ""
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.03
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: odom
Value: true
- Class: rviz/TF
Enabled: true
Frame Timeout: 15
Frames:
All Enabled: false
base_footprint:
Value: false
base_link:
Value: false
left_wheel_link:
Value: false
odom:
Value: true
right_wheel_link:
Value: false
robot_caster_back_link:
Value: false
Marker Scale: 1
Name: TF
Show Arrows: true
Show Axes: true
Show Names: false
Tree:
odom:
base_footprint:
base_link:
left_wheel_link:
{}
right_wheel_link:
{}
robot_caster_back_link:
{}
Update Interval: 0
Value: true
- Alpha: 1
Class: rviz/RobotModel
Collision Enabled: false
Enabled: true
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: ""
base_footprint:
Alpha: 1
Show Axes: false
Show Trail: false
base_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
left_wheel_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
right_wheel_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
robot_caster_back_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
Name: RobotModel
Robot Description: robot_description
TF Prefix: ""
Update Interval: 0
Value: true
Visual Enabled: true
- Class: rviz/Axes
Enabled: true
Length: 1
Name: Axes
Radius: 0.01
Reference Frame: <Fixed Frame>
Value: true
- Alpha: 1
Axes Length: 1
Axes Radius: 0.1
Class: rviz/Pose
Color: 255; 25; 0
Enabled: true
Head Length: 0.3
Head Radius: 0.1
Name: Pose
Shaft Length: 1
Shaft Radius: 0.05
Shape: Arrow
Topic: /move_base_simple/goal
Unreliable: false
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Fixed Frame: odom
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Topic: /initialpose
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/ThirdPersonFollower
Distance: 8.81253
Enable Stereo Rendering:
Stereo Eye Separation: 0.06
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: 0.210075
Y: 1.75923
Z: -1.01328e-06
Name: Current View
Near Clip Distance: 0.01
Pitch: 1.5698
Target Frame: <Fixed Frame>
Value: ThirdPersonFollower (rviz)
Yaw: 1.54041
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 1028
Hide Left Dock: false
Hide Right Dock: true
QMainWindow State: 000000ff00000000fd00000004000000000000017a0000037afc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006400fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c00610079007301000000280000037a000000dd00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f0000037afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a0056006900650077007300000000280000037a000000b000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000003a80000003efc0100000002fb0000000800540069006d00650100000000000003a8000002f600fffffffb0000000800540069006d00650100000000000004500000000000000000000002280000037a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: true
Width: 936
X: 963
Y: 14
Originally posted by Acehomie on ROS Answers with karma: 3 on 2021-09-26
Post score: 0
Original comments
Comment by osilva on 2021-09-27:
Can you send a snapshot of your RVIZ settings. Make sure Fixed Frame and Robot Model are selected.
Comment by Acehomie on 2021-09-27:
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"?
Comment by gvdhoorn on 2021-09-27:
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.