Skip to content

A modular simulation framework for controlling multiple drones in a PX4-based environment. It features ROS 2 integration, G-code trajectory planning, multi-agent communication, and a Dockerized setup for easy deployment and visualization.

License

Notifications You must be signed in to change notification settings

AntonSHBK/px4_multi_drone_sim

Repository files navigation

PX4 Multi-Drone Simulation Project

This project is designed to simulate and control multiple drones in a PX4-based simulation environment. The system allows for the integration of various drone types, trajectory planning using G-codes, and interaction via ROS 2 for advanced multi-agent robotics systems.

This work is part of my dissertation research. In the future, detailed textual descriptions of the proposed approaches and algorithms will be added, along with additional features and extended capabilities to enhance the system's functionality.

Project Logo

---

PX4 Multi-Drone Control Demonstration


Three Drones in Gazebo

Three Drones from Above


Documentation

For more details on system architecture, components, and usage, refer to the Main Documentation.


Overview

This project provides a modular and extensible framework for simulating drones in a PX4-based environment. Key components include:

  • Drone controllers for managing the logic and behavior of drones.
  • G-code implementation for defining drone trajectories and actions.
  • Dockerized environment for consistent setup and deployment.
  • Multi-drone message protocols for inter-drone communication and state management.

Project Status

This project is currently under active development.
New features, improvements, and bug fixes are being added regularly. Contributions and feedback are welcome to help refine and expand the system further.


Features

  • G-Code System:
    • Supports commands like linear motion, circular interpolation, takeoff, landing, etc.
    • Easily extendable for custom drone actions.
  • Multi-Drone Simulation:
    • Simulate and control multiple drones simultaneously.
    • Real-time state monitoring and command execution.
  • ROS2 Integration:
    • Full compatibility with ROS2 for node-based drone control.
    • Custom message types for inter-drone communication.
  • Docker Support:
    • Simplifies setup and deployment of the simulation environment.
  • Extensible Controllers:
    • Base classes for creating custom drone types (e.g., X500, R1 Rover).

Getting Started

Fast Run

  1. Clone the repository:
    git clone https://github.com/AntonSHBK/px4_multi_drone_sim.git
    cd px4_multi_drone_sim
  2. Build the Docker container:
    docker-compose up --build
  3. Launch the simulation (inside container workspace /workplace/src):
    colcon build --packages-select px4_msgs
    colcon build --packages-select multi_drone multi_drone_msg
    ros2 launch multi_drone test_run.launch.py

Example G Commands

1. G20: Move to Point

ros2 topic pub --once /id_1_x500/in/command_json std_msgs/msg/String "{data: '{
    \"name\": \"G20\",
    \"counter\": 1,
    \"x\": 10.0,
    \"y\": 5.0,
    \"z\": -10.0,
    \"yaw\": 1.57,
    \"velocity\": 2.0,
    \"coordinate_system\": \"global_ENU\"
}'}"

2. G21: Linear Move

ros2 topic pub --once /id_1_x500/in/command_json std_msgs/msg/String "{data: '{
    \"name\": \"G21\",
    \"counter\": 2,
    \"start_point\": [0.0, 0.0, 0.0],
    \"end_point\": [5.0, 10.0, -10.0],
    \"velocity\": 1.5,
    \"yaw\": 1.57,
    \"coordinate_system\": \"global_ENU\"
}'}"

See the documentation. documentation for other commands.

Use these commands to control the drones and implement complex trajectories. Modify parameters as needed for your specific requirements.

Dependencies

Required:

  1. ROS 2 Humble (on Ubuntu 22.04)
    Install via official guide.

  2. PX4 v1.14
    Clone and checkout:

    git clone https://github.com/PX4/PX4-Autopilot.git
    cd ./PX4-Autopilot
    git checkout v1.14.4
    git submodule sync --recursive
    git submodule update --init --recursive
  3. px4_msgs v1.14

     git clone https://github.com/PX4/px4_msgs.git
     cd px4_msgs
     git checkout release/1.14
  4. Docker
    Install via Docker guide.

  5. Python Libraries

    pip install scipy numpy

Optional:

  1. Terminal Emulator:
    gnome-terminal, xterm, or konsole for PX4 SITL.

  2. X Server for Docker Visualization:
    Use XLaunch (Windows), XQuartz (macOS), or xhost on Linux for GUI support in Docker.
    Enable X11 forwarding:

    xhost +local:docker

Usage

Fast Commands

Refer to fast_commands.md for a list of quick commands and their descriptions.


Contributing

We welcome contributions! Feel free to open issues or submit pull requests.


Citation

@misc{px4_multi_drone_sim,
  author       = {Anton Pisarenko},
  title        = {PX4 Multi-Drone Simulation Project},
  year         = {2024},
  month        = {December},
  howpublished = {\url{https://github.com/AntonSHBK/px4_multi_drone_sim}},
  note         = {Accessed: 2024-12-24}
}

Contacts

For questions or support, please contact:

About

A modular simulation framework for controlling multiple drones in a PX4-based environment. It features ROS 2 integration, G-code trajectory planning, multi-agent communication, and a Dockerized setup for easy deployment and visualization.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published