../_images/tiagopro-icon.png ../_images/kangaroo-icon.png ../_images/tiago-icon.png ../_images/ari-icon.png ../_images/talos-icon.png ../_images/mobile-bases-icon.png

๐Ÿ“ Localization#

Localization refers to the process of determining the position and orientation of the robot with respect to a fixed reference frame in a given environment.

PAL Robots Localization pipeline is compliant with the REP-105 ROS Standard which defines three reference frames for localization.

../_images/REP_105.svg

According to this standard, the purpose of the localization pipeline is to calculate the transform between the following frames:

  • base_link (or base_footprint) : Reference frame rigidly attached to the mobile robot base. This link can be attached to the base in any arbitrary position or orientation.

  • odom : Reference frame that is used to represent the continuous motion of the robot. The pose of the robot in the odom frame can drift over time, without any bounds, making the odom frame useless as a long-term global reference. However, the pose of a robot in the odom frame is guaranteed to be continuous, meaning that the pose of a mobile platform in the odom frame always evolves smoothly, without discrete jumps. In a typical setup, the odom frame is computed based on an odometry source, such as wheel odometry, visual odometry or an inertial measurement unit.

  • map : World-fixed reference frame representing an initial, reference pose selected on a map. The pose of a mobile platform, relative to the map frame, should not significantly drift over time. The map frame is not continuous, meaning the pose of a mobile platform in the map frame can change in discrete jumps at any time. In a typical setup, a localization component constantly re-computes the robot poses in the map frame based on sensor observations, therefore eliminating drift, but causing discrete jumps when new sensor information arrives.

../_images/localization_pipeline.svg

The localization pipeline can be further divided into two main components, the Local Localization and the Global Localization.

Local Localization#

The Local Localization pipeline is responsible for estimating the transform between the base_footprint (or base_link) and the odom frames. It does so by calculating the robotโ€™s odometry using the sensors available on the robot. As stated in the REP-105, this transform is guaranteed to be continuous, meaning that the pose of the robot in the odom frame always evolves continuously, without discrete jumps.

PAL Robots use an odometry system based on the fusion of wheel odometry, using wheel encoders, and a Laser Sensor, using a 2D LiDAR sensor.

../_images/local_localization_pipeline.svg

Warning

The direct_laser_odometry and the /direct_laser_odometry/odom are only available if your robot is equipped with a 2D Laser Sensor. Otherwise only the /mobile_base_controller/odom will be available.

Given this Local Localization pipeline, the /mobile_base_controller/odom contains the wheel odometry as estimated by the wheel encoders, and the /direct_laser_odometry/odom contains the fused information of the laser odometry and the wheel odometry.

Global Localization#

The Global Localization pipeline is responsible for estimating the transform between the map and the odom frames. It does so by using the Monte Carlo Localization (MCL) algorithm implemented in the Nav2 AMCL package.

../_images/global_localization_pipeline.svg

The purpose of this package is to correct the odometry drift by using a 2D LiDAR and compare its scans with a map of the environment (OccupancyGrid).

Warning

The amcl is only available if your robot is equipped with a 2D Laser Sensor.

The Global Localization pipeline, relies on the usage of a map of the environment, which can be created using the steps described in the ๐Ÿ—บ๏ธ Mapping section. Once created, this map is loaded and hosted by the map_server node. For more information about this node, the interfaces it provides and the configuration parameters, you can refer to the Nav2 Map Server documentation.

Configuration#

In addition to the available PAL configurations for the amcl node, you can create new configurations for your robot. To do so, you first need to create a new directory in the .pal folder of your robot.

mkdir -p ~/.pal/config

And then, within this folder, you can create a new amcl configuration file.

touch ~/.pal/config/99_my_amcl_config.yaml

Attention

The name of the file should start with a number to ensure that it is loaded last and overrides the default PAL configurations.

Within the newly created 99_my_amcl_config.yaml file, you can insert your custom amcl parameters. For the list of available parameters, their meaning and how they affect the AMCL algorithm, you can refer to the amcl configuration guide. When creating a new Navigation configuration file, you need to specify the node name it refers to, in this case, amcl.

/amcl:
   ros__parameters:
      # Your amcl parameters

Once created, to start using your custom amcl configuration, you need to restart the localization module with the command:

pal module restart localization

Note

This change is is persistent and will be loaded every time you start the localization module. If you want to revert to the default PAL configuration, you can simply delete the custom configuration file you created in the ~/.pal/config folder.

ROS 2 API#

To interact with the localization pipeline, you can refer to the following ROS 2 interfaces:

See also#

To continue learning about Localization and how to localize the robot in a map of the environment, you can refer to the following tutorials:

References#