Tuning help in Position Hold

Hello! I am tuning an indoor drone. I have tuned the drone to be stable which holds position but it continuously move around in 10 cm radius. I will explain the setup and my initial analysis.

Setup:
My drone looks like this. It is in X configuration, dimensions are 1 meter approx and motors are of good quality. Sensors: IMU, Optical Flow, Rangefinder and baro. I have not used compass since it is in indoor environment. I am aware that yaw will drift, but I have filtered gyroscope more which allows it to hold yaw for few minutes. Upon landing EKF variances occur, but in flight there is no such problem encountered.
My ardupilot version is 4.0.1. The version of 4.1.1+ doesn’t let me arm.


The red square is the above image is battery.

Experiment:
I take off in althold and switch to loiter. Sticks are left free.
Log Name: Loiter

Second experiment is in guided mode for autonomous run.
Log Name: Guided

Analysis

Visibly, the drone is quite stable but not ideal. I want to understand if this is the limitation of the controller performance or some other issue which I am not aware of. The angle controller performs good; atleast in althold. The velocity controller as seen in below figure, has a lot of delay. In my opinion, if the delay is somehow minimized then the controller will perform faster and I can improve performance.

Extras:
I added logging for desired and target variables in velocity controller which is not included in log. The desired velocities and accelerations were zero when sticks were in middle position. Thus this is purely on Velocity PID rather than feedforward. If my understanding is true, this is how it is supposed to function.

Estimation is correct. I have tried holding the vehicle and moving around. The readings were in range of 0.01 meters accuracy.

I changed Input_TC ranging from 0.1 to 0.4, Velocity PIDs, Position P gain and the estimator parameters. I tried a lot of gains, but I can’t seem to improvise any further.

Question:
How can I make the position and velocity controller more tight?

TLDR
Position hold is good, but I want to understand what is restricting it to improve further. Specifically there is a delay in velocity control.

@Leonardthall your insights on control will be much appreciated.

Thanks!

@TLDR : Fix the reason why it won’t arm first. Use ArduCopter 4.1.5

1 Like

I assume this is a small quad. Your filter settings are more appropriate for a 250 kg quad. If you want the best position hold performance you need the best tune.

Thank you for you reply.

The motive here is to understand the reason why velocity PID is not following without delay and what effort can be made to mitigate that. The same problem is encountered on other drone as well. If you want, I can upload log of a version with 4.1.1 with slightly different yet similar problem.

No, we do not need logs form 4.1.1. We need logs from 4.1.5

Yes this is a small quad. A 3 kg quad with 0.5 meter arm length to be precise.

Are you implying that this is filtered too much? Should I increase cutoff frequencies across all controllers?

Reduce the hardware vibration, instead of covering it up using software filters.

Yes your point is absolutely correct.

However, according to documentation, normal vibration levels are 15 m/s/s. I think the vibrations on this vehicle are far less. I am attaching the vibe levels from the log

It looks like you have not followed this:
https://ardupilot.org/copter/docs/tuning-process-instructions.html

INS_GYRO_FILTER 10 is off (too low). Also your craft is underpowered/overweight and it looks like you Autotuned with an aggression of .05. This can produce a poor tune which you certainly have.

6S battery power, what’s the prop size?