Explanation of the math for moving the sled?

This is accomplished by the equations that @Joshua was asking about, where the straight chain length is calculated from the motor distance and sprocket radius. I found it was cleaner to accomplish it this way than to try to translate the motor position into a constantly moving point on the sprockets.

The chain angle is calculated based on the exit point from the sprocket, which is why the chain angle equations are different for the chain on top versus the chain on bottom configurations.