Hey Guys,
I’ve been working on tuning a PID control for a double flywheel system and I am having some troubles knowing what to change and how it affects the robot. I have attached a photo of a data graph I set up. The legend has the lines named based on each of the variables, P_I_D. it is showing the encoder velocity as a function of time. I don’t know why the acceleration is staying almost completely the same even when I change each of the variables. Any help would be much appreciated.

Note: I am using the built in RobotC PID so all of the variables are divided by 100.

When we shoot the balls. We tried to let it get close to settling then launch the next ball. Most of them went in but some went too far. The time in between shots is about 3.5 seconds

This is when you want to make a few more graphs of some more variables to see what is going on. I typically use time in milliseconds as the X axis versus just data point as you may be logging not exactly at the same intervals.

Make a second graph of the resulting motor power and see what effect the PID loop is having on the motor. if it is 127 then you’re giving it all she’s got captain. The knob doesn’t go to 11. This helps you see what more can be done.

Recovery times seems a bit long. How many motors and what is the gear ratio?

I like to log the error rather than the velocity or position. PID is generally looking to eliminate error to target value always and it will make your graphs from application to application similar but it is really a personal preference. They’ll look like the same shape.

What is the interval between readings and setting new motor values? Less than 20ms is not going to do much on the motor.

Some people in our club have been toying around with the effect of the shock to the system on the integral and derivative. When you see it went way down real fast, you are looking to get as much as you can back to the motor to speed it back up. But not too much to make big current spikes. The integral can take time to wind up and you may be capping it to not contribute all that much at the shock point. The D will be helping you in a case of sudden slow down as well as the P value since you are now far away. So is integral being low for a bit causing you to get you to a 127 motor value more slowly? Logging the contributions of the P I and D to the motor value can show you what is making things go awry.

I don’t see any overshoot so you are underdamped. You may be at 127 and that is the best you can recover. (see #1 & #2)

Thanks so much for the help! We have a target speed of 67 for the encoder velocity, or about 54 motor pwm. We are using four motor and a 24:1 gear ratio. The interval is 50ms. I’ll graph some more stuff tonight and see if that helps the recovery time.