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

Improve front transition tracking & fix flyaway #14727

Merged
merged 2 commits into from
Apr 27, 2020
Merged

Conversation

RomanBapst
Copy link
Contributor

@RomanBapst RomanBapst commented Apr 22, 2020

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.

@dagar dagar requested review from dagar and sfuhrer April 22, 2020 03:43
@dagar dagar added bug Hybrid VTOL 🛩️🚁 Multirotor + Fixedwing! labels Apr 22, 2020
@dagar dagar added this to the Release v1.11.0 milestone Apr 22, 2020
@RomanBapst
Copy link
Contributor Author

In order to reproduce the first bug addressed by this PR use plain master and then:

  • make the vtol takeoff either via terminal or QGC
  • wait until it has reached takeoff altitude
  • execute a transiton to fw command

You will see the vehicle perform a flyaway.

What we should also fix:
If you do a takeoff and execute a transition while the takeoff is not done yet I believe the vehicle will transition in takeoff mode and never get out it. We should probably lock transitions in certain modes.

@RomanBapst
Copy link
Contributor Author

The figure below shows a takeoff followed by a loiter around the home position. After issuing a backtransition command the vehicle transitions while still flying the circle. Once transitioned it moves back to the home point (which is the loiter target).

image

@RomanBapst
Copy link
Contributor Author

Fixes #14718

@RomanBapst
Copy link
Contributor Author

Mission:
image

@ThomasRigi
Copy link
Member

Solved my issue 👍

sfuhrer
sfuhrer previously approved these changes Apr 22, 2020
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,
Copy link
Contributor

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.

Copy link
Contributor Author

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

@sfuhrer
Copy link
Contributor

sfuhrer commented Apr 22, 2020

@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?

@RomanBapst
Copy link
Contributor Author

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.

…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]>
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.

Using HDG_HOLD_DIST_NEXT makes sense as well, good to merge for me, and then do release flight testing.

@dagar dagar merged commit 2b276a3 into master Apr 27, 2020
@dagar dagar deleted the pr_flyaway_front_trans branch April 27, 2020 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Hybrid VTOL 🛩️🚁 Multirotor + Fixedwing!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants