Issues with PID for Flywheel

Many different things can cause this including a bad PID loop that oscillates or friction but it’s likely due to the following points you make

This does happen and in my experience a filter is extremely necessary when using any PID based flywheel control. I used a SMA where you take the average of the past n number of points but there is also Sylib which has more advanced filters and flywheel control.

For points 3 and 4 I’m going to explain to you what a feedforward control is for PID. What you have is very close but no quite there. Feedforward uses your equilibrium voltage (the rough voltage needed to maintain the desired speed and adds it to PID. Basically, you add the equilibrium voltage to kp*error so the flywheel will correct it’s error and recover faster.

Using bang-bang upto a certain threshold is a popular way of speeding up the flywheel faster.