For our robot, we have a grayhill optical encoder connected to a breakout board and I am confused about how I program it as it is not connected to any DIO input on the roboRio.
Well, that’s the first issue
Various models of encoders can have different wiring requirements. However, all quadrature encoders fundamentally should have two signals they output - usually named A and B. You’ll want to wire each of these up to their own digital input.
Then, since I see you tagged your post with
java, you’ll want to take a look at the Encoder class. You’ll notice it requires two integers - the ports you plugged A and B into.
I’ve heard that for programming grayhill encoders, our team is suppose to connect the data cable and the breakout board with the TalonSRXs as other teams have told us that DIO input is not necessary for using the encoders. Is this not true?
If you want to use closed-loop control features of the Talon SRX, then yes, you’d need to connect the encoder directly to it.
And for closed loop control of the TalonSRX, how do I make a grayhill encoder to turn to a specific position in my code?
Have you read the documentation?
I second reading the documentation and examples. Here’s a link to the relevant example: Position Closed Loop
The main difference from the example would be in your sensor type:
_talon.configSelectedFeedbackSensor(FeedbackDevice.QuadEncoder, Constants.kPIDLoopIdx, Constants.kTimeoutMs);