PID Help

Currently, we have created a PID for our flywheel.
We are using this for barshots.
We have a 25:1 gear ratio with motors powered to 60 with torque gearing.
Although our PID complies, it does not make any difference.
Our second and third shots are always weaker than the first.
I have attached the code in block (easy c) and c programming.
And help would be great.
Thank you.


It may be that your PID does not have a quick enough recover time for bar shots. My team has found that for bar shots, Bang Bang is much quicker with recover times, and is also quick to code and test, so you might want to give that a try.

I’m sorry, I can’t see anything in the photos. What is your kp right now? Increasing that value should make the motors more sensitive to changes in velocity.

We are not sure that our program is correct, so kp kd and ki wont have an impact, right?

Here is the code again.

The code looks alright. Next time use the code tags (</> tag in the upper right hand corner of the comment box) so it’s easier to read.

Setting kp, ki, and kd to 0 will just send the motor power since you are multiplying your error by zero. Try changing kp to something higher, like 10, which hopefully won’t break anything. The flywheel should begin to oscillate around the target value.

Alright. Thanks.
Also, when i comply my project, it says that errorT MAY not be initialized.
Under that, it says that errorLast is NOT initilized, but it still lets me compile the project.
What is going on?