Gantry motor control