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

FlightTask: add 1st order lpf on yawrate satepoint for smooth motion #13430

Merged
merged 3 commits into from
Nov 25, 2019

Conversation

bresch
Copy link
Member

@bresch bresch commented Nov 11, 2019

Currently, there is no way to have a smooth yaw stop as the yaw locking mechanism is based on the position of the yaw stick: when the stick goes back to zero, the yaw setpoint is set to the current yaw and since the vehicle is moving, it is not physically possible to stop without overshoot.
2019-11-11_11-11-48_01_plot

To fix this issue, the yawspeed setpoint (generated from the stick position) is passed through a 1st order lowpass filter. The yaw lock now occurs when the output of the filter is at zero.
As shown below, there is no overshoot anymore:
2019-11-11_11-13-01_01_plot

Note: this modification affects altitude and position controlled modes (i.e.:not stabilized, not auto)

Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

We definitely need to solve this but after reviewing and thinking about it I favor the slew-rate implementation. Please let me create a separate pr to compare. It's already implemented in https://github.com/PX4/Firmware/pull/12072/files#diff-cd11905871652d5f1467db1dfc9cecd2R61-R96

@bresch
Copy link
Member Author

bresch commented Nov 13, 2019

@MaEtUgR Thanks for the review. I'm waiting for the slew-rate PR to compare then.
I was also considering slew-rate when I did this PR but I decided to go with the filter; I thought the behavior would be more intuitive (linear instead of nonlinear) but I didn't actually try.

@bresch bresch force-pushed the pr-man-yawrate-filter-upstream branch from b2b0916 to c577967 Compare November 13, 2019 16:54
@MaEtUgR MaEtUgR force-pushed the pr-man-yawrate-filter-upstream branch from c577967 to 2ed1631 Compare November 18, 2019 10:57
MaEtUgR
MaEtUgR previously approved these changes Nov 18, 2019
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

We can test the differences to #13464 later on. It's easy to change again based on our findings from the comparison and any of the solutions is better than none.

I added a commit for my parameter description suggestions. You can change and squash them if you like.

@bresch
Copy link
Member Author

bresch commented Nov 18, 2019

@PX4/testflights Could you please test this PR? In altitude and position control, the yaw "stop" should be smoother than before.

@dannyfpv
Copy link

dannyfpv commented Nov 19, 2019

Tested on Pixhawk 4 v4 f-450

Modes Tested:
Altitude mode: Yaw not working
Position mode: Yaw not working
Stabilized mode: yaw working fine

log:
https://review.px4.io/plot_app?log=6c8619cd-b35e-4323-95c2-abd143e40d0e

@Tony3dr
Copy link

Tony3dr commented Nov 19, 2019

@bresch it seems like the Yaw is not working on Pixhawk 4, PixRacer,Pixhawk Pro and NXP FMUK66.

@bresch
Copy link
Member Author

bresch commented Nov 19, 2019

@dannyfpv @Tony3dr that's really strange but thanks for the test, I'll have a look at the log

@jorge789
Copy link

jorge789 commented Nov 19, 2019

Tested on PixRacer V4:

Modes Tested:
Altitude mode: Yaw not working
Position mode: Yaw not working
Stabilized mode: yaw working fine

  • Procedure
    Arm and Take off in position mode, after flying for approximately one minute, switched to altitude then stabilized mode.
    Note:
    In position and Altitude mode Yaw does not work, in stabilized it seems to work fine

Log: https://review.px4.io/plot_app?log=5ff1f19a-ae37-47fe-a6f9-1c8ca1410508

Tested on Pixhawk V4pro:

Modes Tested:
Altitude mode: Yaw not working
Position mode: Yaw not working
Stabilized mode: yaw working fine

  • Procedure
    Arm and Take off in position mode, after flying for approximately one minute, switched to altitude then stabilized mode.
    Note:
    In position and Altitude mode Yaw does not work, in stabilized it seems to work fine**

Log: https://review.px4.io/plot_app?log=d46b6772-8e8f-40a3-b646-4c490ab7f3b1

Tested on NXP_FMUK66_V3:

Modes Tested:
Altitude mode: Yaw not working
Position mode: Yaw not working

@bresch
Copy link
Member Author

bresch commented Nov 20, 2019

@PX4/testflights I was able to recreate the issue and fixed it, it's now ready for testing again.

MaEtUgR
MaEtUgR previously approved these changes Nov 21, 2019
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

Looks good, I did all my checks and added some minor changes that don't change the behavior in the last commit. Ready to merge.

@MaEtUgR
Copy link
Member

MaEtUgR commented Nov 22, 2019

@PX4/testflights Could you give this another go? We're interested in your judgment about stick yawing when flying in Altitude and Position mode. It should be smoother and have no overshoot when stopping quickly in yaw.

@bresch bresch force-pushed the pr-man-yawrate-filter-upstream branch from d8b4a09 to 3d380dc Compare November 22, 2019 10:40
@MaEtUgR MaEtUgR force-pushed the pr-man-yawrate-filter-upstream branch from 9c83a1c to 7bc2789 Compare November 22, 2019 14:34
MaEtUgR
MaEtUgR previously approved these changes Nov 22, 2019
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

@jorge789
Copy link

jorge789 commented Nov 23, 2019

Tested on PixRacer V4:

- Modes Tested
Position Mode: YAW GOOD.
Altitude Mode: YAW GOOD.

Procedure
Takeoff in position mode, the yaw was tested and it worked well. After flying for about 1 minute, changed to altitude Mode, yaw seems to work fine and was smooth.

Log: https://review.px4.io/plot_app?log=54e39fe6-ab5d-4f77-9446-539aa857547a

@Junkim3DR
Copy link

Junkim3DR commented Nov 23, 2019

Tested on NXP FMUK66 v3:

- Modes Tested
Position Mode: YAW GOOD.
Altitude Mode: YAW GOOD.

Procedure
Takeoff in position mode, the yaw was tested and it worked well. After flying for about 1 minute, changed to altitude Mode, yaw seems to work fine and was smooth.

Log: https://review.px4.io/plot_app?log=10ab6b43-de22-49f7-88db-ae03a7e5d113

@Tony3dr
Copy link

Tony3dr commented Nov 24, 2019

Tested on Pixhawk 4 V5:
Modes Tested
Position Mode: YAW GOOD.
Altitude Mode: YAW GOOD.

Procedure
Takeoff in position mode, the yaw was tested and it worked well. After flying for about 1 minute, changed to altitude Mode, yaw seems to work fine and was smooth.

Log: https://review.px4.io/plot_app?log=26192193-9762-4ac3-8da6-752171432b30&fbclid=IwAR3h5_wU5RDtIlpHSMCIoSSP7ow4tJ9WhUl_Q4LiT0-MKsPmJjpGF9esGt0

bresch and others added 3 commits November 25, 2019 11:05
@bresch bresch merged commit 4a28c81 into master Nov 25, 2019
@bresch bresch deleted the pr-man-yawrate-filter-upstream branch November 25, 2019 10:55
@MaEtUgR MaEtUgR mentioned this pull request Dec 4, 2019
@mortenfyhn
Copy link
Contributor

This feature is really useful, so I just wanted to drop a comment to say thanks. Keep up the good work!

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.

8 participants