2.0 KiB
2.0 KiB
DroneController Guide
Implement your GPS-denied landing algorithm.
Quick Start
- Edit
drone_controller.py - Find
calculate_landing_maneuver() - Implement your algorithm
- Test:
python standalone_simulation.py
Function to Implement
def calculate_landing_maneuver(self, telemetry, rover_telemetry):
return (thrust, pitch, roll, yaw)
Sensors (GPS-Denied)
# Altitude
altitude = telemetry['altimeter']['altitude']
vertical_vel = telemetry['altimeter']['vertical_velocity']
# Velocity
vel_x = telemetry['velocity']['x']
vel_y = telemetry['velocity']['y']
# Landing Pad (may be None!)
landing_pad = telemetry.get('landing_pad')
if landing_pad:
relative_x = landing_pad['relative_x']
relative_y = landing_pad['relative_y']
Control Output
| Value | Range | Effect |
|---|---|---|
| thrust | ±1.0 | Up/down |
| pitch | ±0.5 | Forward/back |
| roll | ±0.5 | Left/right |
| yaw | ±0.5 | Rotation |
Example Algorithm
def calculate_landing_maneuver(self, telemetry, rover_telemetry):
alt = telemetry.get('altimeter', {})
altitude = alt.get('altitude', 5.0)
vert_vel = alt.get('vertical_velocity', 0.0)
vel = telemetry.get('velocity', {})
vel_x = vel.get('x', 0.0)
vel_y = vel.get('y', 0.0)
pad = telemetry.get('landing_pad')
# Altitude PD control
thrust = 0.5 * (0 - altitude) - 0.3 * vert_vel
# Horizontal control
if pad:
pitch = 0.3 * pad['relative_x'] - 0.2 * vel_x
roll = 0.3 * pad['relative_y'] - 0.2 * vel_y
else:
pitch = -0.2 * vel_x
roll = -0.2 * vel_y
return (thrust, pitch, roll, 0.0)
Testing
# Easy
python standalone_simulation.py --pattern stationary
# Medium
python standalone_simulation.py --pattern circular --speed 0.3
# Hard
python standalone_simulation.py --pattern random --speed 0.5
Configuration
Edit config.py:
CONTROLLER = {
"Kp_z": 0.5,
"Kd_z": 0.3,
"Kp_xy": 0.3,
"Kd_xy": 0.2,
}