Skip to content

Arena-Rosnav/rosnav-rl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

706 Commits
 
 
 
 
 
 

Repository files navigation

RosNav-RL: Deep Reinforcement Learning for Robot Navigation

Rosnav-RL Logo

License: MIT ROS Humble Python 3.8+ PyTorch Documentation

Stable-Baselines3 DreamerV3

A highly-modular, flexible, and unified interface for developing deep reinforcement learning agents for autonomous robot navigation in ROS.


📖 About The Project

Rosnav-RL is a developer-centric framework for creating and training state-of-the-art navigation agents with deep reinforcement learning in ROS 2. It's built to accelerate your research by providing a flexible, modular, and powerful toolkit that gets out of your way.

ROS 2 only. All ROS 1 / rospy / rospkg dependencies have been removed. The package targets ROS 2 Humble exclusively.

Forget being locked into a single RL library. Rosnav-RL's core strength is its plug-and-play architecture. Swap backends like Stable-Baselines3 and DreamerV3 with ease, and focus on what matters: designing, training, and deploying better navigation agents, faster.

✨ Key Features

  • Experiment with Multiple RL Frameworks: Don't get locked in. Our framework-agnostic design lets you leverage the best of different libraries like Stable-Baselines3 and DreamerV3 in the same project.
  • Build Custom Agents in Minutes: A deeply modular architecture with plug-and-play components for rewards, observations, and network layers means you can prototype new agent designs rapidly.
  • Standardize Your Experiments: Tame the complexity of multiple robot setups and tasks with a unified system for managing observation and action spaces.
  • Configure with Confidence: Pydantic-based configuration provides type-safety, auto-validation, and self-documenting schemas, eliminating frustrating runtime errors.
  • Deploy Seamlessly in ROS 2: Move from training to deployment effortlessly. A built-in ROS action server ensures your agent integrates perfectly into your robotics ecosystem.

📦 Packages

This repository contains the following packages:

Package Description
rosnav_rl The core package containing the reinforcement learning framework, agent definitions, and training pipelines.
rosnav_rl_msgs Contains the ROS message and service definitions used by rosnav_rl for communication.

For a deep dive into the architecture and development workflow, please refer to the RosNav-RL Developer Guide.


🚀 Getting Started

Prerequisites

  • ROS 2 Humble installation
  • Python 3.8+
  • Poetry

🛠️ Installation

  1. Clone the repository into your colcon workspace's src directory:

    cd /path/to/your/colcon_ws/src
    git clone https://github.com/Arena-Rosnav/rosnav-rl.git
  2. Install dependencies using Poetry:

    Navigate to the rosnav_rl package directory and run poetry install. This will install the necessary Python packages in a virtual environment.

    cd rosnav-rl/rosnav_rl
    poetry install
  3. Build your workspace:

    Navigate back to the root of your workspace and build the packages.

    cd /path/to/your/colcon_ws
    colcon build --packages-select rosnav_rl rosnav_rl_msgs
  4. Source the workspace:

    source install/setup.bash

🧪 Testing

A pytest suite covering path resolution, model loading, and the get_command service is included:

cd rosnav_rl   # package root
python3 -m pytest tests/ -v

To create a minimal test agent (random weights, no training required):

python3 scripts/create_test_agent.py --agent-name test_agent

This writes training_config.yaml and best_model.zip to Arena/arena_training/agents/test_agent/.


🖥️ Usage

Standalone — start the action server with a trained agent:

ros2 run rosnav_rl action_server.py --ros-args -p agent_name:=<your_agent>

Or via the provided launch file:

ros2 launch rosnav_rl action_server.launch.py agent_name:=<your_agent>

The server exposes a get_command service (rosnav_rl_msgs/srv/GetCommand) under the robot's namespace. It reads sensor data from its configured ROS 2 topics and returns a geometry_msgs/Twist. On inference errors it logs a warning and returns zero velocity instead of crashing.

# Call the service manually
ros2 service call /get_command rosnav_rl_msgs/srv/GetCommand {}

Arena integration — when using Arena-Rosnav, the action server is started automatically:

arena launch local_planner:=rosnav_rl agent_name:=<your_agent>

Agent folders live in Arena/arena_training/agents/<agent_name>/ and must contain training_config.yaml + best_model.zip.


📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

RosNav-RL is a modular DRL framework for ROS 2 with a pluggable architecture, allowing you to switch between RL backends like Stable-Baselines3 and DreamerV3 to accelerate research and deployment.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages