I added this comment after I had finished writing this entire post:
Waaaiiit wait wait. Are you using Natural Language? arcadeControl() is a Natural Language function, which is different from plain old RobotC. If you have no idea what Natural Language is, then please ignore the above comment and keep reading below. If you are using that, then all of my provided code is completely obsolete.
------------------------------------------------------------------------------------------
I'm glad that my post was able to better explain how variables work, as they are very important for programming outside of RobotC.
To answer your question, no. arcadeControl() is a pre-built function that basically does what I showed you earlier but with an added feature called a threshold. I don't like using it because I prefer to work with the motors more directly since it allows me to tweak exactly how the motors respond to the joysticks, and I like to understand how it works. It also helped me figure out how to program holonomic drive, which I will explain later. arcadeControl() is a part of what is called Natural Language. It's a simplified version of robotC that comes with commands like forward() and untilSensor(). You really don't need to use it for FTC programming as my code essentially re-implements what arcadeControl() would do. It is good programming practice to separate your code into functions (if you haven't learned what those are, I highly recommend reading the RobotC help documentation to learn more about them), but it usually isn't necessary for FTC programming.
Regarding the threshold, basically, sometimes the joysticks don't perfectly reset to 0. You can sometimes see it while you're running your tests; after releasing the joysticks, the motor still vibrates and tries to move. When you're not touching them, they might have a value of say, x=-3 and y=4. With my code, the motors would try to move with a speed of -3, but this isn't enough to overcome the internal friction of the motor. This could lead to seriously bad problems, so we overcome that by only running the motors if the joystick values are smaller than pre-determined threshold.
See this example code:
Code:
int x = joystick.joy1_x1;
int y = joystick.joy1_y1;
int THRESHOLD = 10;
if (abs(x) > THRESHOLD && abs(y) > THRESHOLD) {
motor[driveLeft] = y + x;
motor[driveRight] = y - x;
} else {
motor[driveLeft] = 0;
motor[driveRight] = 0;
}
In English, that translates to:
If the absolute value of the joystick's x-axis is greater than 10 (the threshold) AND the y-value is also greater than 10, run the motors according to the formulas I showed you earlier. Otherwise, don't power the motors. You can also think of it like this: if either joystick value (x or y) is less than 10, don't even bother running the motor because it's too small to even move the motor anyway.
Also, holonomic drive is basically four omni wheels in a diagonal configuration, which lets you strafe left and right without needing to turn, much unlike a car or shopping cart.