This project implements swarm management using Reinforcement Learning, specifically the TD3 (Twin Delayed Deep Deterministic Policy Gradient) algorithm. It demonstrates the use of deep reinforcement learning techniques to control a swarm of robots in a simulated environment. Using ROS 2 and Gazebo, the project simulates multiple agents (three in this case) navigating to a goal position while avoiding obstacles.
- ROS 2 Humble
- Gazebo Classic 11.10.2
- Python 3.10.12
- PyTorch 2.3.1
- NumPy 1.21.5
- Matplotlib 3.5.1
- TensorBoard
-
Install ROS 2 Humble following the official instructions.
-
Install Colcon following the official instructions.
-
Install Gazebo packages:
sudo apt install ros-humble-gazebo-ros-pkgs
- Install Xacro:
sudo apt install ros-humble-xacro
- Create a ROS 2 workspace:
mkdir -p ~/ros2_ws/
cd ~/ros2_ws/
- Clone this repository:
git clone https://github.com/kgndnc/ros-gazebo-deep-rl.git
- Rename the folder
mv ros-gazebo-deep-rl/ src/
- Build the ROS 2 packages:
cd ~/ros2_ws
colcon build
Source the ROS 2 setup files:
source /opt/ros/humble/setup.bash
source ~/ros2_ws/install/setup.bash
- Launch the Gazebo simulation:
ros2 launch my_robot_bringup test_my_robot_gazebo.launch.xml
- In a new terminal, run the test script:
cd ~/ros2_ws/src/my_robot_controller/my_robot_controller/td3/
python3 test.py
- Launch the Gazebo simulation:
ros2 launch my_robot_bringup my_robot_gazebo.launch.xml
- In a new terminal, run the training script:
cd ~/ros2_ws/src/my_robot_controller/my_robot_controller/td3/
python3 train.py
-
my_robot_controller/
: ROS 2 package containing nodes and Python scripts that implement RL algorithms -
my_robot_bringup/
: ROS 2 package containing launch files and world descriptionslaunch/
: Launch files for starting the Gazebo simulationworlds/
: Gazebo world files in SDF format
-
my_robot_description/
: ROS 2 package for robot model descriptionsurdf/
: Robot model files in URDF format
This project is licensed under the MIT License - see the LICENSE file for details.