To navigate complex environments, walking animals must detect and overcome unexpected perturbations. One technical challenge when investigating adaptive locomotion is measuring behavioral responses to precise perturbations during naturalistic walking; another is that manipulating neural activity in sensorimotor circuits often reduces spontaneous locomotion. To overcome these obstacles, we introduce miniature treadmill systems for coercing locomotion and tracking 3D kinematics of walking Drosophila. By systematically comparing walking in three experimental setups, we show that flies compelled to walk on the linear treadmill have similar stepping kinematics to freely walking flies, while kinematics of tethered walking flies are subtly different. Genetically silencing mechanosensory neurons altered step kinematics of flies walking on the linear treadmill across all speeds. We also discovered that flies can maintain a forward heading on a split-belt treadmill by specifically adapting the step distance of their middle legs. These findings suggest that proprioceptive feedback contributes to leg motor control irrespective of walking speed and that the fly's middle legs play a specialized role in stabilizing locomotion.