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

mc_pos_control: handle landed and takeoff setpoint limiting the same way #14326

Merged
merged 4 commits into from Mar 18, 2020

Conversation

MaEtUgR
Copy link
Member

@MaEtUgR MaEtUgR commented Mar 8, 2020

Describe problem solved by this pull request
@jkflying reported an effect I've seen before:
During a normal landing procedure the thrust gets first cut by the reaction to ground detected and then cut by the takeoff logic because the vehicle is back ready for another takeoff.
image

The problem is that the thrust and attitude limit while landing is in the loop order after the position controller ran and directly operates on the attitude setpoint skipping the position controllers minimum thrust limit. The takeoff thrust limitation on the other had is before the position controller and amends the input to it.

Describe your solution
I'm unifying the thrust and attitude limit logic to be in one place where it already was for the takeoff. Both logics for takeoff and landing do these things in common:

  • cut thrust
  • set roll pitch level
  • set yawspeed to zero and yaw setpoint to current yaw
  • reset position control integral

I still have to check if reactivating flight task and reseting the hover thrust is also desired otherwise they can be conditional for just the takeoff.

Describe possible alternatives
It's not 100% clear to me if MPC_THR_MIN should be the minimum thrust at all times even during landing and takeoff or if the takeoff ramp should always start at zero thrust and thrust should go down to zero after landing.

Test data / coverage
Quick SITL test, needs more testing and review.

@MaEtUgR MaEtUgR self-assigned this Mar 8, 2020
@MaEtUgR MaEtUgR added the bug label Mar 8, 2020
@LorenzMeier
Copy link
Member

On this question:

It's not 100% clear to me if MPC_THR_MIN should be the minimum thrust at all times even during landing and takeoff or if the takeoff ramp should always start at zero thrust and thrust should go down to zero after landing.

From a UX perspective ramping from and to 0 would be preferable, because the minimum throttle is the throttle that enables the system to be safely descending, while in these situations a smooth spool-up and spool-down of the rotors creates trust of the user.

Otherwise every flight starts with a scary "twitch" because the props go from 0 to idle throttle in a short amount of time. Same for landing: Running smoothly to zero is nicer compared to holding throttle and just switching off.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Mar 9, 2020

Otherwise every flight starts with a scary "twitch" because the props go from 0 to idle throttle in a short amount of time. Same for landing: Running smoothly to zero is nicer compared to holding throttle and just switching off.

Exactly what I thought. Twitch at the beginning and less useful land detection at the end because it doesn't go down to zero. I'm working on a way to have that possible.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Mar 9, 2020

because the minimum throttle is the throttle that enables the system to be safely descending

It cannot be considered a guarantee for safe descending because of the minimum thrust resulting in a downwards acceleration. So it depends on how long it's applied if the vertical end speed is still safe. I see it more as the guard to keep rotational control authority when not using airmode in the mixer (which is disabled by default for safety reasons).

@LorenzMeier
Copy link
Member

Sorry, that’s what I meant with “safe”.

@MaEtUgR MaEtUgR marked this pull request as ready for review March 9, 2020 10:27
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Mar 9, 2020

I revisited the implementation and rebased on master. I also did quite extensive SITL testing.

It now:

  • solves the original issue that the thrust went up again during landing
  • starts the takeoff ramp at zero thrust
  • removes the deprecated thrust setpoint takeoff logic for stabilized (because it was int the way)
  • handles setpoint limiting for takeoff and landing the same way before the position controller

image

There is no thrust ramp down for ground contact yet, that's for another pr.

Ready for review and testing.

@MaEtUgR MaEtUgR requested a review from bresch March 9, 2020 10:46
@MaEtUgR MaEtUgR changed the title mc_pos_control: handle landed and takeoff thrust cut the same way mc_pos_control: handle landed and takeoff setpoint limiting the same way Mar 9, 2020
@MaEtUgR MaEtUgR added this to the Release v1.11.0 milestone Mar 10, 2020
bresch
bresch previously approved these changes Mar 10, 2020
Copy link
Member

@bresch bresch left a comment

Choose a reason for hiding this comment

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

Nice

@MaEtUgR MaEtUgR requested a review from a team March 11, 2020 16:48
@Tony3dr Tony3dr added this to Ready for testing in Test Flights Mar 11, 2020
@MaEtUgR MaEtUgR added this to To Do in Release 1.11 Blockers via automation Mar 11, 2020
@MaEtUgR MaEtUgR moved this from To Do to Testing in Release 1.11 Blockers Mar 11, 2020
@jorge789
Copy link

Tested on PixRacer V4

Indoor Flight Test
Modes Tested
Stabilized Mode: Good.

Procedure
Arm and Take off in stabilized mode.

Notes
No issues noted, good flight in general.

Log https://review.px4.io/plot_app?log=28108a2a-8640-4416-a817-cd7bdd94087f

Tested on CUAV nano V5

Indoor Flight Test
Modes Tested
Stabilized Mode: Good.

Procedure
Arm and Take off in stabilized mode.

Notes
No issues noted, good flight in general.

Log https://review.px4.io/plot_app?log=b8e12d7a-3476-462a-946f-d9c26a9b8c37

@Junkim3DR
Copy link

Tested on NXP FMUK66 v3

Indoor Flight
Mode tested

  • Stabilized

Procedure

  • Takeoff and landing in Stabilized

Note

  • No issue noted.

Log
https://review.px4.io/plot_app?log=5cd75156-b675-4399-acdf-d4e6c2e22c09

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Mar 13, 2020

@PX4/testflights With this one it's most important to test takeoffs and landings in Altitude, Position and Auto Takeoff/Landing modes. Thanks in advance!

@Tony3dr
Copy link

Tony3dr commented Mar 13, 2020

@PX4/testflights With this one it's most important to test takeoffs and landings in Altitude, Position and Auto Takeoff/Landing modes. Thanks in advance!

@MaEtUgR We will test this on the field once the rain stops. Monday the rain should clear.

bresch
bresch previously approved these changes Mar 15, 2020
to make sure the takeoff limitation is always done last.
This was only necessary for stabilized mode before #10805.
The  unit length thrust setpoint will anyways not be available
anymore soon because it gets replaced with the acceleration
setpoint in m/s².
The landing thrust limit was after the position controller and
could be inconsistent with what the takeoff limit did. This
resulted in different thrust values sequentially getting applied
during landing.
Otherwise the takeoff ramp doesn't start with zero thrust and
the land thrust cut cannot cut to zero.
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Mar 18, 2020

I rebased on master after the conflicts with #14378 and #14339.

Copy link
Member

@bresch bresch left a comment

Choose a reason for hiding this comment

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

Still GTM

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Mar 18, 2020

I'm quoting the test report by @fury1895:

I did several takeoffs and landings with F450 in altitude, position, and auto flight modes. No issues showed up. Looks like small changes but the improvement in UX is great!

Thanks for helping with testing!

@MaEtUgR MaEtUgR merged commit d0349fc into master Mar 18, 2020
Release 1.11 Blockers automation moved this from Testing to Done Mar 18, 2020
Test Flights automation moved this from Ready for testing to Done Mar 18, 2020
@MaEtUgR MaEtUgR deleted the pr-fix-idle-thrust branch March 18, 2020 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants