A question about Falcon 500's encoder

We all know that Falcon 500’s encoder is integrated. However , does it have ecnoderchannel A and encoderchannelB . If not , how to use Falcon 500’s encoder ?

Any answer will be appreciated.

When using integrated encoders, you do not have to create an Encoder instance. You can reach the encoder through the motor controller. In your case, TalonFX is your controller. After you define your controller, you can use motor.getSelectedSensorPosition() to get encoder position. You might wanna look at this and this as well.

1 Like

To tack on some background of “why”:

The A/B channel architecture is generally driven by some mechanism (optical or mechanical) which interrupts an electrical signal at a regular rate. The rate and pattern of interrupting is dependent on the rotational speed and direction of the attached shaft. By having the right digital circuitry on the receiving end, information about the rotation can be deduced from the electrical signals.

Most importantly, the A/B architecture is driven by keeping the electronics in encoder simple.

However, the fact that the Falcon500’s encoders are internal means they can internalize that conversion circuitry, and simply present the measurements back to the user (no need for the user to need to deal with the A/B phase wiring). Additionally, there are other hall-effect sensing technologies which have different electrical circuitry requirements - the Falcon might be using these, though I’ve not yet found documentation indicating what they’re using if so.

However, none of that matters - the key concept is that because the Falcon can internalize a lot of the circuitry, it knows its own assumptions, and can simply return measurements to the user.


Thanks , if l setsetSelectedSensorPosition(0) , does it means that the encoder will calculate from 0 ?

So,if l use TalonSRX , l need to buy a encoder and wire it on my robot. But , how can l change the ID for channalA and channelB.

The TalonSRX has a port for a sensor input, most commonly an encoder. If you connect an encoder to the TalonSRX then you don’t have to mess with A and B channels and you access the data through getSelectedSensorPosition(). If you connect the encoder to the RIO then the TalonSRX has no access to it, and you’ll have to construct an Encoder instance as usual according to the DIO ports you plugged the encoder into.

As to the question where to connect the encoder - you’ll want to connect the encoder to wherever your control loop is running.

If l connect the encoder to talonSRX, how can l use it? Just use motor.getselectedsensorpostion? Just like this?

That’s correct. Check CTRE’s docs to find the rest of the API for units and scaling them.
However, if you’re not running the loop on the Talon, I would connect the encoder to the RIO - transferring the data over CAN adds ~20ms of latency. If you are, you don’t necessarily need to read the encoder data from your code.

l can still use the Phoenix Tuner to set its id? Do l need to load new firmware on the encoder?

The Talon SRX user guide is where I would start.

Section 1.4.3 indicates how to wire up an encoder.

CTRE’s software manual is also useful

Section 7.5 describes external encoder (and encoder-like devices) inputs.

As a sample, we used quadrature encoders and Talon SRX’s on our drivetrain in 2019. I don’t know if this code will still work with the most recent CTRE libraries, but here it is for reference at least.

Thanks and l will study it soon!

Sorry to bother you again. If l wire an encoder to talon srx. And l want to use its analog input. It seems that l need to know which port Id it uses . Is the port id the same with the talosrx’s port id?

I have not tried that permutation unfortunately. I am unsure what the answer is.

That’s OK. Thanks.