yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
ROSMASTER M3 PRO📖
0.Configuration and Operation Guide
  • 1. Quick start handle to control the car
  • 2. Log in to the car and view the code
  • 3. Robotic Arm Calibration
  • 4. Enter the Docker (Jetson-Nano and Raspberry Pi 5 users, see here)
  • 5. Assembly video
  • 6. Modify the firmware parameters of the car control board
  • 7. Frequently Asked Questions and Precautions
  • 8. Precautions for DIY Robotic Arm
1.Chassis Control Course
  • 1.ROS control
  • 2.Handle control
  • 3.Keyboard control
  • 4.Angular velocity calibration
  • 5.Line velocity calibration
  • 6.Line patrol automatic driving
  • 7.Patrol
2.Lidar Course
  • 1.Lidar introduction and use
  • 2.Dual Lidar fusion
  • 3.Lidar obstacle avoidance
  • 4.Lidar tracking
  • 5.Lidar guard
  • 6.Gmapping-SLAM mapping
  • 7.Cartographer-SLAM mapping
  • 8.slam_toolbox mapping
  • 9.Navigation2 single-point navigation avoid
  • 10.Navigation2 multi-point navigation avoid
  • 11.Repositioning navigation
  • 12.RTAB-Map mapping
  • 13.RTAB-Map navigation
  • 14.APP mapping navigation
  • 15.Machine code handling
  • 16.Color block transport
  • 17.Navigation via Pose-Constrained Visual Relocalizationnew
3.Depth Camera Course
  • 1.Dabai_DCW2 camera introduction
  • 2.Depth pseudo-color image
  • 3.Depth camera distance measurement
  • 4.Wood block volume measurement
  • 5.Mediapipe gesture recognition
  • 6.Edge detection
  • 7.YOLOv8 object detection
  • 8.Deep learning object tracking
  • 9. Transformer Model Tracking Algorithmnew
4.Robotic Arm and 3D Space Gripping Course
  • 1.Robotic arm solution
  • 2.Robotic arm chassis linkage control
  • 3.Machine code ID sorting
  • 4.Sorting height abnormality machine code
  • 5.Tracking and gripping machine code
  • 6.Color block color sorting
  • 7.Sorting height abnormality color block
  • 8.Tracking and gripping color block
  • 9.Wood block shape sorting
  • 10.KCF tracking and gripping objects
  • 11.Medipipe gesture ID sorting machine code
  • 12.Mediapipe gesture height sorting machine code
  • 13.Desktop tracking and gripping machine code
  • 14.3D tracking machine code
  • 15.Line patrol and obstacle removal
5.Road network planning and navigationnew
  • 1. Introduction To Road Network Planning
  • 2. Build A Pose Map
  • 3. Road Network Annotation
  • 4. Planning And Navigation Between Waypoints
  • 5. Road Network Navigation In Any Pose
  • 6. Path Re-planning
6.OpenClaw Basic Coursenew
  • 1. Introduction to OpenClaw
  • 2. OpenClaw Core Concepts
  • 3. OpenClaw API-KEY Configuration
  • 4. OpenClaw Switch Models
  • 5. OpenClaw System Prompt Words
  • 6. OpenClaw Common CLI Commands
7.OpenClaw Interaction Methodnew
  • 1. OpenClaw Webchat Interaction
  • 2. OpenClaw Tui Interaction
  • 3. OpenClaw Voice Dialogue Interaction
  • 4. OpenClaw WhatsApp Interaction
8.OpenClaw Developmentnew
  • 1. OpenClaw connects to the MCP interface of the robot
  • 2. Robot CLI Command Tool
  • 3. Robot control plugin tool
  • 4. Reply bridge plugin tool
  • 5. OpenClaw multimodal vision
  • 6. OpenClaw chassis control
  • 7. OpenClaw robotic arm control
  • 8. OpenClaw skills development
  • 9. OpenClaw timed tasks
  • 10. OpenClaw multi-agent intelligent agent
  • 11. OpenClaw active interaction
  • 12. OpenClaw vector memory
