Skip to content

saiga006/Multi-Robot-Sim-Formation-Control

Repository files navigation

Multi-Robot-Sim-Formation-Control

A PyBullet-based simulation environment for Robile platform with multi-robot formation using PID based controller.

Output

multi-robot-sim.mp4

https://github.com/user-attachments/assets/effdfa27-35e3-4c4b-8e42-0b26bda19312 Ci_cd_multi_robot

Overview

It provides a complete simulation framework for Robile robotic platforms using the PyBullet physics engine with unit testcases and Github CI/CD setup. This package allows for the simulation of individual Robile robots as well as multiple robots in formation configurations such as a leader - follower pattern (V-formation).

The package is designed to be used within a ROS 2 workspace and serves as a lightweight alternative to Gazebo for testing multi robot control algorithms.

Features

  • Single Robot Simulation: Control and simulate individual Robile robots in a PyBullet environment
  • Multi-Robot Formation Control: Simulate leader-follower formations with multiple Robile robots
  • Omnidirectional Movement: Control robots with omnidirectional motion capabilities
  • Realistic Physics: Integration with PyBullet's physics engine for realistic simulation
  • ROS 2 Integration: Designed to work within a ROS 2 ecosystem

My Contributions (Sai Mukkundan Ramamoorthy)

As detailed in the repository's commit history, I was responsible for architecting the core physics, kinematics, and multi-robot control algorithms:

  • Multi-Robot Formation Control: Designed and implemented the multi-robot simulation logic, including the MultiRobileController and SimpleDistanceController. Developed the proportional (PID) control algorithms to maintain strict leader-follower configurations (e.g., V-formations).
  • Kinematics & Movement: Engineered the differential drive movement logic to process commanded velocities ($v_x$, $v_y$, $\omega$).
  • Physics & Environment Configuration: Configured PyBullet physics parameters to bridge the sim-to-real gap, including gravity modeling and realistic friction constraints for the robot chassis and wheels.
  • Dynamic Spawning: Built the architecture allowing for the dynamic spawning of multiple individual robot entities within the simulated space.

🤝 Team Context & Acknowledgments

This framework was built as a joint academic effort. While I focused on the physics, multi-robot coordination, and PID control architecture, CI/CD setup for multi robot usecase my co-contributor (Sunesh Praveen Raja Sundarasami) implemented the ROS 2 layers, including the odometry transforms, laser scan data publishing, command velocity subscribers & unit test cases and other co-contributor (Linta Maria Joy) for initial CI/CD setup for single robot usecase . Please refer to the commit history for full individual attribution.

Installation

Prerequisites

  • ROS 2 (tested on Humble)
  • Python 3.6+
  • PyBullet

Setup

  1. Clone this repository into your ROS 2 workspace:

    cd ~/ros2_ws/src
    git clone git@github.com:saiga006/Multi-Robot-Sim-Formation-Control.git
  2. Install the required dependencies:

    pip install pybullet numpy
  3. Build the package:

    cd ~/ros2_ws
    colcon build --packages-select robile_pybullet
  4. Source the workspace:

    source ~/ros2_ws/install/setup.bash

Usage

Single Robot Simulation

To run a basic simulation with a single Robile robot:

ros2 run robile_pybullet robile_sim

Multi-Robot Formation Control

To run a simulation with multiple Robile robots in a formation:

python3 ~/ros2_ws/src/robile_pybullet/robile_pybullet/multi_robot_sim.py

This will start a simulation with one leader robot and four follower robots in a V-formation.

Key Components

MultiRobileController

The MultiRobileController class handles the coordination of multiple Robile robots in formation. It provides methods for:

  • Initializing robots in formation
  • Controlling robot movement
  • Maintaining formation using PID control
  • Computing appropriate steering angles and wheel velocities

SimpleDistanceController

The SimpleDistanceController implements a PID controller for maintaining positions in formation.

Formation Configuration

Formations are defined as relative positions to a leader robot. For example, a V-formation is configured as:

formation_config = [
    (-1.0, -1.0),  # First follower position
    (-1.0, 1.0),   # Second follower position
    (-2.0, -2.0),  # Third follower position
    (-2.0, 2.0),   # Fourth follower position 
]

Robot Control

Omnidirectional Movement

The robots can be controlled with three parameters:

  • vx: Velocity in the x-direction (forward/backward)
  • vy: Velocity in the y-direction (left/right)
  • omega: Angular velocity for rotation

Example:

controller.move_omnidirectional(0.5, 0, 0, robot_id)  # Move forward
controller.move_omnidirectional(0, 0.5, 0, robot_id)  # Move sideways
controller.move_omnidirectional(0, 0, 0.5, robot_id)  # Rotate in place

File Structure

  • multi_robot_sim.py: Implementation of multi-robot formation control
  • robile_sim.py: Single robot simulation interface
  • robot_controller.py: Base robot controller implementation
  • laser_scanner.py: Simulated laser scanner for the robots
  • test_movement.py, test_movement_2.py: Example movement test scripts
  • robile.urdf, robile3_config.urdf: URDF model files for the Robile robot

License

This package contains components with various licenses:

  • The Robile URDF models are provided under a dual-license: GNU Lesser General Public License LGPL 2.1 and BSD license
  • The included PyBullet object models are under the LGPL 2.1 license

For more details, see the license information in the respective files.

About

A project focussed on implementing Multi-Robot simulation in PyBullet. The simulation is modelled on robile platform in leader and follower pattern using PID Controller mechanism. Includes comprehensive CI/CD setup and unit test cases to evaluate the scalability of the simulation setup.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages