Flight¶
drone.flight
Copyright MIT GNU General Public License v3.0
MIT BWSI Autonomous Drone Racing Course - UAV Neo
File Name: flight.py File Description: Defines the interface of the Flight module of the drone_core library.
- class flight.Flight¶
Controls the drone’s flight via piloting commands (pitch, roll, yaw, throttle).
Note
All flight commands are sent to the mux node, which decides whether to forward them to the flight controller based on the autonomy operator’s bumper state. The safety pilot always has override authority via the RC transmitter.
- abstractmethod land() None¶
Sends descending setpoints to the mux.
Note
The safety pilot handles the actual landing mode switch on the RC transmitter. This function only sets a downward velocity command.
Example:
uav.flight.land()
- abstractmethod send_pcmd(pitch: float, roll: float, yaw: float, throttle: float) None¶
Sends a piloting command to the drone.
- Parameters:
pitch – Forward/backward tilt from -1.0 (backward) to 1.0 (forward).
roll – Left/right tilt from -1.0 (left) to 1.0 (right).
yaw – Rotation from -1.0 (counter-clockwise) to 1.0 (clockwise).
throttle – Vertical speed from -1.0 (descend) to 1.0 (ascend).
Note
All arguments are unitless ratios clamped to [-1.0, 1.0]. The actual speed scaling is controlled by the mux node configuration, not by the student code.
Example:
# Fly forward at half input uav.flight.send_pcmd(0.5, 0, 0, 0) # Ascend while yawing right uav.flight.send_pcmd(0, 0, 0.3, 0.5)
- stop() None¶
Zeros all flight inputs, bringing the drone to a hover.
Note
Equivalent to uav.flight.send_pcmd(0, 0, 0, 0).
Example:
if counter > 5: uav.flight.stop()
- abstractmethod takeoff() None¶
Sends ascending setpoints to the mux.
Note
The safety pilot must arm the motors and switch to OFFBOARD mode on the RC transmitter before the drone will actually lift off. This function only sets the velocity command — it does not arm or change flight modes.
Example:
uav.flight.takeoff()