9.OpenClaw Embodied intelligent applicationnew
  • 1. OpenClaw target tracking
  • 2. OpenClaw robotic arm tracking and grasping
  • 3. OpenClaw robotic arm fixed-point placement
  • 4. OpenClaw garbage sorting
  • 5. OpenClaw slam mapping and navigation
  • 6. OpenClaw navigation transfer
  • 7. OpenClaw machine code clip
  • 8. OpenClaw color line patrol
  • 9. OpenClaw visual distance measurement
10.OpenClaw scenario sandboxnew
  • 1. Map description and prop placement
  • 2. Build sand table map
  • 3. Visual relocation markers
  • 4. Map mapping markers
  • 5. OpenClaw scenario sandbox comprehensive case
11.AI Model Basics
  • 1.AI large model types and principles
  • 2.RAG retrieval enhancement and model training samples
  • 3.Embodied intelligent robot system architecture
  • 4.Embodied intelligent functions core source code
12.AI Model Development
  • 01.Register a model service provider account
  • 02. Configuring API-KEY
  • 03. Introduction to Dify
  • 04. Basic Dify Features
  • 05. AI Large Model Development - chatbot
  • 06. Deploy the RAG knowledge base
  • 07. RAG knowledge base + chatbot
  • 08. AI agent workflow
  • 09. Custom wake-up response
  • 10. Core module testing tools
13.AI Large Model (Text Version)
  • 1.Semantic understand instruction following
  • 2.Multimodal visual understand
  • 3.Multimodal visual understand+robotic arm grab
  • 4.Multimodal visual understand+SLAM navigation
  • 5.Robotic arm grab+Multimodal visual understand+SLAM navigation
  • 6.Intention estimation
14.AI Large Model(Voice Version)
  • 1.Semantic understand instruction following
  • 2.Multimodal visual understand
  • 3.Multimodal visual understand+robotic arm grab
  • 4.Multimodal visual understand+SLAM navigation
  • 5.Robotic arm grab+Multimodal visual understand+SLAM navigation
  • 6.Intention estimation
15.Mediapipe Visual Course
  • 1.Hand detection
  • 2.Posture detection
  • 3.Overall detection
  • 4.Facial Landmark Detection
  • 5.Face detection
  • 6.Face special effects
  • 7.3D object recognition
  • 8.Brush
  • 9.Finger control
  • 10.Palm target positioning
  • 11.Fingertip trajectory recognition
  • 12.Fingertip gesture control robotic arm
  • 13.Gesture grabbing and releasing objects
  • 14.Finger control robotic arm
  • 15.Medipipe gesture control robotic arm action group
16.MoveIt2 Simulation Course
  • 1.MovelT2 configuration
  • 2.MovelT2 simulation-reality linkage
  • 3.Random movement
  • 4.Forward kinematics design
  • 5.Inverse kinematics design
  • 6.Cartesian path
  • 7.Trajectory planning
  • 8.Collision detection
  • 9.Scene design
17.Multi-vehicle Course
  • 1.Multi-vehicle chassis control
  • 2.Multi-vehicle robotic arm control
  • 3.Multi-vehicle navigation
  • 4.Multi-vehicle formation
18.Control Board Course
  • 1.Development environment setup
  • 2.Control board STM32 basic routine
  • 3.Control board micro_ros basic routine
19.Docker Course
  • 1、Docker overview and docker installation
  • 2、Common commands for docker image containers
  • 3、Docker images deeply understand and publish images
  • 4、Docker hardware interaction and data processing
  • 5、Enter the bot's docker container
  • 6、Robot development environment construction in Docker
20.Image Processing Basics Course
  • 1. Introduction to Open Source CV
  • 2. Image reading and display
  • 3. Image writing
  • 4. Image quality
  • 5. Pixel Operation
  • 6. Image zoom
  • 7. Image cutting
  • 8. Image translation
  • 9. Image Mirroring
  • 10. Affine Transformation
  • 11. Image Rotation
  • 12. Perspective Transformation
  • 13. Grayscale processing
  • 14. Image Binarization
  • 15. Edge Detection
  • 16. Line drawing
  • 17. Rectangle and circle drawing
  • 18. Drawing text and pictures
