Help with holonomic drive code

Hello everyone,
I have seen that the o-drive style of robot is very popular. I have tried to build one but the programming has seen better days. If somebody could share code with us that would be great or any comments or changes that you recommend would be greatly appreciated. Below is our current code.
Thanks in advance,
Nick

#pragma config(Motor, port2, frontLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, backLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, backRight, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, frontRight, tmotorVex393_MC29, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main()
{
while (1==1)
{
motor(frontLeft) = vexRT[Ch3];
motor(frontRight) = vexRT[Ch3];
motor(backLeft) = vexRT[Ch3];
motor(backRight) = vexRT[Ch3];
motor(frontLeft) = vexRT[Ch2];
motor(backLeft) = vexRT[Ch2];
motor(frontRight) = vexRT[Ch1];
motor(backRight) = vexRT[Ch1];
if(vexRT[Btn8L] ==1)
{
motor[frontLeft] = 127;
motor[backRight] = 127;
}
else if(vexRT[Btn8L] ==0)
{
motor[frontLeft] = 0;
motor[backRight] = 0;
}
if(vexRT[Btn8R] ==1)
{
motor[frontLeft] = -127;
motor[backRight] = -127;
}
else if(vexRT[Btn8R] ==0)
{
motor[frontLeft] = 0;
motor[backRight] = 0;
}
if(vexRT[Btn7L] ==1)
{
motor[backLeft] = -127;
motor[frontRight] = -127;
}
else if(vexRT[Btn7L] ==0)
{
motor[frontRight] = 0;
motor[backLeft] = 0;
}
if(vexRT[Btn7R] ==1)
{
motor[backLeft] = 127;
motor[frontRight] = 127;
}
else if(vexRT[Btn7R] ==0)
{
motor[backLeft] = 0;
motor[frontRight] = 0;
}
}
}

Sorry… but what’s a o-drive?

I was thinking he meant an X drive.

sorry i didn’t realize that it was called holonomic drive we called holonomic drive o-drive because it was easier to say

@Nick_S Do you want to control your drive with the joysticks or with the button pad? You have a really terrifying amalgamation of the two, and neither are setup in a way that works well. A good start would probably be to choose one or the other.

X-Drive or Holonomic X-Drive is probably the best way to refer to this drive system. Holonomic is a pretty general term which applies to Mecanum drives as well as a couple of others.

https://vexforum.com/t/holonomic-drives-2-0-a-video-tutorial-by-cody/27052/1

preferably joysticks

to clear up any confusion this is what im talking about

First, be careful with () v. ]. You’re not consistent.

It looks like you want joystick control. Delete all those motor controls. Make four lines, each as roughly

motor[one_motor]=vexRT(Ch#)+vexRT(Ch#)+vexRT(Ch#)

Those could be + or -, depending on the axis.

I’m on a cellphone with minimal time, so that’s all I can do for now.

I really enjoyed working out the exact combination of plus and minus to get where i wanted. It was a fun thing to figure out experimentally.

We had a loop, and inside four motor commands set equal to the sum of the three joystick channels we were going to use. Add in a multiplier for each joystick. For each one, set the one channel you are interested in to a multiplier of 1, and then the other two to multipliers of zero.

Loop{

Motor(FL) = (0 * LV) + (0 * LH) + (1 * RH)
Motor(BL) = (0 * LV) + (0 * LH) + (1 * RH)
Motor(FR) = (0 * LV) + (0 * LH) + (1 * RH)
Motor(BR) = (0 * LV) + (0 * LH) + (1 * RH)

}

Here i used LV as Left Vertical, RH as Right Horizontal, etc.

If you know what you want each joystick to do, debug that joystick one motor at a time (change the multiplier to -1 as necessary. Once you do all three joysticks, it will be ready to go.