-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Improve front transition tracking & fix flyaway #14727
Conversation
In order to reproduce the first bug addressed by this PR use plain master and then:
You will see the vehicle perform a flyaway. What we should also fix: |
Fixes #14718 |
Solved my issue 👍 |
Vector2f prev_wp{0.0f, 0.0f}; | ||
if (!PX4_ISFINITE(_transition_waypoint(0))) { | ||
double lat_transition, lon_transition; | ||
waypoint_from_heading_and_distance(_current_latitude, _current_longitude, _yaw, 1000.0f, &lat_transition, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small comment where this 1000 is coming from would be useful here. Maybe best define a separate variable for it, e.g. const float transition_destination_dist = 1000.0f.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sfuhrer yes, I can do that
@RomanBapst this makes sense to me. Beside the minor proposal for better commenting it looks good to me, and also does in sitl wthat it's supposed to do. Do we want real flight testing before merging? |
@sfuhrer Would be good to get some testing for the release. |
Signed-off-by: RomanBapst <[email protected]>
…ition - this fixes the case where the navigator publishes a loiter waypoint or any waypoint which is too close to the vehicle. Signed-off-by: RomanBapst <[email protected]>
2a9f02a
to
f1cb5f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using HDG_HOLD_DIST_NEXT makes sense as well, good to merge for me, and then do release flight testing.
This PR contains the following improvement:
At the start of a front transition the fixed wing position controller creates a virtual position setpoint which is located 1000m in front of the vehicle. This avoids the controller tracking waypoints which are too close to the vehicle, e.g. loiter waypoints.
It would of course be nicer if the navigator would automatically publish this setpoint. However, this would take quite some changes and I'm not comfortable with the attempt just before a release.
Also, the logic in the position controller is straight forward and can be removed very easily.
This PR fixes the following bug:
A takeoff followed by a transition command lead to the vehicle doing a flyaway. This was because the takeoff code did not set valid latitude and longitude for the takeoff waypoint but still set the _can_loiter_at_sp flag to true. As a result the loiter code did not set a position setpoint but just copied over the NAN values.
Finally, the position controller did not know what to do with that and just did nothing.
I think this bug was introduced with flighttasks as they support of NAN position setpoint.