21.Main Control Course
Jetson Nano B01
  • 1. Introduction to the Jetson Nano B01 SUB Board
  • 2. Burn the system image
  • 3. Re-read the memory card or USB drive that has been burned
  • 4. Startup system
  • 5. Jetson Nano B01 System and Desktop Introduction
  • 6. Memory card or USB flash drive expansion
  • 7. Network Configuration
  • 8. SSH remote login & file transfer
  • 9. VNC Remote Login
  • 10. Jetson Nano B01 system backup
  • 11. Jetson Nano Swap space increased
  • 12. Installation and use of Jtop
Jetson Orin Nano_NX
  • 1.Jetson Orin board introduction
  • 2.Restore the factory image system
  • 3.Backup SSD system
  • 4.SSD expansion
  • 5.Network configuration
  • 6.SSH remote login
  • 7.VNC remote control
  • 8.Remote file transfer
  • 9.Jtop tool
  • 10.Exchange space expansion
Raspberry Pi
  • 1. Introduction to Raspberry PI 5
  • 2. Raspberry PI system installation and backup
  • 3. Powering the Raspberry PI 5
  • 4. Startup of Raspberry PI 5
  • 5. Update and upgrade operating system
  • 6. Introduction to raspi-config tool
  • 7. config.txt file description
  • 8. Network Configuration
  • 9. remote access
  • 10. Transfer files remotely
  • 11. Set display resolution and rotation
  • 12. Set screen to sleep
  • 13. Play audio and video
  • 14. Using USB camera
  • 15. Using MIPI camera
  • 16. Get real-time temperature of Raspberry Pi
22.Linux System Course
  • 1.Introduction to Linux system
  • 2.Ubuntu file system
  • 3.Ubuntu common commands
  • 4.Ubuntu common editors
  • 5.Ubuntu software operation commands
  • 6.Virtual machine installation
  • 7.SSH remote control
  • 8.VNC remote control
  • 9.Transfer files remotely
  • 10.Driver library and communication
  • 11.Static IP and hotspot mode
  • 12.Bind device ID
  • 13.Capacity expansion and resource allocation
  • 14.Update system software sources
  • 15.Set root user password
  • 16.sudo free password
  • 17.Connect to WiFi network
  • 18.View system version
  • 19.Customized service management
  • 20.Back up system image
23.ROS2 Basic Course
  • 1.Introduction to ROS2
  • 2.ROS2 install Humble
  • 3.ROS2 development environment
  • 4.ROS2 workspace
  • 5.ROS2 function package
  • 6.ROS2 node
  • 7.ROS2 topic communication
  • 8.ROS2 service communication
  • 9.ROS2 action communication
  • 10.ROS2 custom interface message
  • 11.ROS2 parameter service case
  • 12.ROS2 meta-function package
  • 13.ROS2 distributed communication
  • 14.ROS2 DDS
  • 15.ROS2 time related API
  • 16.ROS2 common command tools
  • 17.ROS2 rviz2 use
  • 18.ROS2 rqt toolbox
  • 19.ROS2 Launch startup file configuration
  • 20.ROS2 recording and playback tool
  • 21.ROS2 URDF model
  • 22.ROS2 Gazebo simulation platform
  • 23.ROS2 TF2 coordinate transformation
Download
  • Mapping_APP(iOS_Android)
  • Robot_Image_System_File
  • Code-Firmware
  • Instruction_Manual
  • VM_File
  • Software_Tools
  • Firmware_DriverFile
  • 3D_Model_File
  • ROS2_Basic_VM
  • Other_Annex
Download ZIP

Welcome to ROSMASTER M3 PRO repository

17.Navigation via Pose-Constrained Visual Relocalization

Pose Constrained Visual Relocalization Navigation

