The Problem

Langostino addresses the gap between hobbyist drone builds and real autonomous flight. Most open-source drone projects are either toy simulations or proprietary flight stacks. This repo gives you a working reference implementation for an AI-controlled drone using ROS2, a flight controller, and a trained policy model — including the hardware assembly guides, custom firmware, and the software glue that makes it all talk to each other.

What This Does

Langostino is a ROS2-based autonomous drone platform. The core lives in src/swarm_ai_integration/ with Python nodes for AI inference (ai_flight_node.py), flight controller communication (fc_comms_node.py), sensor fusion (sensor_data_manager.py), and safety monitoring (safety_monitor_node.py). It speaks MSP (MultiWii Serial Protocol) to an INAV flight controller via msp_protocol.py and a serial handler in utils/msp_serial_handler.py.

The repo also includes hardware assets (3D-printable STL files), a mapproxy/ service for map tile proxying, and shell scripts for network and system setup on Ubuntu 22.04 and 24.04. There's a trained policy model in model/UID_3.zip that the AI node loads for inference.

How It Is Wired

Execution starts at main in src/swarm_ai_integration/swarm_ai_integration/ai_adapter_node.py:607, which reaches 42 functions. The flow: ai_adapter_node receives GPS, IMU, and lidar data via ROS2 subscriptions, builds observations, and publishes actions. ai_flight_node.py runs the model inference and outputs control commands. Those commands flow through fc_adapter_node.py to fc_comms_node.py, which encodes MSP messages via msp_protocol.py and sends them over serial to the flight controller.

The most-connected module is utils/__init__.py (imports 11 modules, no dependents). The critical hub is MSPMessage in msp_protocol.py, called from 8 places — changing its encoding breaks everything downstream. pack_rc_channels (6 callers) and send_message (4 callers) are the next most fragile. The call graph shows no circular dependencies, which keeps the architecture clean.

The fc_comms_node.py owns the actual hardware effect — it writes serial bytes to the flight controller. black_box_recorder_node.py writes log files to disk. ai_flight_node.py is the only file that calls the model for inference.

How To Use It

git clone https://github.com/moses-y/Langostino
cd Langostino
pip install -r requirements.txt
# For the map proxy service:
pip install -r mapproxy/requirements.txt

Configuration: ROS2 parameters live in src/swarm_ai_integration/config/swarm_params.yaml. The setup scripts (scripts/setup_22_04.sh, scripts/setup_24_04.sh) handle system dependencies. The INAV firmware is prebuilt in inav-custom-firmware/.

Running it: Launch via src/swarm_ai_integration/launch/swarm_ai_launch.py. The README points to docs/SETUP_GUIDE.md#quick-setup for the full procedure — this is the authoritative source, not the scripts alone.

Real-World Use

A typical deployment: assemble the drone per docs/assembly/, flash the custom INAV firmware, run the setup scripts on a Raspberry Pi 5, then launch the ROS2 stack. The AI node loads model/UID_3.zip, the flight controller node streams telemetry, and the drone holds position autonomously. For development, the old/ directory contains simpler MSP test scripts for arming and throttle control without the full AI stack.

Code Health & Issues

Static analysis found 23 issues: 5 high, 18 medium. High-severity findings:

  • Deep nesting (x13)emergency_landing.py, rise_controller.py, yaw_alignment.py hit max indentation depth 10. Fix with early returns and guard clauses.
  • Duplicated code blocks — 827 repeated 6-line blocks across 17 files, mostly the setup scripts. Extract shared helpers.

Medium findings include unmanaged file handles in black_box_recorder_node.py, broad exception handling in ai_flight_node.py and lidar_reader_node.py, and an oversized scripts/setup_24_04.sh (762 lines).

SDLC gaps: no CI/CD pipeline, no dependency lockfile (only requirements.txt), and no Dockerfile. Tests exist (3 files) but nothing runs them automatically. A license is present (MIT).

The Bottom Line

Langostino is a genuinely useful reference for anyone building an AI drone on ROS2 — the MSP layer and hardware docs are the strongest parts. The code quality is uneven: the core Python is well-structured, but the setup scripts are sprawling and duplicated. If you're building a drone and want a working starting point, this is worth studying. If you need production-grade reliability, you'll need to add CI and tighten the exception handling first.