VnRobo
AboutPricingBlogContact
🇻🇳VISign InStart Free Trial
🇻🇳VI
VnRobo logo

AI infrastructure for next-generation industrial robots.

Product

  • Features
  • Pricing
  • Knowledge Base
  • Services

Company

  • About Us
  • Blog
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2026 VnRobo. All rights reserved.

Made with♥in Vietnam
VnRobo
AboutPricingBlogContact
🇻🇳VISign InStart Free Trial
🇻🇳VI
  1. Home
  2. Blog
  3. SLAM and Navigation: How Robots Self-Localize and Move
navigationamrslamnavigation

SLAM and Navigation: How Robots Self-Localize and Move

Learn how robots use SLAM for mapping, self-localization, and path planning with ROS 2 Nav2 stack.

Nguyen Anh TuanJuly 1, 20253 min readUpdated: Jun 14, 2026
SLAM and Navigation: How Robots Self-Localize and Move

What is SLAM?

SLAM (Simultaneous Localization and Mapping) is a classic robotics problem: a robot must simultaneously build a map of its surrounding environment and determine its own position on that map. This is the foundation for autonomous robots to operate in previously unknown spaces.

This problem is difficult because two factors depend on each other — accurate localization requires a good map, but building a good map requires accurate localization.

Common SLAM Methods

LiDAR SLAM

Uses laser sensors to scan the environment in 2D or 3D. Common algorithms:

  • GMapping: 2D SLAM based on particle filters, suitable for indoor mobile robots. See more about LiDAR and 3D Mapping for advanced applications
  • Cartographer (Google): supports both 2D and 3D, handles loop closure well
  • RTAB-Map: combines LiDAR and RGB-D camera for detailed 3D mapping

Visual SLAM

Requires only a camera, much cheaper than LiDAR:

  • ORB-SLAM3: supports monocular, stereo, and RGB-D cameras
  • VINS-Fusion: visual-inertial SLAM, combines camera with IMU
  • OpenVSLAM: open-source, easy to integrate with ROS 2

Autonomous robot using SLAM for mapping and navigation
Autonomous robot using SLAM for mapping and navigation

ROS 2 Nav2 Stack

Nav2 is a complete navigation system for ROS 2, encompassing the entire pipeline from SLAM to motion control.

Nav2 Architecture

Sensor Data → SLAM → Map
                       ↓
Goal Position → Planner → Controller → Motor Commands
                       ↑
                  Costmap (obstacle layer + inflation layer)

Basic Nav2 Configuration

The nav2_params.yaml file is the central configuration hub:

bt_navigator:
  ros__parameters:
    global_frame: map
    robot_base_frame: base_link
    default_bt_xml_filename: navigate_w_replanning_and_recovery.xml

controller_server:
  ros__parameters:
    controller_frequency: 20.0
    FollowPath:
      plugin: "dwb_core::DWBLocalPlanner"
      max_vel_x: 0.5
      min_vel_x: -0.1
      max_vel_theta: 1.0

Launch Nav2 with SLAM

# Start SLAM (create new map)
ros2 launch nav2_bringup slam_launch.py

# Or use saved map (localization mode)
ros2 launch nav2_bringup localization_launch.py map:=/path/to/map.yaml

# Start navigation
ros2 launch nav2_bringup navigation_launch.py

Costmap and Obstacle Avoidance

Nav2 uses costmap — a layered cost map for path decisions:

  • Static Layer: static map from SLAM
  • Obstacle Layer: real-time obstacle detection from sensors
  • Inflation Layer: safety buffer around obstacles
  • Voxel Layer: 3D obstacles (if using depth camera)

Each cell on the costmap has a value from 0 (free) to 254 (obstacle). The planner finds the path with the lowest total cost.

Sensor system and costmap for autonomous robot obstacle avoidance
Sensor system and costmap for autonomous robot obstacle avoidance

Real-World Applications in Vietnam

Delivery robots in factories: Using RPLiDAR A2 (around 5 million VND) combined with Nav2 allows AMR robots to move between production stations, a core component of robot fleet management. Factory maps are usually stable, so SLAM only needs to run once, then switch to localization mode.

Restaurant service robots: Visual SLAM with Intel RealSense D435 camera significantly reduces hardware costs compared to LiDAR, suitable for environments with many moving people.

Practical Deployment Tips

  1. Choose appropriate sensor: LiDAR for industrial environments (high accuracy), camera for consumer applications (low cost)
  2. Calibrate carefully: The transform between sensor and base_link must be accurate; 1-2 cm error can cause serious drift
  3. Test recovery behaviors: Robots will get stuck — configure spin, backup, and wait recovery in the behavior tree
  4. Monitor with RViz2: Always visualize costmap and path planning when debugging

SLAM and navigation are two fundamental skills for any autonomous robot. With ROS 2 Nav2, you can deploy a complete navigation system without starting from scratch.

Tool recommendations

Camera and accessories to consider

Prioritize pipeline fit and calibration over spec-sheet numbers.

Intel RealSense D455 RGB-D camera for head perception, lightweight mapping, and dataset collection. View D455 → Luxonis OAK-D Stereo/depth camera with onboard compute, useful when the Jetson is busy with other inference work. View OAK-D → Wrist camera / USB global shutter camera A camera near the gripper improves manipulation, grasping, and teleoperation data quality. View camera →

Related Articles

  • LiDAR and 3D Mapping: Building Environmental Maps for Robots
  • Introduction to ROS 2: The Next Generation Robot Programming Framework
  • Robot Fleet Management in Smart Manufacturing
NT

Nguyễn Anh Tuấn

Robotics & AI Engineer. Building VnRobo — sharing knowledge about robot learning, VLA models, and automation.

Khám phá VnRobo

Fleet MonitoringROS 2 IntegrationAMR Solutions

Related Posts

ROS 2 từ A đến Z (P6): Nav2 — Robot tự hành
ros2tutorialamrPart 6
navigation

ROS 2 từ A đến Z (P6): Nav2 — Robot tự hành

Cấu hình Nav2 stack để robot tự lập bản đồ SLAM và di chuyển tự động — từ simulation đến thực tế (Jazzy, cập nhật 6/2026).

3/20/202611 min read
NT
Tutorial
ROS 2 Nav2: Navigation hoàn chỉnh cho AMR
ros2nav2navigationPart 2
navigation

ROS 2 Nav2: Navigation hoàn chỉnh cho AMR

Hướng dẫn toàn diện Nav2 stack -- từ map building với slam_toolbox, path planning với NavFn và Smac, đến behavior trees và launch config.

2/8/20268 min read
NT
Deep Dive
SLAM từ A đến Z: LiDAR, Visual và cách robot định vị
slamlidarnavigationPart 1
navigation

SLAM từ A đến Z: LiDAR, Visual và cách robot định vị

Tìm hiểu SLAM từ cơ bản đến nâng cao -- EKF-SLAM, particle filter, ORB-SLAM3, Cartographer, LIO-SAM và cách chọn phương pháp phù hợp.

2/4/20269 min read
NT
VnRobo logo

AI infrastructure for next-generation industrial robots.

Product

  • Features
  • Pricing
  • Knowledge Base
  • Services

Company

  • About Us
  • Blog
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2026 VnRobo. All rights reserved.

Made with♥in Vietnam