Install
FlightLang provides a CLI that compiles .fl
into runnable code.
# Python backend (run directly)
python -m flightlang.cli run examples/survey.fl
# Build to a standalone Python file
python -m flightlang.cli build examples/survey.fl -o out.py
python out.py
# Generate a Rust crate (Cargo project)
python -m flightlang.cli build examples/survey.fl --backend rust --outdir mission_rs
cd mission_rs && cargo run
Hello mission
mission Hello {
state Idle {
on arm -> Takeoff
}
state Takeoff {
action climb_to(20 m)
on reached_altitude -> RTL
}
state RTL {
action return_to_launch()
on landed -> Done
}
state Done { }
}
Run it with python -m flightlang.cli run hello.fl
.
Syntax
- Variables with units:
let cruise_alt: m = 60 m
- States contain actions, transitions, and optional deadlines.
- Expressions support numbers, strings, identifiers, and simple calls (e.g.,
waypoint_grid(...)
).
Actions & events
Actions map to platform behaviors; events trigger transitions:
climb_to(alt)
Optional:
@ speed
goto(waypoint_grid(...))
sidestep(dist) then resume
return_to_launch()
Events are user-defined (e.g., arm
, reached_altitude
, grid_complete
).
Backends
- Python: generates runnable Python with a tiny runtime for deterministic simulation.
- Rust: generates a Cargo project with action stubs; integrate with PX4/ROS 2 as needed.
PX4/ROS 2 integrations are provided as stubs. Do not use for real flight without proper integration and testing.
Roadmap & safety
- Static analysis for unreachable states and unsafe transitions
- Formal safety contracts (timing, geofence compliance)
- Full MAVSDK/ROS 2 integration
- LSP + editor tooling
Status: Early Alpha. Not flight-certified.