diff --git a/config/ardupilot_gps_denied.parm b/config/ardupilot_gps_denied.parm index d1a7237..afb6f0e 100644 --- a/config/ardupilot_gps_denied.parm +++ b/config/ardupilot_gps_denied.parm @@ -12,8 +12,9 @@ GPS_TYPE 1 # Auto-detect # ==================== # Geofence Settings # ==================== -# Safety cage - uses GPS for boundaries -FENCE_ENABLE 1 +# Disabled for now - causes "fence requires position" errors +# TODO: Re-enable after basic flight works +FENCE_ENABLE 0 FENCE_TYPE 3 # Alt + Circle FENCE_ACTION 2 # Land on breach FENCE_ALT_MAX 10 # Maximum altitude (meters) diff --git a/src/autonomous_controller.py b/src/autonomous_controller.py index 8fdb48b..9938fe7 100755 --- a/src/autonomous_controller.py +++ b/src/autonomous_controller.py @@ -193,14 +193,19 @@ class AutonomousController: if gps_ok and home_ok: print("[CTRL] GPS and home ready!") - # NOW enable geofence since we have position - print("[CTRL] Enabling geofence: Alt=10m, Radius=20m") - self.set_param("FENCE_ENABLE", 1) - self.set_param("FENCE_TYPE", 3) - self.set_param("FENCE_ACTION", 2) - self.set_param("FENCE_ALT_MAX", 10) - self.set_param("FENCE_RADIUS", 20) - time.sleep(1) + # Wait for EKF position estimate to be valid + print("[CTRL] Waiting for EKF position estimate...") + time.sleep(5) + + # Skip fence for now - causes "need position estimate" errors + # TODO: Re-enable fence after basic flight works + # print("[CTRL] Enabling geofence: Alt=10m, Radius=20m") + # self.set_param("FENCE_ENABLE", 1) + # self.set_param("FENCE_TYPE", 3) + # self.set_param("FENCE_ACTION", 2) + # self.set_param("FENCE_ALT_MAX", 10) + # self.set_param("FENCE_RADIUS", 20) + return True elapsed = int(time.time() - start)