Unexpected oscillation during auto mission

Hi everyone,

I am a little confused. I build a X8 with a frame size 1.21m and prop size 22 inch. After performing the accel calibration, compass calibration, radio calibration, esc calibration and checking the motor orders and rotation I also did the initial parameter ( I inserted 22 inch props, 6s battery and the rest default) setup in mission planner. I have build a several multi copters and the initial parameter setup provides a flyable multi copter.

The first flight I took off in stabilize (no oscillations), then switched to AltHold (Still no oscillations) and then to PosHold (Also no oscillations). In all those modes the pitch, roll and yaw felt ok. Yaw was a bit aggressive but did not overshoot or oscillate.

The last test I perform was a mission in AUTO and there it happens. On the second last waypoint (of three) the multi copter tried to go back to takeoff location but it started to oscillate in the roll and pitch from what I saw on the ground. When I switched back to AltHold it was able to level itself and stop oscillating.

After reviewing the log I see that rcout is indeed roll and pitch goes back and forth.

Here is a link to the .bin file: Dropbox - 2022-03-01 11-26-29.bin - Simplify your life

If someone can give me advice where to look at based on the .bin file it would be of great help.

There’s lots of times in that flight where you have some motors hitting minimum output. This will affect stability.

Test if you can go lower with MOT_SPIN_ARM,0.2 using the MissionPlanner motor test, then set MOT_SPIN_MIN = MOT_SPIN_ARM+0.03
For example MOT_SPIN_ARM,0.15 and MOT_SPIN_MIN,0.18

Also set up the Harmonic Notch Filter and test, then run Autotune.
Start with these settings:
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,0
INS_HNTCH_ENABLE,1 ← set this then refresh params to see the rest
INS_HNTCH_MODE,1
INS_HNTCH_REF,0.12
INS_HNTCH_FREQ,40
INS_HNTCH_BW,20
INS_HNTCH_ATT,40

Just hover for a while, maybe some gentle movements, then land. Let’s see that log file, or you can check the FFT yourself and adjust the INS_HNTCH_FREQ and INS_HNTCH_BW.
Set INS_LOG_BAT_OPT,2 and do another test flight, recheck the FFT to ensure almost no vibrations are getting through.
If HNOTCH is all working as planned you can set
INS_LOG_BAT_MASK,0
INS_LOG_BAT_OPT,0

Try an Autotune.
Test Loiter mode. It is more modern and configurable than Position Hold mode, and most similar to how the aircraft will behave in Auto mode.

2 Likes

I agree with @xfacta that the MOT_SPIN_MIN and MOT_SPIN_ARM are probably too high. Chopping off the bottom 30% of the PWM range isn’t good if it can be avoided.

If you can’t use AutoTune for some reason it might help to increase ATC_RAT_RLL_P/I/D and ATC_RAT_PIT_P/I/D by 20% to see if that helps (I suspect it will).

1 Like

Thank you, for the quick response and detailed advice. I will check the MOT_SPIN_* params and when the local weather here is good to fly I will setup the harmonic notch filter and further tuning.

First I will try to increase ATC_RAT_RLL_P/I/D and ATC_RAT_PIT_P/I/D by 20% before performing a AutoTune (for me it is a huge device and its kind of intimidating). If its still not ok I will do a AutoTune. Of course after setting up the harmonic notch filter and adjust INS_HNTCH_FREQ and INS_HNTCH_BW if needed. This I can do next Wednesday, then the weather should be good to fly.

1 Like

Hi Guys, once again thank you @xfacta and @rmackay9 very much for the great help.

Today I was able to perform the tests and I succeeded in setting up the MOT_SPIN_MIN and MOT_SPIN_ARM. Those where indeed to high and I was able to lower MOT_SPIN_ARM from 0.2 to 0.14 and MOT_SPIN_MIN from 0.3 to 0.17.

Then I went trough the step for setting up the Harmonic Notch filter. This is the .bin file before:

and the the .bin file I ended up with:

Basically I had to set the following parameters:

  • INS_HNTCH_ENABLE,1
  • INS_HNTCH_MODE,1
  • INS_HNTCH_REF,0.12
  • INS_HNTCH_FREQ,103
  • INS_HNTCH_BW,40
  • INS_HNTCH_ATT,40

By analyzing the FFT A huge spike was visible around the 103Hz. Under FFT GYR0

After setting the INS_HNTCH_* parameters I ended up with the following FFT:

The amplitude of the spike around 103Hz went from 0.52 to 0.014, may I assume that the notch filter is setup correctly?

After performing the previous steps the drone felt already much better during test flights. So the next thing I did was increasing the ATC_RAT_RLL_P/I/D and ATC_RAT_PIT_P/I/D by 20% by steps of 10% and again the drone felt more stable. So I stopped increasing the PID after increasing it with 20%. After all these steps it looks like the drone is glued to a position in mid air :sweat_smile:
here is a link to the video file:

The only thing I did additionally was decreasing the ATC_SLEW_YAW from 5000 cdeg/s to 3000 cdeg/s, PILOT_Y_RATE from 202 deg/s to 90 deg/s and ATC_ACCEL_Y_MAX from 16200 cdeg/s/s to 9000 cdeg/s/s because I noticed during manual modes and auto modes the yaw was very aggressive. Now it yaws smoothly. So in the end I have this .bin file:

I performed two AUTO mission without unexpected oscillating.
Here is a link to the video of the auto mission (simple mission, just or testing):

I have to mention that during the tests a wind of 11 mph and gusts of 22 mph where present. I know it is not ideally for tuning but the purpose of this drone is to fly in windy regions.

1 Like

Looks good.
I would set INS_HNTCH_REF,0.158

EDIT
when you are happy with tuning and HNOTCH is all OK you can set
INS_LOG_BAT_MASK,0
INS_LOG_BAT_OPT,0

1 Like

Thanks for the advice.
I had set the INS_LOG_BAT_MASK and INS_LOG_BAT_OPT to 0 when I was finished with the harmonic notch filter setup but I missed to change INS_HNTCH_REF.

1 Like

Hello everyone, I have the same problem with my drone, and I tried to set Ins_HNTCH_*, but the FFT GYR0 nothing changed, is there other parameters I need to set?
there is my flight test log!

Please start your own thread as it could be an entirely different issue