Skip to content

A simulation platform for Autonomous Surface Vessels (ASV) that navigate safely to goal positions while avoiding dynamic and static obstacles in maritime environments

Notifications You must be signed in to change notification settings

factwy/unity-asv-navigation-rl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚢 Autonomous Surface Vehicle Navigation System

Unity ML-Agents

한국어 | English


📖 Overview

A simulation platform for Autonomous Surface Vessels (ASV) that navigate safely to goal positions while avoiding dynamic and static obstacles in maritime environments


✨ Key Features

🤖 Navigation Algorithms

  • A* Pathfinding: Grid-based optimal path calculation
  • Reinforcement Learning (PPO): Real-time obstacle avoidance with 360° sensors
  • RRT* (Reference): Sampling-based path planning (scripts only)

🌊 Simulation Environment

  • Realistic maritime environment using Crest Ocean System
  • Configurable static (08) and dynamic (04) obstacles
  • 6-DOF boat physics simulation

🚀 Quick Start

Prerequisites

  • Unity: 2021.3 LTS or higher
  • Python: 3.8+ (for ML-Agents training)
  • ML-Agents Toolkit: 2.0+

Installation

  1. Clone repository
git clone https://github.com/your-username/unity-asv-navigation-rl.git
cd unity-asv-navigation-rl
  1. Install ML-Agents (for RL training)
pip install mlagents==0.30.0
  1. Open project in Unity

    • Launch Unity Hub
    • Click "Open" and select the cloned project folder
    • Wait for Unity to import all assets
  2. Verify package dependencies

    • The project will automatically import required packages via Package Manager
    • Check dependencies in Packages/manifest.json

🎮 Usage

Method 1: Run in Unity Scenes

A* Algorithm

  1. Open Assets/Scenes/Train-AStar.unity
  2. Click Play button in Unity Editor
  3. The boat will automatically navigate using A* pathfinding
  4. Results are logged to the console

Reinforcement Learning

  1. Open Assets/Scenes/Train-RL.unity
  2. Ensure a trained model is loaded in the BoatAgent_RL component
  3. Click Play button
  4. The boat will navigate using the trained RL policy

Method 2: Use Training Area Prefabs

  1. Create a new scene or open an existing scene
  2. Drag the desired prefab from Assets/Prefabs/:
    • TrainArea-AStar.prefab - A* navigation setup
    • TrainArea_RL.prefab - RL agent setup
  3. Configure parameters in the Inspector
  4. Press Play to start the simulation

Train New RL Model

  1. Configure training parameters

    • Edit config/boat_rl_curriculum.yaml (for curriculum learning)
  2. Start training

mlagents-learn config/boat_rl_curriculum.yaml --run-id=ASV_Navigation_v1
  1. Monitor training progress

    • Open TensorBoard: tensorboard --logdir results/
    • View learning curves, rewards, and episode statistics
  2. Export trained model

    • Model will be saved in results/ASV_Navigation_v1/
    • Copy .onnx file to Assets/ML-Agents/ for inference

📁 Project Structure

autonomous-usv-navigation/
├── Assets/
│   ├── Scenes/                      # Unity scenes
│   │   ├── Train-AStar.unity        # A* navigation scene
│   │   └── Train-RL.unity           # RL training/test scene
│   │
│   ├── Scripts/                     # C# source code
│   │   ├── BoatProbesBase.cs       # Boat physics base class
│   │   ├── BoatProbes_AStar.cs     # A* boat controller
│   │   ├── BoatProbes_RL.cs        # RL boat controller
│   │   ├── BoatProbesAI.cs         # AI boat controller
│   │   ├── BoatAgent.cs            # Basic ML-Agents agent
│   │   ├── BoatAgent_RL.cs         # Advanced RL agent
│   │   ├── BoatAIController_AStar.cs  # A* pathfinding logic
│   │   ├── BoatAIController_RRT.cs    # RRT* pathfinding logic
│   │   ├── BoatAIAdapter.cs        # AI adapter interface
│   │   ├── BoatMovementEnhancer.cs # Boat movement enhancement utility
│   │   ├── ObstacleController.cs   # Obstacle control script
│   │   ├── MoveComponent.cs        # Movement component
│   │   ├── PlaytimeLogger.cs       # Runtime logging utility
│   │   └── DataScript/             # Data collection utilities
│   │       ├── AStar/              # A* experiment data
│   │       │   └── Experimentmanager.cs  # Experiment manager
│   │       └── Testmanager.cs      # Test manager
│   │
│   ├── Prefabs/                     # Reusable game objects
│   │   ├── TrainArea-AStar.prefab
│   │   ├── TrainArea_RL.prefab
│   │   └── [Obstacle prefabs]
│   │
│   ├── Materials/                   # 3D materials
│   ├── Models/                      # 3D models
│   └── ML-Agents/                   # Trained ML models
│
├── config/                          # ML-Agents configs
│   ├── boat_rl_curriculum.yaml      # Curriculum learning config
│   └── boat_rl_test.yaml            # Test config
│
├── Packages/                        # Unity packages (auto-managed)
├── ProjectSettings/                 # Unity project settings
│
├── README.md                        # English README (this file)
└── README_KR.md                     # Korean README

🛠️ Unity Packages

Unity Packages

👥 Authors


📚 References


Built with ❤️ for maritime autonomous research

About

A simulation platform for Autonomous Surface Vessels (ASV) that navigate safely to goal positions while avoiding dynamic and static obstacles in maritime environments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published