I seem to be having a software issue when it comes to encoders listed above. I have a series of problems that occur when debugging.
1. The values from the encoder are increasing or decreasing based on whether the robot is enabled or not
2. The values from the encoder are all 0
3. The values of the encoder continuously decrease but stop decreasing when the motors are spinning
My team has ruled out any wiring issues.
We are programming in C++ via Windriver. All software is up to date. We are using the encoder class the the WPILib. I start the encoder in the robot init. Reset it upon entering tel-op. I retrieve the values via GetRaw(), Get(), GetDistance(), and GetDirection
Please let me know if anyone has had this problem and/or knows of a solution. Thanks!
When you put the code wheel on the shaft, make sure you install it correctly. The side with the pattern goes toward the sensors on the encoder circuit board. It should fit the shaft very tightly so it’s not going to slip. And you need to put it at the proper height off the board. Too far and it won’t be read properly. Too close and you risk damaging the code wheel as it scrapes on the mounting screws.
If you were programming in LabVIEW, you could try the Motor With Encoder example to verify the proper wiring. Since you’re using C++, that’s not an easy option. Can you tell us exactly how the encoder is connected? Where does each wire go? You say the team has ruled out wiring issues, but that doesn’t mean the team is correct.
I’m pretty sure the encoder is installed correctly. As for wiring the first wring plugging into the encoder is orange and plugged into a PWM cable for the Digital sidecar. The second wire is blue hooked up to the signal wire of the PWM cable. The third wire is brown and connected to the ground part of the PWM. The fourth wire is yellow and hooked up to a standalone wire connected to the signal port of another slot on the digital sidecar. The PWM is connected to slot 5. The standalone signal wire is slot 7. I have made sure the code matches up with the port numbers they are plugged into