I know this may seem obvious to some, but I finally figured out why my encoders didn’t work. Since joining this year and not knowing which products had been used from the former robotics team at my school, the optical encoders would not respond to the sample encoder program. After one month of frustration, I gave up.
Then I picked them up one day and thought I wonder what these look like inside. They were VERY dusty! So I took out the disk and blew off the dust and used a q-tip to clean the sensors. IT WORKED! I could not believe it and my autonomous mode will greatly benefit.
So if you have problems with them. Clean the disk and sensors!