Not Knowing Much About Programming

This is the year is the first year I have done FRC and my team is a rookie team. I know just about nothing about programming so my first question is: What are the differences between the different drives like tank and arcade?

I can’t give you a comprehensive answer, but…

Tank uses two joysticks - one for the left side wheels, one for the right side. Also known as skid steer. To turn, you push one joystick more than the other.

Arcade uses a single joystick. To turn, you push the joystick in the direction you want to turn.

Neither is “better” - it is purely driver preference.

Tank Drive Uses two joysticks, the y-axis of each joystick, i.e., up-down, directly maps to the two motor values.

Arcade Drive uses a single joystick. The value of one of the motors is the y-axis plus the x-axis, while the value of the other motor is the y-axis minus the x-axis. This makes it so that pushing forward on the joystick moves both forward, pushing to the left spins counter-clockwise, etc.

Any other questions?

Thanks, and yes there are many more questions. What are global variables?

Note: Answer not FRC specific.

Global variables are variables defined and declared independent of any classes or functions. It’s generally not considered good programming practice to extensively use them.

sorry, but what are variables, I really know nothing :frowning:

Variables are containers for memory on a computer, they are associated with a name and data type (such as string, number, etc).

As Chris is me was saying about global variables, every variable has a “scope” which controls which part of your program can access other parts of the program.

A variable in program is the same concept as a variable in math such as “x^2 + 7x + 5 = 0” with x being the variable.

If you’re using C++ for FRC programming I’d recommend reading http://www.cplusplus.com/doc/tutorial/ along with the FIRST manuals of course (control system manuals here, http://usfirst.org/roboticsprograms/frc/content.aspx?id=10934 and C++ manuals here, http://first.wpi.edu/FRC/frccupdates.html.

LabVIEW also has a great community over at http://decibel.ni.com/content/community/first

variables are words that contain a value. If you have the following things:

int var1 = 5;

double var2 = 10.0;

string var3 = "hello";

char var4 = 'c';

each of those are a variable. Other variables exist and can be declared or created in the program. I haven’t seen much of the code here, but I’m pretty sure Joysticks are created and named (as variables), motors, solenoids, etc are all created and named.

Basically, if you create a name for something that you can create or change values for, use in other equations or declarations, it’s a variable. I would suggest looking at beginning programming tutorials for the language you decide to code in and working your way through it.

Thanks you guys :slight_smile: Finally fell like I might get somewhere.

To answer your question, a variable is used to store data and input. There are different types of variables for storing different types of information. For example, a int variable -which stores whole numbers- cannot hold the values X or 2.56. Variables can be compared to each other using comparisons such as > or <.

If you want to learn more about programming, I’d recommend talking to the head of your programming subteam.

You may want to visit frcmastery.com

It’s a great depository that has videos that will get you started programming in Labview and explain what many portions of the program do.

It might help to know what NOT global variables are as well.
There are different degrees of ‘global’-ness and it’s generally more useful and precise to think in terms of the ‘scope’ of variables, rather than global or not.

Consider this simple C function

int foo (int x, int y){
    int z = x + y;
    return z;
}

Here ‘z’ is an integer variable.
It’s both declared and assigned a value in the same line.
More importantly, because it’s declared inside the body of a function, it is said to have ‘function’ scope
This essentially means that ‘z’ is a variable that is almost as unglobal as a variable can be (there exists even more restrictive scope, but ignore that fact for now).
No other function can use or change the value of the variable ‘z’.
In fact, ‘z’ only even exists during the brief period that function ‘foo’ is executing.

Now look at a relatively more global variable, one that can be used by two or more functions.

int z;

void add1(void){
    z = z + 1;
}
void subtract1(void){
    z = z - 1;
}

Because ‘z’ is declared outside the body of any function, it is said to have (at least) file scope.
This ‘z’ can be accessed by any function that exists in the same source file.

It is also possible to make ‘z’ visible to functions in other source files, giving it what some call ‘program’ scope.

So, now that you have some idea what global means in the context of variables, google for “scope variables” and start becoming a programmer.
And have fun with it.

That makes so much sense, thank you!!! I get it!!