I have just been tasked with building software to have the autonomous programs adjust key parts of the program (distances, pid loops, etc.) so we don’t need to change the program for every change of the drive train. Our bot uses 2 cims with mini toughboxes on each side. Our encoder is a cimcoder, directly mounted to one cim on each side. We program in Labview, so I have just been using the Get encoder distance function and preset goals for autonomous.
use encoders on the gearbox output and calculate distance from there
2.use the CIMcoders on your motors and multiply the distance they output by a scale factor which would be your gearbox ratio.
I’m not exactly sure, but i would assume you would take the gear ratio and make it into a decimal and multiply that by the speed of the motor without any gearbox.
But i guess you could also base it off the difference from the current ratio.
Make all of your constants settable via NetworkTables.
Make a display to tune your constants.
Make that display save to a file.
When the robot turns on, load the constants from the file and send to the robot.
BAM! No more programming PID values and wheel sizes - just tuning from year to year ;).
We just calibrate directly to the distance being travelled by the actual robot (e.g. the wheels).
We reset the encoders, push the robot forward X feet, and count how many ticks T each of the encoders measured. Then we save the constant T/X and use that multiplier to figure out what encoder values are needed to travel any arbitrary distance. We do this separately for two encoders on the left and right side of the drivetrain, to account for minor variations.