swarm (Swarm)¶
The swarm module provides cluster control interfaces, including multi-vehicle formation control, distributed simulation, Crazyflie adaptation, MAVLink Shell, ADB communication, and other functionalities, supporting collaborative control and simulation of large-scale drone clusters.
Module Features¶
| Feature | Description |
|---|---|
| Multi-vehicle State Management | Acquisition and synchronization of pose and status for vehicles within the cluster |
| Formation Control | Sending formation control commands to multiple vehicles |
| Distributed Simulation | Support for distributed cluster simulation across multiple computers |
| Crazyflie Support | Adaptation interface for Bitcraze Crazyflie micro drones |
| MAVLink Shell | Remote access to flight controller command-line shell |
| ADB Communication | Android Debug Bridge device management |
Core Classes and Interfaces¶
| Class/Interface | Description |
|---|---|
VehicleApi |
Single-vehicle cluster configuration management, supporting unified control interface |
DistSim |
Distributed simulation management, supporting cross-computer clusters |
Crazyflie |
Adaptation interface for Crazyflie drones |
CrazySwarm |
Crazyflie cluster management |
RflyShell |
Remote shell command execution |
AdbLib |
ADB device management library |
RJ45PX6X |
Network interface management |
Usage Scenarios¶
Cluster Formation¶
- Formation flight control for multiple drones
- Formation transformation and reconfiguration control
- Cluster obstacle avoidance and path planning
Distributed Simulation¶
- Distributed computing for large-scale clusters
- Cross-regional multi-vehicle collaborative simulation
- Load balancing of computational resources
Micro Drones¶
- Indoor cluster experiments with Crazyflie
- Formation control for micro drones
- Low-cost platform for education and research
Real-World Deployment¶
- Cluster control of real drones
- Switching between remote control and autonomous control
- Cluster task allocation and coordination
Cluster Control Example¶
from RflySimSDK.swarm import VehicleApi
# Create a cluster management instance
swarm = VehicleApi()
# Initialize 5 drones
for i in range(1, 6):
swarm.addVehicle(i)
# Connect all drones
swarm.connectAll()
# Take off collectively to an altitude of 5 meters
swarm.takeoffAll(5)
# Execute formation flight (triangular formation)
swarm.formationTriangle(side_length=3)
# Hover for 10 seconds
import time
time.sleep(10)
# Land collectively
swarm.landAll()
Related Resources¶
Note: This document serves as the index page for the swarm module. Detailed API descriptions for each interface can be found in their respective standalone documentation pages.