Do my Vi's look alright so far?

Does everything look alright so far? We are using tankdrive (which worked when I used the FRC Simulator). On Joystick 1, button 1 will spin the motor in one direction as opposed to Joystick 2 which will spin in the opposite direction when pressed. Avoid the camera stuff. I mainly want my Victor motor configuration double-checked. Thanks in advance! :smiley:

One point to think about is, in teleop you are retrieving the joystick refnum and reading the joystick values a second time. A somewhat better way to do this is to branch the wire from the leftmost joystick button code rather than reread it.

Greg McKaskle

Greg is correct, you shouldn’t have two joystick gets in teleop.

Another thing to note is that your constants going into the select node should both be doubles, not 32 bit integers. You can create a double constant easily by right clicking on the terminal of the select node and clicking create -> constant.

As for the constants. That is a good thing to notice, but the node immediately coerces it to a double. In fact, the compiler will generate it as a double and will not do the coercion at runtime.

Greg McKaskle

Everything said above sounds like good recommendations. Greg is correct (of course… he works for NI!) about the blue numbers (non-floating point number). LabVIEW will automatically coerce the number to the correct value. That’s what the little red dot means… it’s a coercion dot. It’s bad practice to do this though, especially with a constant. Just make it a Double to begin with!

Here’s one other thing, and maybe you did it to fit everything on the screen.

Generally, G-code should be read from left-to-right to make analyzing the data flow easier.

The output of the select node goes from right to left. Does it hurt the code? No. It just doesn’t look as good, and it makes it look like you’re outputting something from the Set Motor VI.