Using CANTalon in PercentVBus mode, can we also use getEncPosition?

Hi, we are currently using our Talon’s in PercentVBus mode for autonomous. Can we simultaneously use getEncPosition to obtain the total number of quadrature encoder counts since autonomous start? Will getEncPosition roll over at 4096?

I would have just tested this request but do not have access to a bot with encoders.

Thanks in advance.

Yes, sensor feedback is always available regardless of control mode. You can use the ConfigEncoderCodesPerRev() method to supply a scaling factor to get the position in units of your choice (ex. degrees, radians, inches travelled, etc.) if you don’t want to deal with counts.

The position for a quadrature encoder does not roll over; once you get to 4095 (for a 1024 code / 4096 pulse - in 4x mode - encoder, like the CTRE Mag Encoder) you will continue to 4096, 4097, etc. as you continue in the forward direction.

If you use an analog absolute encoder/pot or pulse-width sensor, the position would roll over (the CTRE Mag Encoder can be configured as either a quadrature or pulse-width sensor). You also would use different methods besides GetEncPosition() for these types of sensors.

This is all documented in the Talon SRX Software Reference Manual.

You can use the encoder accessor methods regardless of control mode.

To obtain the total number of quadrature encoder counts since autonomous start, you’ll need to store the initial value of the encoder at autonomous start and subtract that from the value you are getting during autonomous.

In the Talon SRX Software Reference Manual section 17.1.1 and 17.2.2 should explain what units you get from the API.

Edit: took too long to actually look up the api docs :’(

Thanks for all the replies. I think we are set.