# How do I program an X drive if one of the motors is slower than the rest? Is there a way slow the other motors?

Hi I don’t know if this has been answered before but I can’t find any info on the matter. Is there a way to slow down the motors on an X drive while it uses a joystick? This is due to one slow motor in the drive. (Also I program in VCS vex c++)

I am really surprised that you are having this issue. Are you sure you don’t have additional friction or a bent axle on that motor?

Nonetheless you could add a decimal ratio to each of your motor assignments and slow down the other three motors.

Basing on this example: holonomic-programming which I have not tested…

``````double ratio1 = 0.75;
double ratio2 = 0.75;
double ratio3 = 0.75;
double ratio4 = 1.0;

void usercontrol( void ) {
while (1) {

//...joystick code...

m1 = ((joy_1_y) + (-1 * joy_1_x) + (-1 * joy_2_x))      * ratio1;
m2 = ((-1 * joy_1_y) + (-1 * joy_1_x) + (-1 * joy_2_x)) * ratio2;
m3 = ((-1 * joy_1_y) + (joy_1_x) + (-1 * joy_2_x))      * ratio3;
m4 = ((joy_1_y) + (joy_1_x) + (-1 * joy_2_x))           * ratio4;

Motor1.spin(vex::directionType::fwd,m1,vex::velocityUnits::pct );
Motor2.spin(vex::directionType::fwd,m2,vex::velocityUnits::pct );
Motor3.spin(vex::directionType::fwd,m3,vex::velocityUnits::pct );
Motor4.spin(vex::directionType::fwd,m4,vex::velocityUnits::pct );