We want to use encoders on our lift but have moved to a CIM motor. Our controller is Victor SPX.
If you use a CANifier, yes. However, in forwarding your encoders through the CAN bus, you’re introducing a lot of latency, which can make your control loops less reliable and optimized. I’d recommend either using a controller with a sensor input like a Talon SRX or Spark MAX, or running the encoder to your RoboRIO and doing control loops RIO-side.
I’m interested in the encoder running to the RoboRio and controlling loops RIO-side. How does that work? I’m new to using encoders. The encoder attaches to the shaft of the robot and then is plugged into the RoboRio and bypasses the motor controller?
This is correct.
Instead of the motor controller taking the encoder input directly and setpoint from the Rio (running the control loop on the motor controller), you can plug the encoder input directly into the Rio, run the control loop (onboard the Rio), and then output something like a percent output to the motor controller.
I’d also recommend using a motor controller with a direct sensor input as it can simplify your code, take load off of the Rio and reduce latency.
What encoders do you like to use? We definitely want to simplify our code because we are rookies, so what controller would you recommend that take direct sensor input? I thought the Victor SPX can but I’d have to check.
Regarding motor controllers that can take a direct sensor input, @solomondg mentioned the two I am aware of, the Talon SRX and Spark Max.
You can generally tell if you can plug a sensor directly into the motor controller if it has a sensor port on it.
The Talon SRX port is under a retaining clamp to prevent it coming loose during use:
Whereas the Victor SPX does not have this external sensor port:
I’ll take some photos of how one of our mechanisms work (motor controller and encoder) this evening.
The sensor port on the Talon SRX can also have limit switches plugged into it and it will (if setup) automatically not let you run the motor in the direction that triggers the switch. eg running an elevator more than all the way up.
Regarding encoders, we mostly only use the SRX Mag Encoder on our drive train or we use a VersaPlanetary Integrated Encoder which is just another slice that we add to a planetary gearbox.
Both these encoders plug directly into the Talon SRX using a data cable.
You can also wire an encoder into a Canifier which will allow the Victor SPX to use a remote sensor however I have not used the Canifier before.
Sorry, I completely forget that you were already using a CIMcoder. To plug that directly into a Talon SRX you could use an Encoder Breakout Board however for the Victor SPX to use the sensor, running an onboard control loop, you would need to either wire it into a Canifier, or, another motor controller.
@bsimmons
Are those limit switches soldered onto the back of the encoder? Where do the white and black wires go?
Yes, the Talon SRX User’s Guide has the pinout for the data port.
We figured there was nothing stopping us from using an encoder AND limit switches on the same port. Since the VersaPlanetary Integrated Encoder is really just the SRX Mag Encoder with an adapter, the Magnetic Encoder User’s Guide has a breakout for the forward and reverse limit switches on the back of the encoder.
We just soldered wires for the limit switches onto this.
The yellow and black (reverse) pair and black and white (forward) pair will be connected to the limit switches. Currently however, the switch for the black and white pair has not been mounted and the wires are just bundled up.