Currently the hopper lift controller uses a CTRE mag encoder set to quad encoding mode (note that this code is not present in 2021 code as of writing, but is in 2020 code) in order to do closed loop control. This is necessary in order to get an absolute position of the hopper lift "arm" upon boot without some sort of calibration function or hardware limit switches or other solution which would allow the robot to "feel around" for the limits of movement.
This works great, but at high speed and in situations where greater precision is necessary it is best practice to "seed" the initial position of the hopper arm upon boot using PWM's exact position, but then switching over to quad encoding and applying an offset based upon the initial value. This way, the robot gets the speed/precision of quad encoding mode and the absolute position from PWM mode.
Currently the hopper lift controller uses a CTRE mag encoder set to quad encoding mode (note that this code is not present in 2021 code as of writing, but is in 2020 code) in order to do closed loop control. This is necessary in order to get an absolute position of the hopper lift "arm" upon boot without some sort of calibration function or hardware limit switches or other solution which would allow the robot to "feel around" for the limits of movement.
This works great, but at high speed and in situations where greater precision is necessary it is best practice to "seed" the initial position of the hopper arm upon boot using PWM's exact position, but then switching over to quad encoding and applying an offset based upon the initial value. This way, the robot gets the speed/precision of quad encoding mode and the absolute position from PWM mode.