How to correct left-right difference in drive train

Our drive train has an issue: when telling both sides to go forward at the same voltage for a period, the left side moves less distance than the right side.

We have 3 CIM motors on each side, in a “West Coast” configuration, each connected to a CAN Talon SRX motor controller. In the code (using java), for each side we have 2 motors set as slaves to follow one master motor, and we are sure (90% sure) that each motor is being run the correct direction and that none are disconnected (but we should double check).

With the robot on the ground, we told both sides to go forward at 50% voltage for 5 seconds. We recorded the distance the left side and right side drove using the encoders after the 5 second run, then reset the encoders.

We repeated this process 3 times for each direction, going forwards - measuring - backwards - measuring - forwards - etc. Then we averaged the ratio of the left distance divided by the right distance to get a number we’ll call the scaling factor (it was about 96%). Then when sending the output voltage to the master motor for each side, we do

leftMaster.set(output); 

rightMaster.set(output * scaling factor);

This fixed the problem for the most part, but I would like to know other / better ways to fix this (programmatically and mechanically and electrically).

For auto commands, we also used the encoders to keep going straight by keeping track of the left error - right error difference from a setpoint (only if the left and right encoder setpoints were the same). We multiply the difference in error by a proportion then add / subtract this proportion from the left / right sides. This works decently as well. Still wondering if there are better ways to fix this / ways to fix it permanently.

Encoders.

Put encoders on both gearboxes, and drive them with speed profiles.

The simplest way with the SRX is to feed the encoder back to one SRX on each side, and drive those two SRXs using motion magic. The other four SRXs should be placed in “follower mode” to follow the SRX on the same side of the drive train connected to the encoder.

If you were using PWM controllers, the answer would be logically the same, but the implementation would require a bit more code - a PID loop on each side and manually keeping the two “slave” controllers up with the “master” on each side.

Nearly 100% of this unbalance is related to different lengths of wiring in the two sides. PDP is best oriented in the center of the robot to keep drive train wiring the same length. Without encoder feedback this is the only way to fix your issues and make it easier for the driver to handle the robot in teleop.
If your drive is pushing the controllers to near max current, #10 wiring will drop 0.1 volts per foot and #12 wiring will drop 0.2 volts per foot. That is for both the red and black wiring.