1 stick arcade drive

I am changing my drive code from tank drive to arcade because I need my other hand to do other stuff so want a 1 stick arcade drive, which I don’t know how to do. here is my drive code (sorry about the formatting).

[code]
Left_front.spin(vex::directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis4.value()), vex::velocityUnits::pct);

Right_front.spin(vex::directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis4.value()), vex::velocityUnits::pct);

LeftRear.spin(vex::directionType::rev, (Controller1.Axis3.value() + Controller1.Axis4.value()), vex::velocityUnits::pct);

RightRear.spin(vex::directionType::rev, (Controller1.Axis3.value() - Controller1.Axis4.value()), vex::velocityUnits::pct);

[code]

Assuming you aren’t using a holonomic drive, the front and rear wheels for each side should have identical parameters for the spin function.
I’ve modified your code slightly so that it should work.

Left_front.spin(vex::directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis4.value()), vex::velocityUnits::pct);

Right_front.spin(vex::directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis4.value()), vex::velocityUnits::pct);

LeftRear.spin(vex::directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis4.value()), vex::velocityUnits::pct);

RightRear.spin(vex::directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis4.value()), vex::velocityUnits::pct);

Keep in mind that with this program, while everything should behave as intended when driving forwards, the robot may not drive as you expect it to when driving backwards, as it will drive backwards and to the left if you have the stick in a bottom right position and vice versa. It takes some getting used to, but it should start to feel natural with time. Alternatively, I’m sure there is a way to write a slightly more complex program that accounts for this quirk.

1 Like

you could multiply Controller1.Axis4.value() by the sign of Controller1.Axis3.value() like this:

Controller1.Axis4.value() * 
    (std::abs(Controller1.Axis3.value()) / (Controller1.Axis3.value() == 0 ? 1 : Controller1.Axis3.value()))
2 Likes