Missing link in manipulator urdf /xacro and visualizing in rviz
Hello everyone,
I am trying to write a launch file in order to visualize a manipulator in Rviz. The manipulator can be found here:
https://github.com/ipa320/schunk_modu...
I am using the xacro file lwa.urdf.xacro to build my robot.
I created another xacro file where I applied the macro in the previous urdf.xacro file. It looks like this:
<?xml version="1.0" ?>
<robot name="schunk_lwa" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="$(find schunk_description)/urdf/lwa/lwa.urdf.xacro"/>
<xacro:schunk_lwa parent="base_link" name="Schunk_lwa">
<origin xyz="0 0 0 "/>
</xacro:schunk_lwa>
</robot>
My launch file looks like this :
<launch>
<arg name="model" />
<!-- Parsing xacro and setting robot_description parameter -->
<param name="robot_description" command="$(find xacro)/xacro $(find schunk_description)/urd/lwa/lwa.xacro"/>
<!-- Setting gui parameter to true for display joint slider -->
<param name="use_gui" value="true"/>
<!-- Starting Joint state publisher node which will publish the joint values -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<!-- 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 mastering_ros_robot_description_pkg)/urdf.rviz" required="true" />
</launch>
However, when I run the launchfile, the error occurs:
[ERROR] [1585922552.126688366]: Failed to build tree: parent link [base_link] of joint [Schunk_lwa_base_joint] not found. This is not valid according to the URDF spec. Every link you refer to from a joint needs to be explicitly defined in the robot description. To fix this problem you can either remove this joint [Schunk_lwa_base_joint] from your urdf file, or add "<link name="base_link" />" to your urdf file.
[robot_state_publisher-2] process has died [pid 12234, exit code 1, cmd /opt/ros/melodic/lib/robot_state_publisher/robot_state_publisher __name:=robot_state_publisher __log:=/home/phan/.ros/log/a26135c2-75a2-11ea-a8dd-a0afbd22d805/robot_state_publisher-2.log].
log file: /home/phan/.ros/log/a26135c2-75a2-11ea-a8dd-a0afbd22d805/robot_state_publisher-2*.log
[WARN] [1585922553.516583, 5790.022000]: The 'use_gui' parameter was specified, which is deprecated. We'll attempt to find and run the GUI, but if this fails you should install the 'joint_state_publisher_gui' package instead and run that. This backwards compatibility option will be removed in Noetic.
[ERROR] [1585922553.542646165, 5790.047000000]: Failed to build tree: parent link [base_link] of joint [Schunk_lwa_base_joint] not found. This is not valid according to the URDF spec. Every link you refer to from a joint needs to be explicitly defined in the robot description. To fix this problem you can either remove this joint [Schunk_lwa_base_joint] from your urdf file, or add "<link name="base_link" />" to your urdf file.
From the error I assume that the base link is missing. I therefore added to the above urdf.xacro file the following pseudo base link:
<link name="${parent}">
</link>
Using this, it works.
However, my question is, why is in the original model no base link defined? I am afraid I am missing something ...