Pose Constrained Visual Relocalization Navigation1. Course ContentLearning Objectives2. Prerequisites3. Building Grid Map and Pose Map4. Recording ArUco Tag Map Coordinates4.1 Preparing ArUco Tags4.2 Deploying ArUco Tags4.3 Starting the Tag Recording Node5. Starting Visual Relocalization Navigation Mode5.1 Verifying Relocalization Function5.2 Service Control for Tag Detection6. Source Code Analysis6.1 Tag Recording Node Launch File6.2 Relocalization Mode Navigation Launch File6.3 aritag_relocation.yaml File Structure6.4 Visual Relocalization Working Principle6.5 Tag Configuration Parameters6.6 Inter-node Communication Diagram

1. Course Content

  • Implement visual relocalization navigation using ArUco tags combined with pose constraints.

  • By deploying ArUco tags as spatial anchors, when robot localization is lost or cumulative error becomes too large, visual detection automatically triggers relocalization to correct the robot's global pose in the map, improving the robustness and reliability of the navigation system.

Learning Objectives

  • Master the preparation, deployment, and position recording methods for ArUco tags

  • Understand the working principles and applicable scenarios of visual relocalization

  • Learn to use navigation mode with pose constraints combined with visual relocalization

2. Prerequisites

  • Use the following command to start the microROS agent and connect to the chassis

sh start_agent.sh

image-20251119183557230

 

3. Building Grid Map and Pose Map

  • Start the SLAM mapping node

xxxxxxxxxx
ros2 launch slam_mapping slam_toolbox.launch.py
  • Control the vehicle to move using keyboard or gamepad to complete map building

image-20260512140652077

 

  • Save the grid map

xxxxxxxxxx
ros2 launch slam_mapping save_slamtoolbox_map.launch.py

image-20260512140858300

Note

  • The map will be saved in the $HOME/map directory

 

  • Check Pose Points

    • Click the MarkerArray option in the Display panel of Rviz to view the pose points of the pose map. Ensure there are sufficient pose points evenly distributed in the map area for positioning during subsequent navigation.

image-20260506194426377

  • Save the pose map

xxxxxxxxxx
ros2 launch slam_mapping save_slamtoolbox_map.launch.py map_type:=posegraph

image-20260512141100541

 

  • After saving both the grid map and pose map, press Ctrl+C in the mapping node terminal to stop mapping

 

4. Recording ArUco Tag Map Coordinates

4.1 Preparing ArUco Tags

  • You can obtain them through the following methods:

    • Tags from the sand table map package

    • Download and print tags from the attachment materials

  • Determine the tag size

    • Measure the actual edge length of the tag using measuring tools. The edge length of tags from the sand table map package is 0.048m

image-20260506165106029

  • Modify the ArUco detection configuration file

xxxxxxxxxx
$HOME/M3Pro_ws/src/m3pro_bringup/config/common.yaml
  • Modify the size to the actual measurement. If you are using tags from the sand table map package, the factory default size is 0.048 and no modification is needed

xxxxxxxxxx
...
apriltag:                 # node name
  ros__parameters:
    image_transport: raw  # image format: "raw" or "compressed"
    family: 36h11         # tag family name: 16h5, 25h9, 36h11
    size: 0.048             # default tag edge size in meter
...

 

4.2 Deploying ArUco Tags

  • Place ArUco tags at desired locations on the map. They can be placed at any position visible to the camera, such as the floor, wall, or any other location.

Important

Placement Tips

  • It is recommended to place them near the starting or ending points of frequent navigation routes to trigger relocalization before the vehicle departs or after it reaches the target

  • It is not recommended to place them during movement because when the vehicle is moving, the robotic arm may cause mechanical vibration, leading to frequent camera frame shaking and inaccurate vehicle position calculation

image-20260512145812324

 

4.3 Starting the Tag Recording Node

xxxxxxxxxx
ros2 launch m3pro_bringup record_tag.launch.py
  • Use the keyboard or gamepad to control the vehicle to move near the tag that needs to be recorded, so that the tag appears in the camera's field of view

  • In the ArUco ID field of the aritag_recorder_panel panel, enter the tag ID that needs to be recorded, then click Save (ensure the vehicle positioning is accurate before recording)

