From 32a9713e366bb21822826dad4dc434856e78dbbc Mon Sep 17 00:00:00 2001 From: nicoboy Date: Mon, 1 Jun 2026 13:08:31 +0200 Subject: [PATCH] Fix takeoff en vol : changer l'altitude au lieu de bloquer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quand Gemini mappe "monte à Xm" sur takeoff et que le drone est déjà en vol, on recalcule l'altitude absolue MSL et on utilise goto_location pour atteindre la nouvelle altitude à position fixe. Co-Authored-By: Claude Sonnet 4.6 --- wireclaw_core.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wireclaw_core.py b/wireclaw_core.py index 20f9c7e..dd88f22 100644 --- a/wireclaw_core.py +++ b/wireclaw_core.py @@ -107,7 +107,14 @@ async def execute_command(drone, cmd): elif action == "takeoff": await refresh_position(drone) if current_pos["alt"] >= 2.0: - return "Deja en vol" + # Déjà en vol : changer l'altitude en conservant la position + new_abs_alt = current_pos["abs_alt"] - current_pos["alt"] + alt + await drone.action.goto_location( + current_pos["lat"], current_pos["lon"], new_abs_alt, float('nan') + ) + await asyncio.sleep(6) + await refresh_position(drone) + return f"OK {msg} — altitude {current_pos['alt']:.1f}m" await drone.action.set_takeoff_altitude(alt) await drone.action.arm() await drone.action.takeoff()