Component editor tutorial 2: Simple cylinder


New component

Let’s start by creating a new component in the Library page. If you don’t know how to do it, please take a look to Creating a new component.

Modify visual

First, let’s expand everything in the tree until the geometry is visible and open its options menu. Select cylinder in the menu in order to update the geometry.

Now that we have our cylinder, let’s change its properties.

Select length element and then click on the value property, located at the bottom.

A pop-up will be shown. Change the length to 2 and click OK.

alt text

You can see the result on the following picture.

alt text

Finally, let’s also change the color. For that, we need to include a new child to the visual element. Open its options menu and select the material element.

Now, expand the material element and click on color. At the bottom, click on the value property to modify it.

Pick the color you prefer and click OK once you are ready. In this example we have used R: 139, G: 13, B: 242.

The cylinder’s color is now updated!

alt text

Adding a collision

At this point we have the visual part ready, which specifies how the component is going to be shown to the user. However, we also need to describe the component to the physics engine so it can interact with other components.

In order to add a collision, open the base_link element options menu and select collision.

Next, expand everything inside collision, and you will see a geometry element again. Let’s change it to cylinder and set the length to the same value as above.

alt text

Adding mass

In order to allow the component to be affected by gravity, we need to include an inertial element to the base_link. It includes properties such as the body mass, inertia and its centre of gravity.

To add this element, open the base_link element options menu and select intertial.

By adding a inertial element, a mass of 1kg will be set by default. Let’s click on the Value field, at the bottom to change it.

alt text

A modal will be shown. Change the mass to 0.5, for example, and click OK.

alt text

Your cylinder is now finished!