How do I use absolute encoders on my Arm?

What are absolute encoders?

Absolute Encoders are encoders which read one rotation and persists between power cycles and reboots.

External Encoders

SmartMotorController s are only able to use the same encoders as the brand of the SmartMotorController. If you are using the wrong brand YAMS will through an exception.

Limitations of Absolute Encoders

Absolute encoders can only read from 0 rotations to 1 rotation. If you traverse the discontinuity point it will wrap back around. It does not travel past 1!

1

Check your inversions!

Using the hardware client of the vendor, apply positive power and graph the position of your absolute encoder. Your absolute encoder should increase with positive power

If it needs to be inverted you can use SmartMotorControllerConfig.withExternalEncoderInverted(true)

2

Check your gear ratio and mount!

Using the vendor hardware client ensure that the absolute encoder NEVER goes beyond 1 rotation. You will see that it goes beyond 1 rotation by the position wraps around from 1rotation to 0rotations. If this happens more than once the gear ratio is invalid and your SmartMotorController cannot use the absolute encoder as the primary feedback device.

You can use SmartMotorControllerConfig.withExternalEncoderGearing(1.0) to set the reduction gear ratio on the absolute encoder.

3

Find your zero

Using the hardware client of the vendor find the zero value of the absolute encoder corresponding the the arm being completely horizontal from the ground.

You can set the horizontal zero using SmartMotorControllerConfig.withExternalEncoderZeroOffset(Degrees.of(offset_degrees))

4

Bring it all together!

Last updated