image-20260512150842076

 

  • Before recording the tag position, if you find that the laser contour deviates significantly from the environmental edge features, as shown in the figure below, it indicates a positioning error. At this point, you need to first use the 2D Estimate tool for manual relocalization before recording the position

image-20260512165237920

  • The figure below shows accurate positioning with high matching between the laser contour and environmental edge features

image-20260512165738343

 

  • Repeat the above steps to complete recording all tag positions. The recording file path is:

xxxxxxxxxx
$HOME/M3Pro_ws/src/m3pro_bringup/config/aritag_relocation.yaml

image-20260507111149505

  • After recording tag positions, press Ctrl+C to close the recording node

 

5. Starting Visual Relocalization Navigation Mode

xxxxxxxxxx
ros2 launch M3Pro_navigation toolbox_location_nav.launch.py relocation:=True detection_enabled:=True
  • After starting, the interface is the same as regular navigation

image-20260512155304507

 

5.1 Verifying Relocalization Function

  • You can manually move the robot's position (simulating severe odometer error or positioning confusion, as shown in the figure above)

  • When a tag from the map appears in the camera's field of view, relocalization will be automatically triggered to correct the robot's global positioning in the map

image-20260512160923258

5.2 Service Control for Tag Detection

  • Since the aritag detection node occupies CPU at high frequency, you can disable the detection state when detection is not needed. The node provides the control_detection service to control whether tag detection is performed

  • Query status

xxxxxxxxxx
ros2 service call /control_detection apriltag_localization/srv/ControlDetection "{command: 0}"

image-20260512172021427

  • Enable detection

xxxxxxxxxx
ros2 service call /control_detection apriltag_localization/srv/ControlDetection "{command: 1}"

image-20260512172045344

 

  • Disable detection (reduce CPU usage)

xxxxxxxxxx
ros2 service call /control_detection apriltag_localization/srv/ControlDetection "{command: 2}"

image-20260512172102096

 

6. Source Code Analysis

6.1 Tag Recording Node Launch File

xxxxxxxxxx
$HOME/M3Pro_ws/src/m3pro_bringup/launch/record_tag.launch.py

 

xxxxxxxxxx
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument,IncludeLaunchDescription, TimerAction, ExecuteProcess
from launch.launch_description_sources import PythonLaunchDescriptionSource

def generate_launch_description():
    # Step 1: Declare output file path parameter
    output_file_path_arg = DeclareLaunchArgument(
        'output_file_path',
        default_value=os.path.join(get_package_share_directory("m3pro_bringup"),"config","aritag_relocation.yaml"),
        description='Path to the output YAML file for saving AprilTag poses'
    )

    # Step 2: Declare target coordinate frame parameter
    target_frame_arg = DeclareLaunchArgument(
        'target_frame',
        default_value='map',
        description='Target coordinate frame for recording AprilTag poses'
    )

    # Step 3: Create ArUco recorder node
    apriltag_recorder_node = Node(
        package='apriltag_localization',
        executable='apriltag_recorder',
        name='apriltag_recorder',
        output='screen',
        parameters=[{
            'output_file_path': LaunchConfiguration('output_file_path'),
            'target_frame': LaunchConfiguration('target_frame'),
        }]
    )

    # Step 4: Start navigation and SLAM toolbox
    navigation_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource([os.path.join(
            get_package_share_directory('M3Pro_navigation'),
            'launch',
            'toolbox_location_nav.launch.py'
        )]),
        launch_arguments={
            "rviz_config": os.path.join(
                get_package_share_directory('m3pro_bringup'),
                'rviz',
                'aritag_record.rviz'
            ),
            "log_level": "info",
        }.items()
    )

    # Step 5: Enable ArUco detection service after 8 seconds delay
    call_detection_service = TimerAction(
        period=8.0,
        actions=[
            ExecuteProcess(
                cmd=['ros2', 'service', 'call', '/control_detection',
                     'apriltag_localization/srv/ControlDetection',
                     '{command: 1}'],
                output='screen'
            )
        ]
    )

    return LaunchDescription([
        output_file_path_arg,
        target_frame_arg,
        apriltag_recorder_node,
        navigation_launch,
        call_detection_service
    ])

