# dynamicswarms/ds-crazyflies architecture

> Architecture diagram of the GitHub repository dynamicswarms/ds-crazyflies, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dynamicswarms/ds-crazyflies
- Repository: https://github.com/dynamicswarms/ds-crazyflies

## Overview

Dynamic Swarms Crazyflies is a ROS 2 stack for operating Crazyflie nanoquadcopters through either real hardware or Webots simulation. Users select a backend through the framework launch file, then run Crazyflie or Safeflie nodes; Safeflie accepts target and flight commands and applies bounded setpoint handling. Optional tracking and position visualization support tracked operation, while rqt plugins expose vehicle status and controls and provide a UI for adding and saving vehicles. The excerpts show launch dispatch, Safeflie command handling, gateway requests, and parts of the rqt status UI; wiring not established by those excerpts is omitted.

Main entry points: [`src/crazyflies/launch/framework.launch.py`](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/launch/framework.launch.py) (Framework Launch), [`src/crazyflies/crazyflies/safeflie.py`](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/safeflie.py) (Safeflie), [`src/crazyflies/crazyflies/gateway_endpoint.py`](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/gateway_endpoint.py) (Gateway Endpoint), [`src/crazyflies/launch/safeflie.launch.py`](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/launch/safeflie.launch.py) (Safeflie Launch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Vehicle Runtime"]
  node_safeflie_launch["Safeflie Launch<br/>[safeflie.launch.py]"]
  node_crazyflie["Crazyflie<br/>[crazyflie.py]"]
  node_safeflie["Safeflie<br/>[safeflie.py]"]
  node_safe_commander["Safe Commander<br/>[safe_commander.py]"]
  node_send_target["Target Message<br/>[SendTarget.msg]"]
end

subgraph group_integration["Backend And Tracking"]
  node_framework["Framework Launch"]
  node_gateway_endpoint["Gateway Endpoint"]
  node_hardware_gateway["Hardware Gateway"]
  node_webots_gateway["Webots Gateway"]
  node_webots_sim["Webots Simulation"]
  node_motion_capture["Motion Capture"]
  node_object_tracker["Object Tracker"]
  node_position_visualization["Position Visualization"]
end

subgraph group_monitoring["Status And Control UI"]
  node_state_plugin["State Plugin<br/>[state_plugin.cpp]"]
  node_status_widget["Status Widget"]
  node_connection["Vehicle Connection"]
end

subgraph group_setup["Vehicle Setup UI"]
  node_add_widget["Add Vehicle UI<br/>[add_widget.py]"]
  node_add_api["Add API<br/>[add_api.py]"]
end

node_operator(("Operator"))
node_rqt(("rqt Operator"))

node_operator -->|"selects backend"| node_framework
node_framework -->|"launches conditionally"| node_hardware_gateway
node_framework -->|"launches conditionally"| node_webots_gateway
node_framework -->|"launches simulator"| node_webots_sim
node_framework -.->|"launches when tracked"| node_motion_capture
node_framework -.->|"launches when tracked"| node_object_tracker
node_framework -->|"launches"| node_position_visualization
node_operator -->|"configures vehicle"| node_safeflie_launch
node_safeflie_launch -->|"starts node"| node_safeflie
node_safeflie -->|"inherits vehicle behavior"| node_crazyflie
node_safeflie -->|"subscribes to"| node_send_target
node_safeflie -->|"imports"| node_safe_commander
node_rqt -->|"opens plugin"| node_state_plugin
node_state_plugin -->|"creates status frames"| node_status_widget
node_status_widget -->|"registers callbacks"| node_connection
node_rqt -->|"uses setup UI"| node_add_widget
node_add_widget -->|"calls add methods"| node_add_api
node_add_api -->|"requests vehicle changes"| node_gateway_endpoint
node_gateway_endpoint -->|"calls gateway services"| node_hardware_gateway
node_gateway_endpoint -->|"calls gateway services"| node_webots_gateway

click node_framework "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/launch/framework.launch.py"
click node_safeflie_launch "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/launch/safeflie.launch.py"
click node_crazyflie "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/crazyflie.py"
click node_safeflie "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/safeflie.py"
click node_safe_commander "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/safe/safe_commander.py"
click node_send_target "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies_interfaces/msg/SendTarget.msg"
click node_gateway_endpoint "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/gateway_endpoint.py"
click node_hardware_gateway "https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/crazyflie_hardware"
click node_webots_gateway "https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/crazyflie_webots"
click node_webots_sim "https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/crazyflie_webots"
click node_motion_capture "https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/ros-motioncapture"
click node_object_tracker "https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/ros-objecttracker"
click node_position_visualization "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/position_visualization.py"
click node_state_plugin "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies/src/state_plugin.cpp"
click node_status_widget "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies/src/crazyflie_status_widget.cpp"
click node_connection "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies/include/rqt_crazyflies/crazyflie_connection.hpp"
click node_add_widget "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies_add/rqt_crazyflies_add/add_widget.py"
click node_add_api "https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies_add/rqt_crazyflies_add/add_api.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_safeflie_launch,node_crazyflie,node_safeflie,node_safe_commander,node_send_target toneBlue
class node_framework,node_gateway_endpoint,node_hardware_gateway,node_webots_gateway,node_webots_sim,node_motion_capture,node_object_tracker,node_position_visualization toneAmber
class node_state_plugin,node_status_widget,node_connection toneMint
class node_add_widget,node_add_api toneRose
class node_operator,node_rqt toneIndigo
```

## Components

### Vehicle Runtime

- [Safeflie Launch](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/launch/safeflie.launch.py): `src/crazyflies/launch/safeflie.launch.py`
- [Crazyflie](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/crazyflie.py): `src/crazyflies/crazyflies/crazyflie.py`
- [Safeflie](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/safeflie.py): `src/crazyflies/crazyflies/safeflie.py`
- [Safe Commander](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/safe/safe_commander.py): `src/crazyflies/crazyflies/safe/safe_commander.py`
- [Target Message](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies_interfaces/msg/SendTarget.msg): `src/crazyflies_interfaces/msg/SendTarget.msg`

### Backend And Tracking

- [Framework Launch](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/launch/framework.launch.py): `src/crazyflies/launch/framework.launch.py`
- [Gateway Endpoint](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/gateway_endpoint.py): `src/crazyflies/crazyflies/gateway_endpoint.py`
- [Hardware Gateway](https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/crazyflie_hardware): `src/dependencies/crazyflie_hardware`
- [Webots Gateway](https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/crazyflie_webots): `src/dependencies/crazyflie_webots`
- [Webots Simulation](https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/crazyflie_webots): `src/dependencies/crazyflie_webots`
- [Motion Capture](https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/ros-motioncapture): `src/dependencies/ros-motioncapture`
- [Object Tracker](https://github.com/dynamicswarms/ds-crazyflies/tree/master/src/dependencies/ros-objecttracker): `src/dependencies/ros-objecttracker`
- [Position Visualization](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/crazyflies/crazyflies/position_visualization.py): `src/crazyflies/crazyflies/position_visualization.py`

### Status And Control UI

- [State Plugin](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies/src/state_plugin.cpp): `src/rqt_crazyflies/src/state_plugin.cpp`
- [Status Widget](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies/src/crazyflie_status_widget.cpp): `src/rqt_crazyflies/src/crazyflie_status_widget.cpp`
- [Vehicle Connection](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies/include/rqt_crazyflies/crazyflie_connection.hpp): `src/rqt_crazyflies/include/rqt_crazyflies/crazyflie_connection.hpp`

### Vehicle Setup UI

- [Add Vehicle UI](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies_add/rqt_crazyflies_add/add_widget.py): `src/rqt_crazyflies_add/rqt_crazyflies_add/add_widget.py`
- [Add API](https://github.com/dynamicswarms/ds-crazyflies/blob/master/src/rqt_crazyflies_add/rqt_crazyflies_add/add_api.py): `src/rqt_crazyflies_add/rqt_crazyflies_add/add_api.py`

### Other components

- **Operator**
- **rqt Operator**

## Connections

- Operator → Framework Launch: selects backend
- Framework Launch → Hardware Gateway: launches conditionally
- Framework Launch → Webots Gateway: launches conditionally
- Framework Launch → Webots Simulation: launches simulator
- Framework Launch → Motion Capture: launches when tracked
- Framework Launch → Object Tracker: launches when tracked
- Framework Launch → Position Visualization: launches
- Operator → Safeflie Launch: configures vehicle
- Safeflie Launch → Safeflie: starts node
- Safeflie → Crazyflie: inherits vehicle behavior
- Safeflie → Target Message: subscribes to
- Safeflie → Safe Commander: imports
- rqt Operator → State Plugin: opens plugin
- State Plugin → Status Widget: creates status frames
- Status Widget → Vehicle Connection: registers callbacks
- rqt Operator → Add Vehicle UI: uses setup UI
- Add Vehicle UI → Add API: calls add methods
- Add API → Gateway Endpoint: requests vehicle changes
- Gateway Endpoint → Hardware Gateway: calls gateway services
- Gateway Endpoint → Webots Gateway: calls gateway services
