FIRST Robotics Competition Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

[FRC 2016] Autonomous Timed Movement Tutorial

timing.png

Kevin Fort
Principal Software Engineer
NI
Comments
Ash5851
Member
Member
on

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

BoKnows
Active Participant
Active Participant
on

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.

Ash5851
Member
Member
on

Thanks! That's what I wanted to know

Ash5851
Member
Member
on

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 <sharma.akhil100@gmail.com

johnr4
NI Employee (retired)
on

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!

Regards,

John R.

John R.
National Instruments
Contributors