Skip to content

Commit

Permalink
RTL: only subract loiter radius when in FW
Browse files Browse the repository at this point in the history
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
  • Loading branch information
sfuhrer committed Oct 24, 2024
1 parent c8ade38 commit 558eabe
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/modules/navigator/rtl_direct_mission_land.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,13 @@ rtl_time_estimate_s RtlDirectMissionLand::calc_rtl_time_estimate()
get_vector_to_next_waypoint(hor_position_at_calculation_point(0), hor_position_at_calculation_point(1),
next_position_mission_item.lat, next_position_mission_item.lon, &direction(0), &direction(1));

const float hor_dist = math::max(get_distance_to_next_waypoint(hor_position_at_calculation_point(0),
hor_position_at_calculation_point(1), next_position_mission_item.lat,
next_position_mission_item.lon) - next_position_mission_item.loiter_radius, 0.f);
float hor_dist = get_distance_to_next_waypoint(hor_position_at_calculation_point(0),
hor_position_at_calculation_point(1), next_position_mission_item.lat,
next_position_mission_item.lon);

if (_vehicle_status_sub.get().vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) {
hor_dist = max(0.f, hor_dist - next_position_mission_item.loiter_radius);
}

_rtl_time_estimator.addDistance(hor_dist, direction, 0.f);

Expand All @@ -322,9 +326,13 @@ rtl_time_estimate_s RtlDirectMissionLand::calc_rtl_time_estimate()
get_vector_to_next_waypoint(hor_position_at_calculation_point(0), hor_position_at_calculation_point(1),
next_position_mission_item.lat, next_position_mission_item.lon, &direction(0), &direction(1));

const float hor_dist = math::max(get_distance_to_next_waypoint(hor_position_at_calculation_point(0),
hor_position_at_calculation_point(1), next_position_mission_item.lat,
next_position_mission_item.lon) - next_position_mission_item.loiter_radius, 0.f);
float hor_dist = get_distance_to_next_waypoint(hor_position_at_calculation_point(0),
hor_position_at_calculation_point(1), next_position_mission_item.lat,
next_position_mission_item.lon);

if (_vehicle_status_sub.get().vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) {
hor_dist = max(0.f, hor_dist - next_position_mission_item.loiter_radius);
}

_rtl_time_estimator.addDistance(hor_dist, direction, 0.f);

Expand Down

0 comments on commit 558eabe

Please sign in to comment.