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 additional case with NPFG waypoint navigation handling #53

Closed
wants to merge 1 commit into from

Conversation

Jaeyoung-Lim
Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim commented Dec 29, 2021

Describe problem solved by this pull request
The NPFG waypoint handling logic did not handle the case when the vehicle was further along the line segment and passed the current waypoint.

This resulted in the vehicle continuing along the line segment defined by the previous(Waypoint A) and current waypoint(Waypoint B) even though the vehicle has passed the current waypoint (Waypoint B).

This can happen when the current waypoint altitude difference is big, so that the vehicle switches to a loiter setpoint to climb, and then switches back to a considering it as a position setpoint only after when it has passed the current waypoint.

My guess is that this was hidden since we never had position waypoints that were consecutively on different altitudes.

Describe your solution
This PR adds additional case handling of the navigate waypoints in NPFG

Test data / coverage
Tested in SITL Gazebo

make px4_sitl gazebo_believer

Additional context

This commit adds an additional case where the vehicle can be ahead of the current waypoint. Previously this case was not handled and resulted in the vehicle indefinitely continuing along the waypoint line segment
@acfloria
Copy link
Collaborator

acfloria commented Jan 3, 2022

Is this a proper fix or more like a hack that it does not happen again?

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Jan 3, 2022

Is this a proper fix or more like a hack that it does not happen again?

@acfloria My intention was a proper fix (The case was simply not handled in the waypoint logic), but if there are other possible ways to improve the logic please let me know!

@acfloria
Copy link
Collaborator

acfloria commented Jan 3, 2022

How does L1 actually handle this?

I think such a fix might be fine but I kind of don't like the hard switch of behavior. Maybe @tstastny has an idea how to fix it since this will also need to be fixed in the upstream PR.

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Jan 3, 2022

I think such a fix might be fine but I kind of don't like the hard switch of behavior.

I fully agree @acfloria I believe the case in L1 is this one:

} else if (fabsf(AB_to_BP_bearing) < math::radians(100.0f)) {
/*
* Extension, fly back to waypoint.
*
* This corner case is possible if the system was following
* the AB line from waypoint A to waypoint B, then is
* switched to manual mode (or otherwise misses the waypoint)
* and behind the waypoint continues to follow the AB line.
*/

and seems like the same corner case with the issue this PR is addressing

@acfloria
Copy link
Collaborator

acfloria commented Jan 3, 2022

I see. I would probably also do something like this. Using a cone instead of checking if it is in front of the waypoint, because then it would react a bit earlier. Also it is closer to L1, which would make the upstream merge a bit easier.

@tstastny
Copy link

tstastny commented Jan 4, 2022

@Jaeyoung-Lim - good catch. However, maybe two comments.. 1) if you want to do a point tracking conversion to handle this case similar to L1 logic, I wouldn't recommend defining tracking to the opposite direction line as you have it now. Rather use the guideToPoint() method. 2) I made a fix for this moving the handling of this case to the mission block in PX4#18810 (comment) - this would be my preferred fix. Let me know what you think.

@acfloria I'm a bit skeptical on the 100 deg cone as L1 implements it.. as this even limits the range of where the aircraft will start turning back towards the waypoint. Having the switch logic occur at either in the acceptance radius or passed the terminal waypoint simplifies all this.

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Jan 4, 2022

@tstastny Thanks for the review and comments!

  1. if you want to do a point tracking conversion to handle this case similar to L1 logic, I wouldn't recommend defining tracking to the opposite direction line as you have it now. Rather use the guideToPoint() method.

This feels like a much more sensible thing to do 😄 I will update this PR once upstream is merged so that there are no additional changes that require a backport

@tstastny
Copy link

this is addressed in PX4#18996 and PX4#18810

@stale
Copy link

stale bot commented Apr 18, 2022

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Apr 18, 2022
@tstastny tstastny closed this Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vehicle deviates from waypoint and does not recover
3 participants