Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle line segment termination in navigator #18996

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

tstastny
Copy link

Describe problem solved by this pull request
Waypoint item reached criteria for fixed-wing behaviors currently span the navigator, fixed-wing position controller, and L1 guidance library. Each location having slightly varying handling. For the case of waypoints in sequence, current handling strategies include:

  • in navigator: check on horizontal acceptance radius + acceptance altitude (NAV_FW_ALT_RAD)
  • in fw_pos_ctrl_l1: (for the case of loitering up to alt at the terminal waypoint) check on acceptance altitude (2 * _param_fw_clmbout_diff)
  • in ECL_L1_Pos_Controller: once the aircraft is beyond the terminal waypoint and within some cone, guidance is switched to flying back to the terminal waypoint.
    } else if (fabsf(AB_to_BP_bearing) < math::radians(100.0f)) {

The latter condition was implemented to handle the corner case where the aircraft is "passed" the second waypoint, but not within the acceptance radius, and thus not caught for mission progression by the navigator.

Describe your solution
This PR attempts to begin some disentanglement of logic by

  1. handling the "passed the waypoint" case in the navigator mission item reached check for fixed-wing vehicles following waypoints in sequence (line following) -- i.e. the line segment is considered complete when the aircraft is either passed the second waypoint OR within the acceptance radius (see figure below)
  2. using the same acceptance altitude in both navigator and the loiter to alt logic in fw_pos_ctrl_l1 to avoid discrete clunky guidance behavior

waypoint_logic

NOTE: point (1) also offers the advantage that the specific L1 corner case handling is not necessary anymore -- which becomes relevant in #18810

Test data / coverage
The same logic was tested in SITL and can be seen #18810 (comment)

- if following line segment (fixed-wing position control) switch waypoint when in acceptance radius OR passed the second waypoint. this handles the case of being beyond the second waypoint but not within the acceptance radius without the need to fly back to the waypoint (e.g. after a loiter up to waypoint alt)
- sync navigator and fw pos ctrl waypoint acceptance altitude
Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

he line segment is considered complete when the aircraft is either passed the second waypoint OR within the acceptance radius (see figure below)

This logic makes sense to me and certainly is clearer and more predictable than what is there currently.

Not directly related to the changes in this PR, just want to point out that the acceptance radius is coming from the L1 controller (_L1_distance), resp. Navigator takes the max(NAV_ACC_RAD, _L1_distance).

Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,

The only comment would be that L1 is also used by other vehicle types(such as rovers/boats) therefore we wont be able yo completely pull the logic out of the guidance logic with this approach

@sfuhrer sfuhrer merged commit f8c2ee7 into PX4:master Jan 13, 2022
@tstastny tstastny deleted the pr-line-segment-termination branch January 13, 2022 12:43
kibidev added a commit to aviant-tech/PX4-Autopilot that referenced this pull request Mar 21, 2023
This commit revert most of
PX4#18996
so that we will no longer skip ahead to next waypoint if we are ahead of
the current. This will enfource that we return to the center of the
loiter before continue after a loiter to altitude. This is to prevent
that we turn out of the loiter when done, and reach a distance from the
WP/path that is larger than intended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants