Marico

  • **
  • 52
Dshot instability in 16.09+r782?
« on: June 11, 2022, 12:08:33 pm »
 I replaced my old 4 motors 2204 (250 frame) and 4 ESCs (PWM mode) with new motors (2207 xing-e pro) and ESC 4in1 working in dshot mode (Racerstar REV35 35A BLheli_S 3-6S connected to revo FC) and I ran into some strange motor rotation stability problems. After ESC replace my quad during flying (or just in postion hold) randomly change rotation speed of the motor(s). Sometimes it's quite significant and looks like radios out of range or connection/wire loose but I'm pretty sure that radio/wires/connections are OK. Mostly is unexpected banking or little wobbling. Motor just not rotating smoothly, randomly changing the rotation speed, shaking/wobbling (visible at end of this clip): 


 The above clip is after autotune, so after tuning  nothing changed... With old pwm ESC rotation was smooth, without wobbling and shaking.

Re: Dshot instability in 16.09+r782?
« Reply #1 on: June 11, 2022, 11:38:15 pm »
Just to be clear, you did retune after going to DShot, right?

What flight mode are you using?  Does it do it in Rate Rate Rate Manual?

It would be very good information to know if the problem still happens if you use the default PID tuning values.  Yes implies one cause and no implies another cause.  If problem goes away with default PIDs, then there is an AutoTune setting that helps (Settings -> SystemIdentSettings -> DerivativeFactor).

There is a programming issue with DShot such that it affects other timing critical code too much when run at the slower DShot speeds.  Are you running a slow DShot speed?  Can you change the DShot speed to 1200?

Are your DShot ESCs capable of running PWM-490 for a test?  If changing to PWM-490 makes the problem go away then it is good information and it probably is a DShot issue.

There are some other things it could be too, but that is enough for a first pass.  :)

Marico

  • **
  • 52
Re: Dshot instability in 16.09+r782?
« Reply #2 on: June 14, 2022, 05:23:38 pm »
Just to be clear, you did retune after going to DShot, right?

Yes, but even tuning process is extremely unstable,  quad rapidly jumps in random direction, even does uncontrolled flips!
 

What flight mode are you using?  Does it do it in Rate Rate Rate Manual?

Mostly rattitude and rate. But jumps are in all modes, even in postion hold.

It would be very good information to know if the problem still happens if you use the default PID tuning values.  Yes implies one cause and no implies another cause.  If problem goes away with default PIDs, then there is an AutoTune setting that helps (Settings -> SystemIdentSettings -> DerivativeFactor).


There is a programming issue with DShot such that it affects other timing critical code too much when run at the slower DShot speeds.  Are you running a slow DShot speed?  Can you change the DShot speed to 1200?

Are your DShot ESCs capable of running PWM-490 for a test?  If changing to PWM-490 makes the problem go away then it is good information and it probably is a DShot issue.

I did some tests and I can confirm that after switching to PWM-490Hz  unexpected  jumps/changing directions goes away. My default Actuator->DShotModde is 600kHz, so just change it to 1200kHz right? BTW this ESC support pwm/oneshot/multishot/dshot, is there any real/practice advantage selecting other than PWM?
Edit:
I tested with dshot 1200 and it seems this ESC won't support this :( can't run with 1200kHz, only up to 600.


I noticed that with PWM-490 (event after autotune) there is still a little wobbling in engine rotation, is much noticable with 4S battery (I mostly fly on 3S), check this out, before entering into autotone in 8th sec wobbling are noticeable (this is second attempt to autotune):






« Last Edit: June 14, 2022, 09:58:55 pm by Marico »

Re: Dshot instability in 16.09+r782?
« Reply #3 on: June 16, 2022, 12:58:47 pm »


Mostly rattitude and rate. But jumps are in all modes, even in postion hold.
Was specifically interested in Rate Rate Rate because it is not auto-leveling and thus does not run the outer PID loop and thus only uses only one set of PIDs.  Seems the issue is found to be DShot though so no real need to test this more.

I did some tests and I can confirm that after switching to PWM-490Hz  unexpected  jumps/changing directions goes away. My default Actuator->DShotModde is 600kHz, so just change it to 1200kHz right? BTW this ESC support pwm/oneshot/multishot/dshot, is there any real/practice advantage selecting other than PWM?
Edit:
I tested with dshot 1200 and it seems this ESC won't support this :( can't run with 1200kHz, only up to 600.
It seems that DShot was coded as a "try this for test" and especially the lower speed DShots use too much CPU, causing some instability.  I would recommend using other protocols or at least use DShot 1200.  You haven't got 1200, so use some other protocol.  :)

I noticed that with PWM-490 (event after autotune) there is still a little wobbling in engine rotation, is much noticable with 4S battery (I mostly fly on 3S), check this out, before entering into autotone in 8th sec wobbling are noticeable (this is second attempt to autotune):
Using a different voltage battery needs a different tune.  Using a heavier battery or adding a camera or using different props needs a different tune.  The Stabilization tab has 3 PID banks in it.  You can store the different PIDs there and make different FMS switch settings use different PID banks if you want.

As I recall, you could also tune it with the slowest heaviest configuration (lowest voltage and largest battery, camera mounted (even smallest props)) and use that tune for all configurations.  It will not react as quickly as it could, but it will not oscillate.

If you are running fairly correct props with your lower voltage batteries, if is a good idea to use smaller props with higher voltage batteries, else you can over amp over watt over load the motors and ESCs.

Autotune has SmoothQuick adjustment that you might want to play with.  AutoTune should always be run using PIDs that do not oscillate (default PIDs usually work well).

Marico

  • **
  • 52
Re: Dshot instability in 16.09+r782?
« Reply #4 on: June 16, 2022, 09:50:13 pm »
Using a different voltage battery needs a different tune.  Using a heavier battery or adding a camera or using different props needs a different tune.  The Stabilization tab has 3 PID banks in it.  You can store the different PIDs there and make different FMS switch settings use different PID banks if you want.

OK, I did  autotuning with 4S and now flying with 4S is smooth but only in lower-middle throttle range. On high throttle quad  gets wobbling and props sounds like get high turbulance. I'll try change props  from 5x4.99 to 5x3 (250 frame) and test it again. Does autotune may help with tuning to get rid of that wobbling in high throttle? I noticed that practically autotune "tune" always in low throttle (need quad to hoover), so how get proper tuning in high throttle ranges?
That strange that little volt change 3S->4S with same battery weight (I use different bat capacity when switching beetwen 3S/4S to preserve almost the same weight) makes that big difference in quad (in)stability....

Autotune has SmoothQuick adjustment that you might want to play with.  AutoTune should always be run using PIDs that do not oscillate (default PIDs usually work well).

In my props/battery config default PIDs with 4S generate high wobbling even in low throttle. Thirst I did autotune with default PID with 3S then I used new PIDs (for 3S) to autotune with 4S...
As I understand how SmoothQuick works: it just change in +- PID values in some range, but changes I see (not tested in real flight yet) are very low to work with my quad, I think. When I tested PIDs manually I didn't see any differ when values (in attitude mode) are for an example 4,6 or 8,5: quad behaves the same...

« Last Edit: June 16, 2022, 10:12:32 pm by Marico »

Re: Dshot instability in 16.09+r782?
« Reply #5 on: June 16, 2022, 10:51:36 pm »
OK, I did  autotuning with 4S and now flying with 4S is smooth but only in lower-middle throttle range. On high throttle quad  gets wobbling and props sounds like get high turbulance.
...
Does autotune may help with tuning to get rid of that wobbling in high throttle? I noticed that practically autotune "tune" always in low throttle (need quad to hoover), so how get proper tuning in high throttle ranges?

AutoTune (and indeed any tuning) just tunes for the throttle you are using doing the tuning.  The solution is to use Stabilization->Advanced->ThrustPIDScaling to automatically increase PIDs at lower throttle and decrease PIDs at higher throttle.  Make sure that you start with what ever throttle stick position you were using being on the horizontal axis line.  That means at that throttle setting the PIDs will not be either increased or decreased.  From there you make lower throttle have higher PIDs and higher throttle have lower PIDs.

Test and adjust the graph (probably just a straight line with slope and above axis on left side / below axis on right side and goes through horizontal axis at the throttle you did the tune at).  Note that you can feel some wobble when descending straight down at medium speed the increases in PID for low throttle settings will help make that better, in addition to the reduction of PIDs at high throttle removing wobbles at high throttle.

I'll try change props  from 5x4.99 to 5x3 (250 frame) and test it again.
Of course you should retune if using different props... :)

That strange that little volt change 3S->4S with same battery weight (I use different bat capacity when switching beetwen 3S/4S to preserve almost the same weight) makes that big difference in quad (in)stability....
Decreasing voltage by 4/3 decreases power by roughly (4/3)x(4/3) = 16/9 or about a factor of 2.  Decreasing power by a factor of 2 makes it accelerate it's flips only half as fast and requires PIDs to be reduced by about a factor of 2 (if I recall the math correctly) to avoid oscillation.

Thirst I did autotune with default PID with 3S then I used new PIDs (for 3S) to autotune with 4S...
As I recall, that should work OK.  3s will have lower PIDs, so it is OK to tune 4s with them.  I personally always do AutoTune using default PIDs if they work well.

As I understand how SmoothQuick works: it just change in +- PID values in some range, but changes I see (not tested in real flight yet) are very low to work with my quad, I think. When I tested PIDs manually I didn't see any differ when values (in attitude mode) are for an example 4,6 or 8,5: quad behaves the same...

I see a very noticeable difference between Smooth and Quick.  Smooth is good for taking video.  Quickest can even have slight wobble (I use self stabilizing mode like Attitude).

----------------------------------

Autotune can cause problems with D-Term oscillation (invisible yaw oscillation).  There is a SystemIdentSettings->DerivativeFactor setting (no retune, just change this and re-save with the new PIDs).  If you notice motors are hot from just hovering, or short battery life (as compare to say using default PIDs), you may have this issue.
« Last Edit: June 16, 2022, 10:56:44 pm by TheOtherCliff »

Marico

  • **
  • 52
Re: Dshot instability in 16.09+r782?
« Reply #6 on: June 17, 2022, 06:28:56 am »
Autotune can cause problems with D-Term oscillation (invisible yaw oscillation).  There is a SystemIdentSettings->DerivativeFactor setting (no retune, just change this and re-save with the new PIDs).  If you notice motors are hot from just hovering, or short battery life (as compare to say using default PIDs), you may have this issue.

I mostly fly in stabilization on basic mode+ attitude  (or ins13+GPS modes)  and don't see any d-term values for attitude (expert) settings, is the above hint still refers to attitude mode?


trust

  • ****
  • 299
Re: Dshot instability in 16.09+r782?
« Reply #7 on: June 17, 2022, 07:29:08 am »
I think he is referring to the Derivative settings under the Inner Loop. Attitude mode uses BOTH the Rate Stabilization (Inner Loop) and the Attitude Stabilization (Outer Loop).

Marico

  • **
  • 52
Re: Dshot instability in 16.09+r782?
« Reply #8 on: June 17, 2022, 08:53:13 am »


AutoTune (and indeed any tuning) just tunes for the throttle you are using doing the tuning.  The solution is to use Stabilization->Advanced->ThrustPIDScaling to automatically increase PIDs at lower throttle and decrease PIDs at higher throttle.  Make sure that you start with what ever throttle stick position you were using being on the horizontal axis line.  That means at that throttle setting the PIDs will not be either increased or decreased.  From there you make lower throttle have higher PIDs and higher throttle have lower PIDs.

Test and adjust the graph (probably just a straight line with slope and above axis on left side / below axis on right side and goes through horizontal axis at the throttle you did the tune at).  Note that you can feel some wobble when descending straight down at medium speed the increases in PID for low throttle settings will help make that better, in addition to the reduction of PIDs at high throttle removing wobbles at high throttle.


TPS has 3 sources: ActuatorDesiredThrust, StabilizationDesiredThrust and ManualControlThrottle, which one should I use?
I assume targets should be PID?

Re: Dshot instability in 16.09+r782?
« Reply #9 on: June 17, 2022, 11:55:40 am »
Autotune can cause problems with D-Term oscillation (invisible yaw oscillation).  There is a SystemIdentSettings->DerivativeFactor setting (no retune, just change this and re-save with the new PIDs).  If you notice motors are hot from just hovering, or short battery life (as compare to say using default PIDs), you may have this issue.

I mostly fly in stabilization on basic mode+ attitude  (or ins13+GPS modes)  and don't see any d-term values for attitude (expert) settings, is the above hint still refers to attitude mode?

When you are using AutoTune, you probably don't want to manually change PIDs by hand because if you ever enable AT again, the PIDs will be overwritten.

