Vibration of aircraft in LOITER mode

Hello. I made a quadrotor with firmware 4.1.4.
Flying in ALTHOLD was not a problem, but in LOITER mode, it vibrates left and right.
The actions I took included calibrating the motor, replacing the battery, changing from EKF3 to 2, PID tune, downgrading to firmware 4.0.7. But it was not resolved.
VIBE, ALT, BATT, GPS, COMPASS, MOT OUTPUT in the log are shown as normal. However, it was confirmed that the IMU X vibrates as soon as it enters the LOITER mode.
What is the cause and how can I fix this problem?
I have attached the log.
Lastly, I am always grateful to those who work hard for a better model.

ATT.DesRoll and ATT.Roll

IMU[0].GyrX,Y,Z

VIBE[0].VibeX,Y,Z

drive.google.com/file/d/1mExMTNSjQZhKlZwPpS3UgyNVWwb9PUIk/view

Have you got a photo of how that V5 Nano is mounted?

MOT_SPIN_MIN,0.15 is greater than MOT_THST_HOVER,0.1384806 so I would set MOT_SPIN_MIN to 0.13 or 0.12 and ensure props still turn reliably at that percentage in MissionPlanner motor test.
Maybe even set MOT_THST_HOVER to 0.2 and let it relearn again in ALTHOLD mode. Set up Stabilise as a flight mode too, in case you need to take control.

Set these up for the Harmonic Notch Filter
INS_LOG_BAT_MASK,7
INS_HNTCH_ENABLE,1
Do a test flight in ALTHOLD for a while, mainly hovering, and let’s see that log.

You should also be able to change back to using EKF3
EK3_ENABLE,1
EK2_ENABLE,0
AHRS_EKF_TYPE,3

These things won’t solve the issue right away, but with the next log we’ll be able to see more and maybe the HNOTCH filter will help a lot once it’s configured correctly.

EDIT
The vibrations all look OK.
It looks like there’s a pitch and roll oscillation introduced by PIDs when changing to Loiter and the FC is trying to hold a precise position.
In another post I suggest changing some position controller params first
You could try these and see if it gets better or worse, they are not much different to yours now - but do a cautious take off and look for any oscillations in Stabilise or Althold before trying Loiter.
ATC_RAT_RLL_P,0.1
ATC_RAT_RLL_I,0.1
ATC_RAT_RLL_D,0.00625
ATC_RAT_PIT_P,0.1
ATC_RAT_PIT_I,0.1
ATC_RAT_PIT_D,0.00625
Those D terms might even need to go back down to 0.004

You might be able to sneak these up to 5 or 6 too, but maybe wait till after we set the Harmonic Notch Filter
ATC_ANG_RLL_P
ATC_ANG_PIT_P

Your motor outputs are oscillating badly. What Shawn suggested (latest Copter Stable and EKF3 for sure) and set these to recommended values bas on MOT_THST_HOVER.
PSC_ACCZ_I
PSC_ACCZ_P

Actually before changing your PIDs (but do the other stuff Dave and I suggested) check these.
I know it can be a bit of tedious work, but if you could change them one at a time and let us know the difference (if any) that would be great. I haven’t got anything here to test fly right now.
I’ll see what I can do with SITL.

PSC_VELXY_P,2 Velocity (horizontal) P gain. Converts the difference between desired and actual velocity to a target acceleration Try decreasing to 1.5 or 1.0

PSC_VELXY_D,0.5 Velocity (horizontal) D gain. Corrects short-term changes in velocity Try increasing to 0.75 or 1.0

PSC_JERK_XY,5 Jerk limit of the horizontal kinematic path generation used to determine how quickly the aircraft varies the acceleration target Try lowering to about 3 or 2

Thank you for the reply.
I flew 3 times today, and the table below shows the parameters changed for each trial.
캡처

Mounting pictures of the V5 Nano

first flight log
https://drive.google.com/file/d/1NDZFR_o0FNwhtHbVRwAv0TtN74fYUD6S/view?usp=sharing

second flight log
https://drive.google.com/file/d/1EjBWm9azBS7yf9n0J7JUOfcqcnHlQwKT/view?usp=sharing

third flight log
https://drive.google.com/file/d/1Z3moGTbcdJjmNdr57XNbiRLqopK3pd16/view?usp=sharing

As a result, unfortunately, there was no change. I will post the results again after replacing FC.
Thanks for your interest in my problem :grinning:

The FC should be fine, we’ve used the V5 Nano on a similar mount with great results.
I’ll check over those logs.

First try these HNOTCH settings and do a short test flight
INS_HNTCH_REF,0.13
INS_HNTCH_FREQ,44
INS_HNTCH_BW,22
INS_LOG_BAT_OPT,2
The Harmonic Notch Filter should be working OK with the above settings, that should help a lot.
And these can go back to standard
PSC_JERK_XY,5
PSC_VELXY_D,0.5
PSC_VELXY_P,2

EDIT - dont change these in italics, skip to the next section in bold
Then if there’s still an issue I would try these params:
ATC_ANG_RLL_P,6.0
ATC_ANG_PIT_P,6.0
ATC_RAT_RLL_P,0.12
ATC_RAT_RLL_I,0.12
ATC_RAT_RLL_D,0.004
ATC_RAT_PIT_P,0.12
ATC_RAT_PIT_I,0.12
ATC_RAT_PIT_D,0.004
Take off cautiously and watch for oscillations, as what I’m suggesting is a reasonable change in PIDs compared to what you had. If everything seems OK try Loiter but be prepared to switch back to AltHold like you did in log3.
If there’s big oscillations you could reduce ATC_ANG_xxx_P to 5

Definitely put in the HNOTCH settings as above, but also there is some change to the strategy

For the next flight set this to log PIDs
LOG_BITMASK 196606
Do a test flight and save the log

then in another flight set this PSC D term to 0 and halve the others
PSC_POSXY_P 0.5
PSC_VELXY_D 0.0
PSC_VELXY_I 0.5
PSC_VELXY_P 1.0

Let’s see the log from each of those.

These are not the cause of your vibration/position issue, but I would check these anyway:

Take a close look at you current sensing, it moves in the wrong direction compared to voltage.
Also your 5volts dc (Vcc) is a bit low, does it come from the CUAV PM module or some other BEC?
Set the rest of the voltage-related params:
BATT_ARM_VOLT,22.10
BATT_CRT_VOLT,21.00
BATT_FS_CRT_ACT,1

See changes to the replies above