speed by encoder

In our everlasting wisdom we have decided that trying to maintain shooter precision. To do this we are trying to take output from an encoder in 100 millisecond samples. Is this even feasable? How would we accomplish this?

Read the encoder in a 10Hz thread.

Did you try reading the encoder in TeleOp (50Hz)? If so, why was that not satisfactory?
*
*

Or you can use the encoder as the sensor for the PID class - the PID class will start a timer and sample the encdoer regularly for you at 50Hz I think

Our team is reading the shooter speed from an optical encoder and applying PID control on the shooter speed. So it is possible. We are using Jaguars on CAN bus, so we connected the encoder directly to the Jaguar. Our PID control reads the shooter speed from the Jaguar and calculate the motor output power using our PID controller.

It is working quite well. The only issue we have is that one of our mentors have a strobe light and decided to check the shooter speed with it. It came out different from our encoder reading. For example, if we set the shooter speed to 3000 RPM (and reading approx. 3000 RPM on the encoder), the strobe light said it was 2400 RPM. No matter what speed we read on the encoder, the strobe light seems to read a percentage lower than the encoder. At first, I questioned how accurate is the strobe light? But the mentor who provided the strobe light said he had sent it in for calibration and just gotten it back, so it is calibrated. So I am entertaining the idea that we did not read the encoder correctly which is possible since this is our first year playing with the Jaguar and the encoder is connected to the Jaguar. So here is our question: Did we configure the Jaguar correctly regarding the encoder?

When configuring the Jaguar, we set it to PercentVbus mode. We also called ConfiguEncoderCodesPerRev() with 360 (we have a 360-line optical disc on our encoder). Then we called SetSpeedReference() with kSpeedRef_QuadEncoder. Our question is: why do we need to specify kSpeedRef_QuadEncoder in SetSpeedReference and what is the difference between kSpeedRef_QuadEncoder and kSpeedRef_Encoder? My understanding of the difference is that quadrature counts both rise and fall edges of the encoder pulse for both channels A and B so it is “more accurate” but since the GetSpeed() function will scale the output according to quad or non-quad, from the caller’s point of view, it should have no difference. Am I understanding this correctly?