← 开源

Demo ROS2 workspace for using nav2 with semantic segmentation on Gazebo

AI EngineeringMake agent see hear talkPython
增长势头
+024 小时新增 Star0.0%
53
Star
2
Fork
+0
本周
1
贡献者
创建于 2026-01-23 · 更新于 2026-12-01 · 今日第 28388 名
主要开发者
pepisg
README

Nav2 Semantic Segmentation Demo

Demo repository showcasing ROS2 navigation with semantic segmentation-based costmap layers.

Overview

This demo shows autonomous navigation using semantic segmentation to identify traversable surfaces. A TurtleBot 4 robot navigates through a simulated environment (Baylands world) using Nav2, with a custom costmap layer that assigns navigation costs based on terrain classification (sidewalk, grass, background).

Key Components

  • Semantic Segmentation Layer: Custom Nav2 costmap plugin that integrates semantic segmentation into path planning
  • Semantic Segmentation Node: ROS2 node for real-time ONNX-based inference. A simple model that works on gazebo sidewalks is also provided.
  • Semantic Segmentation Sim: Gazebo simulation environment with TurtleBot 4 on the baylands outdoors world.

For training custom models, you can use the Simple Segmentation Toolkit to easily prototype segmentation models with SAM-based auto-labeling (no manual annotation required).

Quick Start

Prerequisites

  • Docker with GPU support (NVIDIA)
  • VSCode with Dev Containers extension

Running the Simulation

  1. Open in Dev Container:

    # Clone the repository
    git clone <repository-url>
    cd <repository-name>
    
    # Open in VSCode
    code .
    
    # VSCode will prompt to reopen in container - accept it
  2. Build the workspace (first time only):

    cd rover/ros2
    colcon build --symlink-install
    source install/setup.bash
  3. Launch the complete simulation:

    ros2 launch semantic_segmentation_sim segmentation_simulation_launch.py

    This will start:

    • Gazebo simulation with TurtleBot 4 in Baylands world
    • Nav2 navigation stack with semantic segmentation costmap
    • Semantic segmentation inference node
    • RViz for visualization

Launch Arguments

You can customize the launch with arguments:

# Launch without Gazebo GUI (headless)
ros2 launch semantic_segmentation_sim segmentation_simulation_launch.py use_sim_gui:=false

# Launch without RViz
ros2 launch semantic_segmentation_sim segmentation_simulation_launch.py use_rviz:=false

# Launch fully headless (no GUI at all)
ros2 launch semantic_segmentation_sim segmentation_simulation_launch.py use_sim_gui:=false use_rviz:=false

Sending Navigation Goals

Once the simulation is running, you can send navigation goals via RViz:

  1. Click the "2D Goal Pose" button in RViz
  2. Click and drag on the map to set a goal position and orientation
  3. The robot will plan a path that prefers sidewalks and avoids grass

Documentation

Refer to each package's README for detailed documentation and configuration options.

Terrain Classification

The system classifies terrain into three categories:

  • Sidewalk (traversable): Cost = 0 (preferred)
  • Background (intermediate): Cost = 127 (acceptable fallback)
  • Grass (danger): Cost = 254 (avoided)

The robot's path planner will try to stay on sidewalks, but can traverse background areas if necessary to reach the goal.

License

See individual package licenses for details.

Acknowledgments

排名相邻
同类项目

AI Rank iPhone 版

随时追踪 AI 模型榜单

在 App Store 下载