How taintedy/flock_gpt works
Project Type and Purpose
• FlockGPT is a ROS‐based robotics application that integrates a Large Language Model (OpenAI) with UAV flocking control via the CrazySwarm framework and a Unity simulator.
• Purpose: Accept natural‐language commands, generate formation goals via LLM, convert goals into flocking constraints, and execute them on either real Crazyflie drones or a Unity simulator, with optional visualization in RViz.
Main System Components
a. User Interface & Language Layer
• LLM Process (scripts/gpt_sdf.py) — sends prompts to OpenAI, receives geometry descriptions (SDF definitions).
b. ROS Control & Orchestration
• APF Controller Node (scripts/apf_controller.py) — implements artificial potential field for collision avoidance and smoothing.
• Point Distributor (scripts/point_distributor.py) — allocates UAVs to target positions in the formation.
c. CrazySwarm Interface
• CF Show Node (scripts/cf_show_node.py) — wraps CrazySwarm API to take off, fly formations, land.
• CF Test Node (scripts/cf_test.py) — for standalone Crazyflie tests.
d. Simulator & Visualization
• ROS‐TCP‐Endpoint (external package) — bridges ROS topics to Unity simulator via TCP.
• Unity Simulator — renders UAV swarm in 3D using data from ROS‐TCP‐Endpoint.
e. Messaging & Config
• Custom ROS message Vector3StampedArray (msg/Vector3StampedArray.msg).
• launch files (launch/*.launch) — orchestrate startup of ROS nodes for different modes (simulator, CF, RViz).
Relationships and Data Flows
• User → LLM Process → SDF output → Swarm Controller
• Swarm Controller → APF Controller & Point Distributor → CF Show Node (or Simulator)
• CF Show Node ↔ CrazySwarm API → Real Drones
• Simulator ↔ ROS‐TCP‐Endpoint ↔ ROS Nodes
Architectural Patterns & Design Principles
• Modular ROS nodes separate concerns: language processing, formation logic, low-level control.
• Use of ROS topics/actions for loose coupling and easy extension.
• External service integration: OpenAI API for LLM, TCP‐bridge for Unity simulator.
Technologies & Libraries to Annotate
• ROS Noetic, catkin build system (CMakeLists.txt, package.xml)
• Python 3 scripts with dependencies in requirements.txt (openai, rospy, pycrazyswarm, etc.)
• CrazySwarm for hardware interface
• ROS‐TCP‐Endpoint + Unity for simulation