Holonomic Control

Hey There! I was trying to create a custom control code for my holonomic drive(4 motors/specific code for each motor), I used ch1-2 for strafing ch3 for forward/backward and ch4 for turning it worked well but I wanted to stop ch3 from functioning(forward/backward) and use 5D and 6D buttons instead so I eliminated ch3 code lines and wrote my own code, I noticed that when I turn my robot(Ch4) using the first code everything runs smoothly but when I try doing it using the second code the motors lag and go slowly. Could it be because I am using a channel and two buttons for going forward and backward? How can I fix this? Thanks in advance

There’s no reason you cannot do this.

A simple X-Drive algorithm may be as follows.

void drivetrain()
{
  int forward = vexRT[Ch3];
  int turn    = vexRT[Ch1];
  int right   = vexRT[Ch4];

  motor[frontRight] = forward - turn - right;
  motor[backRight]  = forward - turn + right;
  motor[frontLeft]  = forward + turn + right;
  motor[backLeft]   = forward + turn - right;
}

To change the forward/backwards motion to buttons you could do something like this.

void drivetrain()
{
  int forward = (vexRT[Btn5D] - vexRT[Btn5U]) * 127
  int turn    = vexRT[Ch1];
  int right   = vexRT[Ch4];

  motor[frontRight] = forward - turn - right;
  motor[backRight]  = forward - turn + right;
  motor[frontLeft]  = forward + turn + right;
  motor[backLeft]   = forward + turn - right;
}