mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 16:51:16 +08:00
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:
1 parent
19d669e542
commit
1b322ff74a
1 file changed
+7
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user