Problem in adding two Schunk arms plus a simple shape (e.g. cylinder) into .urdf.xacro
Dear Friends, First of all, I apologize if my question may look trivial. I am new with ROS. Here is the problem: The aim is to have two Schunk arms mounted on a simple box. We have a robot.urdf.xacro file. This file "includes" the model of the arm:
<xacro:include filename="$(find schunk_description)/urdf/lwa4d/lwa4d.urdf.xacro" />
And uses it twice to have two arms:
<!-- arm -->
<xacro:schunk_lwa4d name="arm" parent="world" has_podest="true">
<origin xyz="0 0 0.026" rpy="0 0 0" />
</xacro:schunk_lwa4d>
<!-- arm2 -->
<xacro:schunk_lwa4d name="arm2" parent="world" has_podest="true">
<origin xyz="0.5 0.5 0.526" rpy="0 0 0" />
</xacro:schunk_lwa4d>
And then when I spawn the xacro file in launch file, 2 arms are loaded in Gazebo. Till here seems fine! But adding a simple shape to this set was/is a pain for me. I define a ros package, called myschunk_gazebo. Then I try to include one simple .xacro file including only a box (or cylinder) in myschunk_gazebo/models and I call the file simple_shape.xacro. I know that ROS can locate the package. I check it with rospack:
ros@ros:~/Documents/Damon_CPP/ROS_Workspace/devel$ rospack find myschunk_gazebo
/home/ros/Documents/Damon_CPP/ROS_Workspace/src/myschunk_gazebo
But from here the problem starts! Well, as I know, even this simple shape is called a "robot". So I write simple_shape.xacro. like:
<?xml version="1.0"?>
<robot name="myfirst">
<link name="base_link">
<visual>
<geometry>
<cylinder length="0.6" radius="0.2"/>
</geometry>
</visual>
</link>
</robot>
When I launch the file, only the empty space is loaded in gazebo. And between many messages, I thought this might be useful to be put in here:
Failed to find root link: Two root links found: [base_link] and [world]
I guess I know what is going on. We should have only one <robot>, which I have in my urdf.xacro file that I spawn in my launch file. But what I do when I include simple_shape.xacro is that I have two <robot> s. And hence, two root links.
I remove the lines related to robot and change simple_shape.xacro to:
<?xml version="1.0"?>
<link name="base_link">
<visual>
<geometry>
<cylinder length="0.6" radius="0.2"/>
</geometry>
</visual>
</link>
I also include base_link in my robot.urdf.xacro file:
<link name="base_link"/>
And loads only empty space. I don't think the inclusion of the file should be a problem. But I highly doubt if I use the shape in robot.urdf.xacro properly, or my codes for generating the shape are correct.
It would be so nice if a friend can clarify for me what is going on. Thanks. :)