Code Explanation:

  1. Parameter Declaration:

    • output_file_path: Specifies the YAML file path for saving ArUco tag positions, default is aritag_relocation.yaml

    • target_frame: Target coordinate frame, default is map (map coordinate system)

  2. apriltag_recorder Node:

    • Function: Listens for ArUco tags in the camera's field of view and saves their poses in the map coordinate system to a YAML file

    • Input: Camera image topic, tf coordinate transformation

    • Output: aritag_relocation.yaml configuration file

  3. navigation_launch:

    • Starts the SLAM toolbox navigation system to provide accurate robot poses

    • Loads the dedicated RViz configuration file aritag_record.rviz, which includes the aritag_recorder_panel

  4. call_detection_service:

    • Uses TimerAction to call the /control_detection service after an 8-second delay

    • Enables ArUco detection (command: 1 means enable)

    • The delay is to wait for the system to fully start before enabling detection, avoiding resource conflicts

 

6.2 Relocalization Mode Navigation Launch File

xxxxxxxxxx
$HOME/M3Pro_ws/src/M3Pro_navigation/launch/toolbox_location_nav.launch.py

This launch file is the core entry point for visual relocalization navigation, coordinating the startup of chassis, localization, navigation and other modules. Below is a detailed explanation:

xxxxxxxxxx
def generate_launch_description():
    #Map folder and file detection
    map_folder_dir = os.path.join(os.path.expanduser('~'), 'map')

    # Declare arguments
    declared_arguments = []
    m3pronav_dir=os.path.join(get_package_share_directory('M3Pro_navigation'))

    #Map file
    declared_arguments.append(
        DeclareLaunchArgument(
            "map",
            default_value="map.yaml",
            description="map name",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "gui",
            default_value='True',
            description="if rviz is used, set to True. If False, rviz will not be launched.",
        )
    )
    #slam_toolbox pose map file
    declared_arguments.append(
        DeclareLaunchArgument(
            "pose_map",
            default_value="map",
            description="",
        )
    )

    declared_arguments.append(
        DeclareLaunchArgument(
            'relocation',
            default_value='false'
        )
    )

    declared_arguments.append(
        DeclareLaunchArgument(
            'detection_enabled',
            default_value='false'
        )
    )

    #Navigation parameter file
    declared_arguments.append(
        DeclareLaunchArgument(
        "params_file",
        default_value= os.path.join(get_package_share_directory("M3Pro_navigation"), "param", "yahboom_M3Pro.yaml"),
            description="Full path to param file to load",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "use_sim_time",
            default_value="False",
            description="Use simulation (Gazebo) clock if true",
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "rviz_config",
            default_value=os.path.join(m3pronav_dir,'rviz','nav2.rviz')
        )
    )
    declared_arguments.append(
        DeclareLaunchArgument(
            "log_level",
            default_value="info",
            description="log level"
        )
    )

    # Initialize Arguments
    map = LaunchConfiguration("map")
    map_dir=PathJoinSubstitution([map_folder_dir, map])
    pose_map=PathJoinSubstitution([map_folder_dir, LaunchConfiguration("pose_map")])

    params_file=LaunchConfiguration("params_file")
    use_sim_time=LaunchConfiguration("use_sim_time",default="false")
    rviz_config=LaunchConfiguration("rviz_config")
    log_level=LaunchConfiguration("log_level")


    carbase_launch=IncludeLaunchDescription(
                PythonLaunchDescriptionSource(os.path.join(get_package_share_directory('m3pro_bringup'),'launch','car_base.launch.py')),
                launch_arguments={'log_level': log_level,
                                  'relocation': LaunchConfiguration('relocation'),
                                  'detection_enabled': LaunchConfiguration('detection_enabled'),
                                  }.items())

    #navigation2 modified launch file, blocking AMCL positioning function
    nav2_launch_mod = os.path.join(m3pronav_dir,
                                    'launch',
                                    'bringup_mod.launch.py'
                                    )

    # slamtoolbox positioning algorithm startup file
    slamtoolbox_localization_launch_file=os.path.join(get_package_share_directory('slam_mapping'),'launch','localization_launch.py')


    #slamtoolbox positioning navigation
    slamtoolbox_localization_nav = GroupAction(
        actions=[
            # Start navigation2 navigation file (no global positioning)
            IncludeLaunchDescription(
                PythonLaunchDescriptionSource(nav2_launch_mod),
                launch_arguments={
                                "map": map_dir,
                                "params_file": params_file,
                                "use_sim_time":use_sim_time,
                                "log_level": log_level,
                                }.items()),
            #Start slamtoolbox positioning node
            IncludeLaunchDescription(
                PythonLaunchDescriptionSource(slamtoolbox_localization_launch_file),
                launch_arguments={
                    "pose_map": pose_map,
                    "use_sim_time":use_sim_time,
                }.items(),
            ),
            #Log Printing
            LogInfo(msg=['====================Robot-M3Pro Navigation Start with SlamToolbox localization===================='])
        ]
    )

    #rviz node
    rviz_node = Node(
        package = 'rviz2',
        executable = 'rviz2',
        name='rviz2',
        arguments=['-d', rviz_config],
        parameters=[{'use_sim_time': use_sim_time}],
        output='screen',
        condition=IfCondition(LaunchConfiguration('gui'))
    )

    return LaunchDescription(
        [
            *declared_arguments,                #Declare arguments
            rviz_node,                          #rviz node
            carbase_launch,
            slamtoolbox_localization_nav       #slamtoolbox positioning navigation
        ]
    )

 