System -> Settings -> SystemIdentSettings -> DerivativeFactor
Click the red up arrow (Save) at the top of the window to permanently store it into your FC settings.
But then you must enable AT and use SmoothQuick to export this to the PIDs.
« Last Edit: June 17, 2022, 12:03:52 pm by TheOtherCliff »

Re: Dshot instability in 16.09+r782?
« Reply #10 on: June 17, 2022, 11:59:40 am »
TPS has 3 sources: ActuatorDesiredThrust, StabilizationDesiredThrust and ManualControlThrottle, which one should I use?
I assume targets should be PID?

I use all the defaults (except for the curve itself) there.
« Last Edit: June 17, 2022, 12:04:47 pm by TheOtherCliff »

Marico

  • **
  • 52
Re: Dshot instability in 16.09+r782?
« Reply #11 on: June 19, 2022, 10:30:28 pm »
OK. after some testing (and re-configuring after settings loss) think I got quite nice stability in 4S,  QuickSmooth helped a lot.
That unexpected data reset has a good sides, too. On the previous settings (on attitude stabilization) during pitch forward or backward quad always climbed up, regardless of throttle settings manual or cruisecontrol, even on cruisecontrol banking was always with increased altitude. Now (on default settings) even on manual throttle quad preserve altitude even on manual throttle and high pitch angle. Which option has impact on climbing during pitch forward/backward with manual throttle settings?

Re: Dshot instability in 16.09+r782?
« Reply #12 on: June 20, 2022, 08:47:16 am »
With Manual throttle, the average motor speed (stabilization still causes some motors to be faster and others equally slower) is exactly what the the throttle stick says.

When hovering or flying level and then you bank fairly steeply, you (using Manual thrust) or the FC (when you have it configured to use CruiseControl) must increase the throttle, or the quad will loose altitude.

When you bank steeply, with no throttle stick change, can you actually hear the motors spin faster at the steep bank angle?

The only things I can think of that keep the quad from descending when you bank steeply are:
- you only bank steeply for a very short time
- CruiseControl or some other flight mode (all GPS flight modes) or thrust mode (ALtitudeHold or ALtitudeVario) that uses CruiseControl internally is being used

Marico

  • **
  • 52
Re: Dshot instability in 16.09+r782?
« Reply #13 on: June 20, 2022, 11:16:03 am »
When hovering or flying level and then you bank fairly steeply, you (using Manual thrust) or the FC (when you have it configured to use CruiseControl) must increase the throttle, or the quad will loose altitude.

On the previous config setup I always had to *reduce* throttle because of climbing during banks (motors significantly increased speed) . I can't get rid of that and I just used to reduce the throttle. Now it was very surprising for me that quad perfectly maintains the same altitude  during banks without touching the throttle. In the previous setup I tried flying with CruiseControl  which a bit reduced that climbing but not much. But to maintain the stable altitude I had to use AltitudeVario or AltitudeHold mode. Now altitude is stable in manual throttle mode without any GPS modes in fly mode switch settings (only INS13 is selected in attitude estimation algo). I'll test it further, l wonder if in basic (complementary) mode is the same. Of course the previous setup has differ props (5x3x3, now 5x4.9x3) and motors (2204, now 2207) but I doubt this had such impact for altitude stability.

When you bank steeply, with no throttle stick change, can you actually hear the motors spin faster at the steep bank angle?

No, I can't.  Now they are "quiet", no audible changes in motor rotation. Quad just gently banks and fly on the same altitude for long distance (as far I can see to safe control it). In the  previous setup there was audible increase od rotation and quad increased altitude.
To be honest I'am very happy with this now but still wonder which settings (or hardware change) had impact on it.

I

Re: Dshot instability in 16.09+r782?
« Reply #14 on: June 20, 2022, 07:34:55 pm »
If motors increased speed when you banked, then it sounds like CruiseControl was directly or indirectly (through some flight modes or thrust modes) being used.

You say that on Manual thrust mode it now flies a long way without gaining or loosing altitude.  On Manual thrust mode, if you hover and find the throttle for that, then when you bank away (say bank angle 30 degrees or more) and keep the bank angle it will loose altitude and you will have to add a little throttle.  Maybe your bank angle is very small because you are flying gently, not zooming away fast?  Oh well, good to know you have it set where you like it now.  :)