mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 03:41:35 +08:00
RTL Direct: remove unnecessary sanitization
Signed-off-by: Silvan <silvan@auterion.com>
This commit is contained in:
@@ -125,8 +125,6 @@ void RtlDirect::on_inactive()
|
|||||||
|
|
||||||
void RtlDirect::setRtlPosition(PositionYawSetpoint rtl_position, loiter_point_s loiter_pos)
|
void RtlDirect::setRtlPosition(PositionYawSetpoint rtl_position, loiter_point_s loiter_pos)
|
||||||
{
|
{
|
||||||
_home_pos_sub.update();
|
|
||||||
|
|
||||||
parameters_update();
|
parameters_update();
|
||||||
|
|
||||||
// Only allow to set a new approach if the mode is not activated yet.
|
// 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;
|
_destination = rtl_position;
|
||||||
_force_heading = false;
|
_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);
|
_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)};
|
const float dist_to_destination{get_distance_to_next_waypoint(_land_approach.lat, _land_approach.lon, _destination.lat, _destination.lon)};
|
||||||
|
|||||||
Reference in New Issue
Block a user