Code Explanation:

  1. carbase_launch:

    • Starts chassis basic nodes, including camera, robotic arm assistance, LiDAR fusion, etc.

    • Passes relocation and detection_enabled parameters to control whether visual relocalization is enabled

  2. nav2_launch_mod:

    • Uses the modified Nav2 launch file (bringup_mod.launch.py)

    • This version blocks the AMCL positioning function because the system uses SlamToolbox for positioning

  3. slamtoolbox_localization_nav:

    • This is a GroupAction containing multiple cooperating components:

      • Starts the modified Nav2 navigation stack (path planning, costmap, controller, etc.)

      • Starts the SlamToolbox positioning node and loads the pose map to achieve constrained positioning

      • Prints startup log information

  4. rviz_node:

    • Starts RViz2 visualization tool

    • Uses IfCondition to only start when gui=True

    • Loads the specified RViz configuration file containing navigation-related display panels

6.3 aritag_relocation.yaml File Structure

The structure of the generated aritag_relocation.yaml file after recording is as follows:

xxxxxxxxxx
tags:
  - id: 0                    # ArUco tag ID
    position:                # Position coordinates (relative to map coordinate system)
      x: 1.234               # X coordinate (meters)
      y: 0.567               # Y coordinate (meters)
      z: 0.0                 # Z coordinate (meters, usually 0 for floor height)
    orientation:             # Attitude (quaternion)
      x: 0.0
      y: 0.0
      z: 0.123
      w: 0.987
  - id: 1
    position:
      x: 2.345
      y: 1.234
      z: 0.0
    orientation:
      x: 0.0
      y: 0.0
      z: 0.456
      w: 0.890

Field Description:

FieldTypeDescription
idintUnique identifier ID of the ArUco tag
position.xfloatX coordinate of the tag in map coordinates (meters)
position.yfloatY coordinate of the tag in map coordinates (meters)
position.zfloatZ coordinate of the tag in map coordinates (meters)
orientation.x/y/z/wfloatAttitude quaternion of the tag, representing the tag's orientation

