FIRST Robotics Competition Documents

Showing results for 
Search instead for 
Did you mean: 

[FRC 2016] Autonomous Timed Movement Tutorial

by Active Participant Kevin_F ‎01-03-2013 08:08 PM - edited ‎01-30-2017 10:45 AM
Member Ash5851

Could you explain what each part of the code specifically does next time in your document? Like with the iterations and loops etc etc.

Active Participant BoKnows
Active Participant

These loops take 50ms to run.  The number of iterations determines how many multiples of 50ms the loop runs.  20 iterations makes 1 second.  10 iterations makes half a second.

The increment is because the iteration terminal is 0 indexed (the first iteration is 0 instead of 1).  This makes the code a little easier to read.  As things execute in parallel, it won't hurt your performance.

Member Ash5851

Thanks! That's what I wanted to know

Member Ash5851

Hey another question, how does the code make the robot go left and right-

what do the yellow boxes do? I thought it was just like Vectors along the X

and y Axis but that is incorrect because positive values make the robot go

left and right so I am obviously missing something..

On Tuesday, December 29, 2015, Akhil Sharma <

Member johnr4

Hello Ash5851,

That's a great question.  The yellow boxes are called vis, which perform a set of functions.  This vi (Arcade Drive) controls the robot motors.  The two inputs to the Arcade Drive vis are x-axis value and y-axis value.  If you dig deep enough into the vi, you would see that the x-axis value affects the right motor speed, and the y-axis value affects the left motor speed.  In the first loop, you see that the y-axis value is greater than the x-axis value.  In other words, the left motors are going faster than the right motors.  If this is the case, then the robot will turn to the right.  In the second loop, it is the opposite case.  The right motors are moving faster than the left motors, so the robot will turn left.  Note that a value of 0 means the robot is not moving.  If you push "Ctrl" + "H" and click on the vi that you have questions about, context help will provide valuable insight.  Please let me know if I have answered your questions or if there is anything else that I can do to help!


John R.