How to make basic TANK controls on an X DRIVE

I looked on the forums and I could only find how to do this with mech wheels. I hate arcade control (no offense) and I want to have the left stick move the left side of the robot and the right side controls the right. Then, I can move the joystick to the left to make it go left and then use the space in between up and left to strafe in 8 degrees of motion.

Because an X drive moves all-wheels forward to go forward, I was trying to figure out how to get the illusion of if the left joystick moves the robot goes right, etc

Well meccanum programming is pretty similar to X-Drive programming I would assume since without thinking of the wheels, you have the motors move in the same directions to strafe, move forwards and backwards, and turn. Try using the code for the meccanum wheels you found.

1 Like

mechanum and x drive code is essentially the same

2 Likes

But I want the driving to not have a rotation stick and a direction stick, I want it to feel like a TANK drive. I have found absolutely nothing on how to achieve this. Is the only way to achieve this grouping areas of the joysticks as spots and when I reach those spots move in a certain way? This sound clunky though.

I believe this should work, but I haven’t tested it so maybe not:

frontLeft = joystick.leftY + joystick.leftX; frontRight = joystick.rightY - joystick.rightX; backLeft = joystick.leftY - joystick.leftX; backRight = joystick.rightY + joystick.leftX5;

NOTE: This also would have the effect of the front driving forward and the back driving backward, pulling the robot apart, when both joysticks are moved to the middle. probably not a big deal though.

The tank drive code that you found for a meccanum drive will work with the X drive.

Rather than just giving away code, I like to explain the concept behind it:

For any type drive, I like to look at each wheel and figure out which joystick axes I want to control it. It sounds to me like you want normal tank drive with side to side movement also specific to each side. (This is my favorite x-drive control scheme!) For instance, for the back left wheel, it should be affected by the left Y axis and the left X axis. Next, figure out which way each one should make it go. For the back left, (assuming positive = forward), then up on the y means positive, and right on the x mean negative. So the line for the back right would look like:

backLeft =leftY - leftX;

Hope this helps.

2 Likes