# Coordinates seem to show overlapping but RViz doesn't

How can you place two objects that seem to overlap with their units but appear stacked on top of each other [original intent] in RViz?

I was watching this video tutorial on ROS and URDF. I have tried to paste screenshots to clarify but feel free to watch the video if you have the time. The presenter is showing how to create a joint between base link and link 01 in the first image below.

Here's the xacro file that I am confused about. If the xyz coordinates of the origin of the box are [0 0 0] and its dimensions are [1 1 1], how can the cylinder have its origin at [0 0 0.2]? Isn't it within the box?

I considered that the xyz coordinates may be relative to the link itself but where does RViz know where to place the object in the world? Moreover, the joint is placed at [0 0 0.5] and this makes sense. Shouldn't the origin of the cylinder have been [0 0 1.2]? This is how it looks like in RViz.

The origin defined inside link_01 is not the position of the cylinder in the global coordinate frame (the "world"), but in its own private frame. By default the object's center lies at the origin of its own coordinate frame, but in this case, the cylinder is shifted $$0.2 m$$ upwards along the $$z$$ axis, placing its bottom on the origin.

The effect of this shift is that the reference point for any further manipulations of link_01 now lies on its bottom, instead of its center as would normally be the case.

Likewise, the origin defined in the base_link__link_01 joint is defined relative to the coordinate frame of the parent link, in this case base_link. It also specifies where the origin frame of the child link will be placed, relative to the frame of the parent link.

All this leads to the following configuration:

As you can see in the image above, the base_link__link_01 joint places the origin frame of link_01 $$0.5 m$$ above the origin frame of base_link. And since link_01 itself is shifted relative to its own frame, the result is that the bottom of link_01 is placed exactly on top of base_link.

The topic of coordinate frames, the transforms between them and their use in robotics is one of the more advanced, and unfortunately I don't know of a comprehensive reference on it, but this tutorial seems a good start point to getting acquainted with it.

• You wrote, "And since base_link ..." but did you mean to say, "And since link_01..."? Apr 25 '20 at 12:55
• Yes, you're right. Changed the answer to fix it. Apr 25 '20 at 12:58