# DroneController Guide ## 3-Phase Mission ``` SEARCH ──► COMMAND ──► LAND ──► COMPLETE ``` | Phase | Action | |-------|--------| | SEARCH | Find QR code on rover | | COMMAND | Send commands to rover | | LAND | Land on rover | ## Your Code Edit `src/drone_controller.py`: ### Search Phase ```python def calculate_search_maneuver(self, telemetry): return (thrust, pitch, roll, yaw) def detect_qr_code(self): return {'data': 'qr_content', 'position': {...}} or None ``` ### Command Phase ```python def generate_rover_command(self, qr_data): return {'type': 'move', 'x': 0, 'y': 0} ``` ### Land Phase ```python def calculate_landing_maneuver(self, telemetry, rover_telemetry): return (thrust, pitch, roll, yaw) ``` ## Telemetry ```python telemetry = { "altimeter": {"altitude": 5.0, "vertical_velocity": -0.1}, "velocity": {"x": 0, "y": 0, "z": 0}, "imu": {"orientation": {"roll": 0, "pitch": 0, "yaw": 0}}, "landing_pad": {"relative_x": 0.5, "relative_y": -0.2, "distance": 5.0} } ``` ## Control Output | Value | Range | Effect | |-------|-------|--------| | thrust | ±1.0 | Vertical velocity | | pitch | ±0.5 | Forward/back | | roll | ±0.5 | Left/right | | yaw | ±0.5 | Rotation | ## Configuration Edit `config.py`: ```python CONTROLLER = { "Kp_z": 0.5, "Kd_z": 0.3, "Kp_xy": 0.3, "Kd_xy": 0.2, "rate": 50, } ``` ## Testing ```bash ./scripts/run_ardupilot_sim.sh runway ./scripts/run_ardupilot_controller.sh ```