[FRC 2015] Test Mode Tutorial

10
1 FRC Test Mode This document describes the functionality of Test Mode for the 2015 FIRST competition season. Read through it to learn how to set up your own test. Table of Contents FRC Test Mode ....................................................................................................................................................1 Overview ............................................................................................................................................................1 Dashboard in Test Mode....................................................................................................................................2 Changing Tests ...............................................................................................................................................3 Adjust Outputs in Test Mode .........................................................................................................................3 Programming Test Mode ...................................................................................................................................4 Creating a Test ...............................................................................................................................................5 Example Test SubVI Code ...............................................................................................................................8 Overview In the Operation tab of the FRC Driver Station you can select Test Mode to run predetermined and programmed tests. The tests can range from testing different autonomous code, sensors, motors, or any small amount of code. The objective of Test Mode is to test specific hardware without having to run all of your code.

description

Test Mode Tutorial

Transcript of [FRC 2015] Test Mode Tutorial

Page 1: [FRC 2015] Test Mode Tutorial

1

FRC Test Mode

This document describes the functionality of Test Mode for the 2015 FIRST competition season. Read

through it to learn how to set up your own test.

Table of Contents FRC Test Mode ....................................................................................................................................................1

Overview ............................................................................................................................................................1

Dashboard in Test Mode....................................................................................................................................2

Changing Tests ...............................................................................................................................................3

Adjust Outputs in Test Mode .........................................................................................................................3

Programming Test Mode ...................................................................................................................................4

Creating a Test ...............................................................................................................................................5

Example Test SubVI Code ...............................................................................................................................8

Overview

In the Operation tab of the FRC Driver Station you can select Test Mode to run predetermined and

programmed tests. The tests can range from testing different autonomous code, sensors, motors, or

any small amount of code. The objective of Test Mode is to test specific hardware without having to run

all of your code.

Page 2: [FRC 2015] Test Mode Tutorial

2

Test Mode Tab on the Dashboard (top) and Test Mode on the Driver Station (bottom)

Dashboard in Test Mode

Dashboard in Test Mode

In the image above, Test Mode is enabled and the Test tab is open on the FRC Dashboard. The yellow

box shows the variables tree that updates the variables called in the selected tests. The red box is a

drop down menu that allows you to select different pre-programmed tests. The step text and progress

bar, in the blue box, output data during the test. The text and progress bar can be modified in the

Test.vi block diagram for each individual test. It is not a requirement to use either the text or

progress bar, however they are helpful in understanding what the robot is doing during the test for

documentation.

Page 3: [FRC 2015] Test Mode Tutorial

3

Changing Tests

While still in Test mode, once one test has fully completed, you can click on the Select the test to run

dropdown and the test will immediately start to run. If the test runs infinitely, make sure there is a blank

string wired to the String input of an NT Write String function at the end of your test code.

Adjust Outputs in Test Mode

Page 4: [FRC 2015] Test Mode Tutorial

4

Test Mode allows you to change the output of certain settings, like the motors or camera settings. Any

value with two asterisks ** in the Network Table, marked by the yellow box in the image above, can be

manually adjusted. Use the control (red box) to adjust the settings on the robot in simulator or

hardware. Select the Enable button shown in the green box to make the settings active.

Programming Test Mode

Open the Test.vi either from the Project Explorer in an FRC roboRIO Robot Project or from the

reference in Robot Main.vi.

Project Explorer of a roboRIO Robot Project

The Test.vi is where you will create new tests and modify existing tests. The Test.vi will run in parallel with the Robot Main.vi when Test is enabled in the Driver Station.

Page 5: [FRC 2015] Test Mode Tutorial

5

Creating a Test

In the Block Diagram of the Test.vi, modify the Default Tests string array to add new test names to the

FRC Dashboard drop down menu. Erase the current text and replace with your desired test name. To add

or delete elements, right click the text box and navigate to Data Operations » Insert or Delete Element.

Test.vi Block Diagram, Default Tests

Page 6: [FRC 2015] Test Mode Tutorial

6

Next, add the new test name to the case structure. Select the Example Test case from the Case

Structure, right click on the Case Structure border and select Duplicate Case. Inside quotations, enter

the same name you wrote in the Default Tests, string array, for example “Drive Test”. You do not have

to duplicate the Example Test, but it is the simplest way to modify your first test.

Test.vi Block Diagram, duplicating the Example Test case

Now you are ready to modify the code to allow the test to complete your desired action. The simplest

modification is to create a subVI and add your test code into the subVI. To create a subVI, select the For

Loop from the duplicate Example Test case and navigate to Edit » Create SubVI. This will keep

everything in Test.vi organized and allow you to update only the necessary subVI in your project when a

specific test must be edited.

Page 7: [FRC 2015] Test Mode Tutorial

7

Creating a SubVI

Page 8: [FRC 2015] Test Mode Tutorial

8

The subVI can then be designed to run the desired test code. The output of the subVI should be a

blank string, in order to reset the menu in the Test tab on the FRC Dashboard. There are two ways of

modifying the display in the Dashboard: the Progress Text shows the Step Text in the example code

(shown in the red box), and the Progress Bar is output to a slider the in Dashboard (green box). In

your Test subVI, wire constants to the NT Write String or NT Write Number functions to change the

display in Dashboard. Neither of these settings is required for Test Mode; they are there to help

show the progress of the test.

Example Test subVI

Example Test SubVI Code

The Test.vi runs in parallel with Robot Main.vi, therefore you must include a While Loop in the

subVI if you would like the code to repeat. However, there must be a stop condition or the test will run

indefinitely, preventing you from changing to a different test. If the stop condition of the While Loop is a

control, make sure this VI control is always accessible when running test mode, or set up another

conditional statement (see below for examples).

Page 9: [FRC 2015] Test Mode Tutorial

9

Close Gripper Test subVI

The gripper example above closes the gripper for 5 seconds then stops running the test. The Progress

Text display on Dashboard is Close Gripper. This example is useful for verifying angle dimensions and

whether the hardware is set up properly for a claw or an arm.

Drive Test subVI

Page 10: [FRC 2015] Test Mode Tutorial

10

The above drive example drives the motors at a designated speed for a set amount of iterations or until

the stop button is pressed. If you would like the loop to be controlled this is a good alternative so it will

close after x amount of time if something else isn’t working properly. The Progress Test is Drive Motors

and the progress bar increases as the iterations run.