Skip to content

Base xacro

Pedro Alcantara edited this page Oct 11, 2020 · 13 revisions

Description

The base:xacro adds the base link of the robot. The base link characteristics:

  • Name: base_link.
  • Collision: Box.
  • Visual: Simple white box or mesh.
  • Parameters:
    • base_prop [dictionary]: Dictionary with the base link properties. To be used in this parameter, it must have at least these variables:
      • mass [float]: Link mass in Kilograms.
      • x_size [float]: Link size on the X-axis in meters.
      • y_size [float]: Link size on the Y-axis in meters.
      • z_size [float]: Link size on the Z-axis in meters.
  • mesh [string]: Name of the base link mesh. The mesh name should also have the file extension. This parameter has a default value:'' (empty string). With the default value, the link visual is a white box, otherwise, it shows the mesh set in this parameter.

⚠️ The mesh file must be added inside the folder with the robot name, as shown in the package organization. The package_name and robot_name also MUST be set as a global property at the robot description file, as shown here.

Usage

Axis Orientation Pattern

This package defines the axis orientation pattern as the robot oriented to the positive side of the X-axis, as the figure shows:

Usage Examples

These are some examples of how to add this xacro to your robot file description.

  <!-- Base link -->
  <xacro:base base_prop="${base_props}" >
    <origin xyz="0 0 0" rpy="0 0 0" />
  </xacro:base> 
  <!-- Base link -->
  <xacro:base base_prop="${base_props}" mesh="${base_props['base']['mesh']}" >
    <origin xyz="0 0 0" rpy="${pi/2} 0 -${pi/2}" />
  </xacro:base> 

The default visual box of the mobile_robot and the mesh of the quimera_robot can be seen in the image above.

On the quimera_robot example, there are rotational transformations on Roll and Yaw. These adjustments can be necessary depending on the orientation and the choices made during the mesh modeling process on the CAD or 3D program. To use the other xacros is very important to make these adjustments in order to follow the axis orientation pattern.

Properties YAML File

A flexible way of setting the base properties is using YAML config files and import them in your description files. To import this file into your robot description, you can add these lines:

  <xacro:property name="base_yaml" value="$(find ${package_name})/config/${robot_name}/base.yaml" />
  <xacro:property name="base_props" value="${load_yaml(base_yaml)}"/>

Note that the ${package_name} and ${robot_name} are the values of the global xacro:property that must be set in your description files. After these lines, the base_props is a dictionary xacro:property that has the properties of the base_link and can be pass to the base_prob parameter of the xacro:base. The YAML file should be similar to this:

base:
  mass: 2.5               # Base mass in Kg
  x_size: 0.3             # Dimension in x-axis
  y_size: 0.2             # Dimension in y-axis
  z_size: 0.05            # Dimension in z-axis
  mesh: ''                # Name of the mesh files. Leave it empty ('') to have a white base.

For more details and references on how to import YAML files and the xacro:property dictionary, see the Xacro Wiki

Clone this wiki locally