inav icon indicating copy to clipboard operation
inav copied to clipboard

Limit yaw acceleration in YAW axis

Open DzikuVx opened this issue 10 years ago • 22 comments

in a09f07caf2951ece6a7ebdc9617a202f077c10d8 filterApplyPt1WithRateLimit was introduced. Extend MAG_HOLD controller to use it. Also, define default for MAG_HOLD.

Idea: does it makes sense to replace yaw_p_limit and yaw_jump_prevention_limit with limited acceleration on YAW axis? For sure this would make tuning easier

DzikuVx avatar May 15 '16 11:05 DzikuVx

I like your idea of general yaw acceleration limiting - it may also work to complement mag_hold.

However I don't think it will replace yaw_p_limit and yaw_jump_prevention_limit as they serve a slightly different purpose - they limit the PID response which is generated not only by stick command, but also by external interference - like rotation induced by clipping the gate.

digitalentity avatar May 15 '16 12:05 digitalentity

I thought for a second about it and looks like they can not be replaced after all. You are right here. Acceleration limiting on user input can be added, but will not replace yaw_p_limit and yaw_jump_prevention_limit

DzikuVx avatar May 15 '16 12:05 DzikuVx

I'm already adding general yaw accel limiting to a separate branch. Stay tuned.

digitalentity avatar May 15 '16 12:05 digitalentity

Please see b88a828 and yaw-accel-limiting branch. Code is just a proof of concept. If it works we can remove LPF from MAG_HOLD controller and add 2 more settings - yaw_rate_lpf_hz and yaw_rate_accel_limit.

digitalentity avatar May 15 '16 12:05 digitalentity

There will only an issue of tuning this thing. Damn... we are changing quite a lot lately :)

DzikuVx avatar May 15 '16 12:05 DzikuVx

Defaults should be set to quite high values - currently there is neigher LPF nor rate-limiting. One wouldn't have to change anything unless his quad looses stability when doing hard yaws, otherwise - reduce yaw_rate_accel_limit and sacrifice speed of response until there's no loss of stability. I think we don't even need yaw_rate_lpf_hz.

digitalentity avatar May 15 '16 12:05 digitalentity

Yes, we change quite a lot. And I must say I like it!

digitalentity avatar May 15 '16 12:05 digitalentity

@digitalentity @DzikuVx In what way is a LPF helpful compared to only acc-limiting?

Would it be possible to prioritize roll/pitch over yaw in rate mode, so we don't have to put any limit on yaw performance?

theArchLadder avatar May 15 '16 17:05 theArchLadder

Lpf would make transition smooth while below acceleration limit.

Previous mixer was not prioritizing yaw. Mixer from Betaflight is.

DzikuVx avatar May 15 '16 17:05 DzikuVx

The new mixer doesn't prioritize anything, it does what it can to satisfy PID command. Prioritizing one axis over another actually is a bad thing.

If we are over the limit of the setup we will end up with I-term winding up like crazy, this is why limited yaw performance is best dealt with in PID controller - the most sophisticated part of flight stabilisation.

digitalentity avatar May 15 '16 22:05 digitalentity

There is smth with new mixer and stability with yaw fast acc/speed. My 600mm was more stable in those conditions on old mixer. So maybe not priority per se, but there is smth in place

DzikuVx avatar May 16 '16 06:05 DzikuVx

New mixer is allowed to adjust throttle (increase or reduce) to satisfy the most of PID output. The old mixer wasn't allowed to do it and PID output might get clipped by mixer.

digitalentity avatar May 16 '16 11:05 digitalentity

@DzikuVx @digitalentity What is the difference between yaw_jump_prevention_limit and yaw_p_limit? Both of them seem to limit yaw, so what is the difference in flight behavior between them? To rainy to try!

theArchLadder avatar May 16 '16 16:05 theArchLadder

  • yaw_p_limit is PID loop only. It's an absolute limit of error * P gain.
  • yaw_jump_prevention_limit is mixer located. It limits total YAW axis PID output comparing to current stick position. So, on stick at 0 (middle) and yaw_jump_prevention_limit=200 only values between -200 and 200 will be written to motors (well, mixed not written). At stick at 100, -100 and 300 and so on

Lately I increased yaw_jump_prevention_limit on my 600mm to 400 and it improved yaw performance greatly

DzikuVx avatar May 16 '16 17:05 DzikuVx

Hmm... In the end it seems like both of them limits the difference in motor speed for yaw... Would you care to give an example of a scenario where they would do different things?

theArchLadder avatar May 16 '16 18:05 theArchLadder

Rain finally stopped! Did a test flight to find out the difference between yaw_jump_prevention_limit and yaw_p_limit. I have to say it's really hard to tell a difference for me, p_limit reduces does sudden changes in motor speed and makes yaw smoother, but so does jump_prevention as far as i can tell, the effect of it was not as big though.

Perhaps my quad has to great yaw capability to really need or notice any difference with the jump_prevention? It's still unclear to me what jump_prevention can help with that p_limit cannot.

theArchLadder avatar May 17 '16 08:05 theArchLadder

They overlap each other, true.

DzikuVx avatar May 17 '16 08:05 DzikuVx

It does sound like only having acc limit and rate limit would be more user friendly and easier to tune...

If i yaw very fast back and forth, my quad gains lots of altitude, no matter what i set jump_prevention and p_limit to, i guess this has something to do with my low hover throttle around 1250, so the mixer raises the throttle.

theArchLadder avatar May 17 '16 09:05 theArchLadder

@DzikuVx is this issue still valid? Should we implement Yaw accel limiting?

digitalentity avatar Jun 22 '16 13:06 digitalentity

@digitalentity I'm not sure. Perhaps, but I do not think it's required not. Latest changes to rates and MAG_HOLD controller improved things so much that even my overweighted 600m quad behaves ok in yaw. I would leave the ticket, only remove 1.2 milestone

DzikuVx avatar Jun 22 '16 13:06 DzikuVx