Program with one Joystick in VCS

So, my other teammates use two joysticks for the drive train of the robot. But I want to make a program that it only uses one joystick for the drive train. For your info, my team’s robot uses four motors for the drive train.

Obligatory mention of “VCS is no longer supported, you should move to VEXcode v5 text”.

“Single-stick arcade” is the name of the control scheme you’re looking for. See this thread:

If your teammates already use split (i.e., two-stick) arcade drive, then moving to single stick will be as easy as changing which joystick’s horizontal axis you’re reading.

5 Likes

I meant VEXcode V5 text

2 Likes

Also, when I use the exact coding from the link, the turning doesn’t work.
What now?

Could you please post the exact, complete program you are having trouble with (remembering to wrap it in [code]...[/code] tags for formatting)?

Also, could you elaborate on “the turning doesn’t work”? What does the program do, and how is that different from what you want it to do?

1 Like

Sorry about that. I did the beginning like this after setting velocity:

int main() { while(true){ leftFront.spin(vex::directionType::fwd, Controller1.Axis2.position(vex::percentUnits::pct) + Controller1.Axis1.position(vex::percentUnits::pct), vex::velocityUnits::pct); leftRear.spin(vex::directionType::fwd, Controller1.Axis2.position(vex::percentUnits::pct) + Controller1.Axis1.position(vex::percentUnits::pct), vex::velocityUnits::pct); rightFront.spin(vex::directionType::fwd, Controller1.Axis2.position(vex::percentUnits::pct) - Controller1.Axis1.position(vex::percentUnits::pct), vex::velocityUnits::pct); rightRear.spin(vex::directionType::fwd, Controller1.Axis2.position(vex::percentUnits::pct) - Controller1.Axis1.position(vex::percentUnits::pct), vex::velocityUnits::pct); if (Controller1.Axis3.position(percentUnits::pct) > 0) { BottomLeft.spin (directionType::fwd); BottomRight.spin(directionType::fwd); TopLeft.spin(directionType::fwd); TopRight.spin(directionType::fwd); if (Controller1.Axis3.position(percentUnits::pct) < 0) { BottomLeft.spin (directionType::rev); BottomRight.spin(directionType::rev); TopLeft.spin(directionType::rev); TopRight.spin(directionType::rev); else { BottomLeft.stop(brakeType::brake); BottomRight.stop(brakeType::brake); TopLeft.stop(brakeType::brake); TopRight.stop(brakeType::brake); } if (Controller1.Axis4.position(percentUnits::pct) > 0) { BottomLeft.spin (directionType::rev); BottomRight.spin(directionType::fwd); TopLeft.spin(directionType::rev); TopRight.spin(directionType::fwd); if (Controller1.Axis4.position(percentUnits::pct) < 0) { BottomLeft.spin (directionType::fwd); BottomRight.spin(directionType::rev); TopLeft.spin(directionType::fwd); TopRight.spin(directionType::rev); else { BottomLeft.stop(brakeType::brake); BottomRight.stop(brakeType::brake); TopLeft.stop(brakeType::brake); TopRight.stop(brakeType::brake); } } }

What I meant by the turning wasn’t working, was when I put the joystick on right or left, the robot would either go back, or only one wheel would work, so it doesn’t move at all.

Can you please format your code? It is very difficult to read it when it’s effectively one continuous line.

whoops.

[code] int main() { while(true){

BottomLeft.spin(vex::directionType::fwd, Controller1.Axis2.position(vex::percentUnits::pct) + Controller1.Axis1.position(vex::percentUnits::pct), vex::velocityUnits::pct);

BottomRight.spin(vex::directionType::fwd, Controller1.Axis2.position(vex::percentUnits::pct) + Controller1.Axis1.position(vex::percentUnits::pct), vex::velocityUnits::pct); TopLeft.spin(vex::directionType::fwd, Controller1.Axis2.position(vex::percentUnits::pct) - Controller1.Axis1.position(vex::percentUnits::pct), vex::velocityUnits::pct);

TopRight.spin(vex::directionType::fwd, Controller1.Axis2.position(vex::percentUnits::pct) - Controller1.Axis1.position(vex::percentUnits::pct), vex::velocityUnits::pct);

if (Controller1.Axis3.position(percentUnits::pct) > 0) {
BottomLeft.spin (directionType::fwd);
BottomRight.spin(directionType::fwd);
TopLeft.spin(directionType::fwd);
TopRight.spin(directionType::fwd);

if (Controller1.Axis3.position(percentUnits::pct) < 0) {
BottomLeft.spin (directionType::rev);
BottomRight.spin(directionType::rev);
TopLeft.spin(directionType::rev);
TopRight.spin(directionType::rev);

else {
BottomLeft.stop(brakeType::brake);
BottomRight.stop(brakeType::brake);
TopLeft.stop(brakeType::brake);
TopRight.stop(brakeType::brake); }
if (Controller1.Axis4.position(percentUnits::pct) > 0) {
BottomLeft.spin (directionType::rev);
BottomRight.spin(directionType::fwd);
TopLeft.spin(directionType::rev);
TopRight.spin(directionType::fwd);
if (Controller1.Axis4.position(percentUnits::pct) < 0) {
BottomLeft.spin (directionType::fwd);
BottomRight.spin(directionType::rev);
TopLeft.spin(directionType::fwd);
TopRight.spin(directionType::rev);
else { BottomLeft.stop(brakeType::brake);
BottomRight.stop(brakeType::brake);
TopLeft.stop(brakeType::brake);
TopRight.stop(brakeType::brake); } } } [/code]