mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
RTL Direct: remove unnecessary sanitization
Signed-off-by: Silvan <silvan@auterion.com>
This commit is contained in:
parent
2239c10192
commit
0577a40440
@ -125,8 +125,6 @@ void RtlDirect::on_inactive()
|
||||
|
||||
void RtlDirect::setRtlPosition(PositionYawSetpoint rtl_position, loiter_point_s loiter_pos)
|
||||
{
|
||||
_home_pos_sub.update();
|
||||
|
||||
parameters_update();
|
||||
|
||||
// Only allow to set a new approach if the mode is not activated yet.
|
||||
@ -134,20 +132,6 @@ void RtlDirect::setRtlPosition(PositionYawSetpoint rtl_position, loiter_point_s
|
||||
_destination = rtl_position;
|
||||
_force_heading = false;
|
||||
|
||||
// Input sanitation
|
||||
if (!PX4_ISFINITE(_destination.lat) || !PX4_ISFINITE(_destination.lon)) {
|
||||
// We don't have a valid rtl position, use the home position instead.
|
||||
_destination.lat = _home_pos_sub.get().lat;
|
||||
_destination.lon = _home_pos_sub.get().lon;
|
||||
_destination.alt = _home_pos_sub.get().alt;
|
||||
_destination.yaw = _home_pos_sub.get().yaw;
|
||||
}
|
||||
|
||||
if (!PX4_ISFINITE(_destination.alt)) {
|
||||
// Not a valid rtl land altitude. Assume same altitude as home position.
|
||||
_destination.alt = _home_pos_sub.get().alt;
|
||||
}
|
||||
|
||||
_land_approach = sanitizeLandApproach(loiter_pos);
|
||||
|
||||
const float dist_to_destination{get_distance_to_next_waypoint(_land_approach.lat, _land_approach.lon, _destination.lat, _destination.lon)};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user