$\color{white}\colorbox{FE9227}{Taking the initial steps towards understanding and growth!}$

$$▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░ 14.3%

$$


The first key component to understand when creating a robot is the tf2 library. The tf2 library lets the user keep track of multiple coordinate frames over time. tf2 maintains the relationship between coordinate frames in a tree structure buffered in time and lets the user transform points, vectors, etc, between any two coordinate frames at any desired point in time.

In essence, tf2 is the glue that holds your robot together. Let’s look at a simple tf2 transform to describe a robot.

Table of Contents

1. Links

A robot’s components, or pieces, are described using links. A link declares the existence of a robot part, along with some descriptive criteria that describe a robot's visual, collision, inertial, and origin properties.

inertial.png

a. Origin

Beginning with origin, this tag declares where within the link ROS should believe the center is. The origin tag has two components, xyz and rpy. The xyz component represents the translation of the origin within the three declared axis. The rpy component represents the roll, pitch, and yaw of the origin. This is useful to orient the axis of the link with the frame of the simulation.

Let’s take a sphere for example. A simple sphere with its origin set to xyz='0 0 0' rpy='0 0 0' will have its origin at the dead center of the geometry. A sphere with its origin set to xyz='1 0 0' rpy='0 0 0' will have its origin translated 1 m in the positive direction of the X-axis. This example is shown below.

SPHERE_ORIGIN_CENTER.png

Sphere origin at xyz='0 0 0' rpy='0 0 0'

SPHERE_ORIGIN_SHIFT.png

Sphere origin at xyz='2 0 0' rpy='0 0 0'

b. Visual

Next, the visual tag declares the visual properties of the link. Within the visual tag is an origin tag. The example above had its visual tag origin shifted. Also within the visual tag is a geometry tag. This tag declares what the visual geometry of the link should be. Possible tags for the geometry tag are shown below:

<tag> Description
<box size="# # #" /> The link will have box geometry defined by the length, width, and height params
<cylinder radius="#" length="#" /> The link will have cylinder geometry defined by the radius, and the length
<sphere radius="#" /> The link will have spherical geometry, defined by the radius
<mesh filename="package://<package_name>/<path>" /> The link will have specific geometry defined by a mesh. The mesh is recommended to be in file type .dae but will accept other filetypes like .stl

c. Collision

The collision tag declares the collision properties of a link. This can be different from the visual properties of a link, for example, simpler collision models are often used to reduce computation time. There can be multiple instances of collision tags within a link. These collision tags will be combined to determine the union collision geometry of the link. The collision tag includes an origin element, and a geometry element (see visual tag).

d. Inertial

The inertial tag declares the link’s mass, the position of the center of mass, and its central inertia properties. The inertial tag contains an origin, a mass tag where the mass of the link is represented by the value attribute of this element, and an inertia tag.