Welcome to ROSMASTER M1 PRO repository
3.Visual Relocalization Marker
Visual Relocalization Marker
Visual Relocalization Marker1. Course ContentLearning Objectives2. Preparation2.1 Map Preparation2.2 ArUco Tag Marker3. Placing the ArUco Tag Markers in the Map4. Recording the ArUco Global Map Coordinates
1. Course Content
Learning Objectives
After completing this course, you will be able to:
Master the working principle of ArUco tag markers in robot visual relocalization.
Master the process of using the aritag_recorder_panel tool to record the global coordinates of tag markers.
Understand the data structure and application of the aritag_relocation.yaml configuration file.
Important
This lesson is a comprehensive lesson for the sandbox map, introducing the complete process of building the sandbox map. For detailed principles, parameter debugging, operation steps, and other content, refer to the lessons in the 【Aruco Marker Visual Relocalization Navigation】 chapter.
The visual relocalization here is an enhancement mechanism and is not mandatory, but it can provide more stable localization in various environments, and is used to solve: odometry error, degradation, chaotic localization in similar scenes, and other situations.
2. Preparation
2.1 Map Preparation
First follow the previous lesson to complete building the sandbox grid map, pose map, and road network file creation.
2.2 ArUco Tag Marker
Prepare the ArUco tag markers, which can be obtained through the following methods:
The tag markers included in the sandbox map kit.
Download and print the tag markers yourself from the attachment materials.
Determine the size of the tag marker.
Measure the actual edge length of the tag marker with a measuring tool. The edge length of the tag markers included in the sandbox map kit is 0.048m.

Modify the ArUco detection configuration file (if you use the tag markers included with the sandbox map, the factory default size is 0.048 and no modification is needed).
~/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_bringup/param/common.yaml
If you printed the tag markers yourself, the printer may scale them, so measure and modify size to the actual size.
xxxxxxxxxx...apriltag# node name ros__parameters image_transportraw # image format: "raw" or "compressed" family36h11 # tag family name: 16h5, 25h9, 36h11 size0.048 # default tag edge size in meter...
3. Placing the ArUco Tag Markers in the Map
The placement positions are determined according to actual needs; they can be placed at any position that the camera can observe, such as on the ground, wall, or anywhere else.
The following are reference placement positions for the tag markers.
Important
The relocalization function occurs after navigating to the target location. If a tag marker exists in the field of view, global relocalization is performed to calibrate the car's global position; if not, relocalization is skipped.

4. Recording the ArUco Global Map Coordinates
Start the function for recording the ArUco marker positions on the map.
xxxxxxxxxxros2 launch yahboomcar_bringup record_tag.launch.py
After startup, the interface is as shown below, with an aritag_recorder_panel panel on the left.

When a tag marker appears in the camera's field of view, the tf coordinates and serial number of the tag marker appear in the map.

Enter the ID of the tag marker to be recorded in the ArUco ID of the aritag_recorder_panel panel, then click Save (check whether the car's localization is accurate before recording).

Note:
Before recording the tag marker position, if you find that the laser contour deviates significantly from the environment edge features, as shown in the figure below, it proves that there is a localization error. In this case, you need to first use the 2D Pose Estimate tool to perform manual relocalization before recording the position.

The figure below proves accurate localization, with a high degree of matching between the laser contour and the environment edge features.

Repeat the above steps to complete the recording of all tag marker positions. The record file path:
xxxxxxxxxx~/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_bringup/param/aritag_relocation.yaml
After successful recording, the system writes the precise pose of that tag in the
mapcoordinate system intoaritag_relocation.yaml.
