A highly-modular, flexible, and unified interface for developing deep reinforcement learning agents for autonomous robot navigation in ROS.
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/rospkgdependencies 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.
- 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.
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.
- ROS 2 Humble installation
- Python 3.8+
- Poetry
-
Clone the repository into your colcon workspace's
srcdirectory:cd /path/to/your/colcon_ws/src git clone https://github.com/Arena-Rosnav/rosnav-rl.git -
Install dependencies using Poetry:
Navigate to the
rosnav_rlpackage directory and runpoetry install. This will install the necessary Python packages in a virtual environment.cd rosnav-rl/rosnav_rl poetry install -
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 -
Source the workspace:
source install/setup.bash
A pytest suite covering path resolution, model loading, and the get_command service is included:
cd rosnav_rl # package root
python3 -m pytest tests/ -vTo create a minimal test agent (random weights, no training required):
python3 scripts/create_test_agent.py --agent-name test_agentThis writes training_config.yaml and best_model.zip to Arena/arena_training/agents/test_agent/.
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.
This project is licensed under the MIT License - see the LICENSE file for details.