fix(navigator): fix FW takeoff loiter with negative coordinates (#27656)

* fix(navigator): fix FW takeoff loiter with negative coordinates

* fix(navigator): reject zero takeoff loiter coords
This commit is contained in:
Eurus authored and GitHub committed 2026-06-17 13:46:41 +02:00
1 parent 19d669e542
commit 1b322ff74a
1 file changed
+7 -2
+7 -2
View File
@@ -82,9 +82,14 @@ Takeoff::on_active()
_mission_item.altitude = _loiter_altitude_msl;
mission_item_to_position_setpoint(_mission_item, &pos_sp_triplet->current);
pos_sp_triplet->current.lat = _loiter_position_lat_lon(0) > DBL_EPSILON ?
const bool loiter_lat_valid = PX4_ISFINITE(_loiter_position_lat_lon(0))
&& fabs(_loiter_position_lat_lon(0)) > DBL_EPSILON;
const bool loiter_lon_valid = PX4_ISFINITE(_loiter_position_lat_lon(1))
&& fabs(_loiter_position_lat_lon(1)) > DBL_EPSILON;
pos_sp_triplet->current.lat = loiter_lat_valid ?
_loiter_position_lat_lon(0) : _navigator->get_global_position()->lat;
pos_sp_triplet->current.lon = _loiter_position_lat_lon(1) > DBL_EPSILON ?
pos_sp_triplet->current.lon = loiter_lon_valid ?
_loiter_position_lat_lon(1) : _navigator->get_global_position()->lon;
pos_sp_triplet->current.type = position_setpoint_s::SETPOINT_TYPE_LOITER;
pos_sp_triplet->current.cruising_speed = -1.f;