6.4 Visual Relocalization Working Principle

  1. Detect ArUco Tags: Camera continuously detects ArUco tags within its field of view

  2. Match Global Coordinates: If a tag is detected, read its global coordinates from aritag_relocation.yaml

  3. Calculate Deviation: Compare the current odometer estimated position with the actual position provided by ArUco

  4. Correct Pose: Use ArUco's position to correct the robot's global pose

Relocalization Advantages:

  • ✅ Eliminate Cumulative Error: Odometer accumulates error over time, and ArUco provides absolute position reference

  • ✅ Solve Degenerate Scenarios: In long corridors or areas with similar features, laser SLAM may have positioning confusion, and ArUco provides reliable anchors

Precautions: ⚠️ Before recording tag positions, ensure laser positioning is accurate (laser contour matches environmental edges) ⚠️ If tag positions change, you need to re-record their global coordinates

 

6.5 Tag Configuration Parameters

  • Configuration parameter file path for the tag node

xxxxxxxxxx
$HOME/M3Pro_ws/src/m3pro_bringup/config/common.yaml

Parameter Description:

ParameterDescriptionDefault Value
image_transportImage transport format, raw for raw image, compressed for compressed imageraw
familyArUco tag family type, different families have different encoding methods36h11
sizePhysical edge length of the tag (unit: meters), must match actual size0.048
profileWhether to output performance analysis informationfalse
max_hammingMaximum allowed hamming distance (error correction bits), 0 means no correction0
detector.threadsNumber of detection threads1
detector.decimatePyramid downsampling rate, larger value means faster detection but lower accuracy2.0
detector.blurGaussian blur sigma value for quadrilateral detection0.0
detector.refineWhether to enable edge sharpening for precise positioningtrue
detector.sharpeningDecoded image sharpening intensity0.25
detector.debugWhether to output debug images to the current working directoryfalse
pose_estimation_methodPose estimation method, pnp means using PnP algorithmpnp
tag.idsList of tag IDs to detect, only tags in the list will be detected[1-20]
tag.framesList of corresponding TF coordinate frame names for the IDs[tag1-tag20]

Important Parameter Tuning Suggestions:

  • size: Must be accurately measured and set. Errors will cause pose calculation errors

  • family: Must match the tag family being used, otherwise detection will fail

  • tag.ids: Only list the actually used tag IDs to reduce unnecessary TF publishing

xxxxxxxxxx
...
apriltag:                 # node name
  ros__parameters:
    image_transport: raw  # image format: "raw" or "compressed"
    family: 36h11         # tag family name: 16h5, 25h9, 36h11
    size: 0.048             # default tag edge size in meter
    profile: false        # print profiling information to stdout
    # tuning of detection (defaults)
    max_hamming: 0        # maximum allowed hamming distance (corrected bits)
    detector:
      threads: 1          # number of threads
      decimate: 2.0       # decimate resolution for quad detection
      blur: 0.0           # sigma of Gaussian blur for quad detection
      refine: true        # snap to strong gradients
      sharpening: 0.25    # sharpening of decoded images
      debug: false            # write additional debugging images to current working directory
    pose_estimation_method: "pnp" # method for estimating the tag pose
    tag:
      ids:    [1, 2, 3, 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]         # tag IDs for which to publish transform
      frames: [tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10, tag11, tag12, tag13, tag14, tag15, tag16, tag17, tag18, tag19, tag20]
...

 

6.6 Inter-node Communication Diagram

  • Start during relocalization navigation operation:

xxxxxxxxxx
ros2 run rqt_graph rqt_graph
  • The apriltag node subscribes to the camera topic to detect tags and publishes the /detections topic. The relocalization node apriltag_relocation subscribes to /detections. When a tag is detected, it calculates the vehicle's base_link position in the map coordinate system based on the recorded map anchor coordinates of the tag, and publishes to /initialpose to trigger the slam_toolbox node's positioning function to calculate the precise vehicle coordinates in the map from the pose constraint graph.

image-20260512163350766

 

Color block transport
Dabai_DCW2 camera introduction

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文