encoder uneven

The programming team has been recently been working on our PID loop but the encoder is not keeping it near steady at all. I will soon hopefuly post the code, can anyone give us some advice?

You’re much more likely to get useful answers if you provide useful information.

Have you looked at the output of the encoder and is it sufficiently noise free and accurate?

What device is the PID controlling?

Is the PID in cRIO or a Jaguar?

Speed, linear position, or angle?

What scaling are you using for the setpoint and process variable?

What encoder part number?

4x 2x or 1x ?

What are your P, I, and D gains?

etc etc etc

Have you looked at the output of the encoder and is it sufficiently noise free and accurate?
it is not noise free. that is the main problem.

What device is the PID controlling?
shooter drive motors. two jags, connected by a splitter cable

Is the PID in cRIO or a Jaguar?
cRIO

Speed, linear position, or angle?
speed

What scaling are you using for the setpoint and process variable?
all parts are -1-1

What encoder part number?
E4P

4x 2x or 1x ?
4x

What are your P, I, and D gains?
we are setting them. we varry p, while i and d remain at 0

etc etc etc
anything else?

What is the encoder speed? There is a limit to how fast the FPGA can count.

Try using 1x. You don’t need 4x for the high speed of a shooter wheel.

If that signal isn’t quiet enough, then do this:

instead of using GetRate(), read the encoder counts (still using 1x) instead, subtract the previous counts [see footnote] , and divide that by the sample time. Then scale appropriately.

anything else?

Yes:

What device is the PID controlling?
shooter drive motors. two jags, connected by a splitter cable

Are these identical motors, and are their outputs mechanically linked so they are at the same speed?

Is the PID in cRIO or a Jaguar?
cRIO

Home-brew or WPI library?

What are your P, I, and D gains?
we are setting them. we varry p, while i and d remain at 0

Speed, linear position, or angle?
speed

Are you integrating the output of the PID?

What scaling are you using for the setpoint and process variable?
all parts are -1-1

What do you mean by “-1 -1”

footnote: or do this: read the encoder counts, divide that by the sample time, then reset the encoder counts to zero. I don’t know how long it takes the encoder counts to overflow
*
*

that sounds good i will try that

I edited my previous post and added some more comments and questions. Please re-read it.

Are these identical motors, and are their outputs mechanically linked so they are at the same speed?
They are the same moters and they are both mechanically linked

it is WPI library

Are you integrating the output of the PID?
speed+=PIDshooter.get();
leftJag.set(speed);

-1-1 as from -1 to 1

I assume that PIDshooter.get() returns the output of your PID, correct ?

I assume leftJag.set() is the method which sets the output to your motor controller, correct ?

What is the range of the input that the motor controller is expecting ?

Do you need to clamp that to -/+1 ?

What is the speed of the device to which the encoder is attached ? (the FPGA has a counts/sec limit)

the jag is expecting -1 to 1, and it is receiving that amount

there’s no -/+1 clamp here, “speed” is being integrated without bound:

speed+=PIDshooter.get();
leftJag.set(speed);