Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 0366cc4

Browse files
committed
2 parents 7749aba + b5aeb14 commit 0366cc4

5 files changed

Lines changed: 43 additions & 25 deletions

File tree

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/Autonomous.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.usfirst.frc.team199.Robot2018.commands;
22

3+
import edu.wpi.first.wpilibj.DriverStation;
34
import edu.wpi.first.wpilibj.command.CommandGroup;
45

56
/**
@@ -55,7 +56,15 @@ public double getDelay() {
5556
// TODO
5657
return 0;
5758
}
58-
59+
60+
/**
61+
* {@inheritDoc}
62+
*/
63+
@Override
64+
public String getFMS() {
65+
return DriverStation.getInstance().getGameSpecificMessage();
66+
}
67+
5968
/**
6069
* {@inheritDoc}
6170
*/

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/AutonomousInterface.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ public enum Strategy {
4747
*
4848
* @return FMS data
4949
*/
50-
default String getFMS() {
51-
return DriverStation.getInstance().getGameSpecificMessage();
52-
}
50+
public String getFMS();
5351

5452
/**
5553
* Pick the script to run for Autonomous

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/TestAuto.java

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,14 @@
99
public class TestAuto extends CommandGroup implements TestAutoInterface {
1010

1111
public TestAuto() {
12-
// TODO
13-
14-
// Add Commands here:
15-
// e.g. addSequential(new Command1());
16-
// addSequential(new Command2());
17-
// these will run in order.
18-
19-
// To run multiple commands at the same time,
20-
// use addParallel()
21-
// e.g. addParallel(new Command1());
22-
// addSequential(new Command2());
23-
// Command1 and Command2 will run in parallel.
24-
25-
// A command group will require all of the subsystems that each member
26-
// would require.
27-
// e.g. if Command1 requires chassis, and Command2 requires arm,
28-
// a CommandGroup containing them would require both the chassis and the
29-
// arm.
12+
addSequential(new RunScript(getScriptToTest()));
3013
}
3114

3215
/**
3316
* {@inheritDoc}
3417
*/
3518
@Override
36-
public String getScriptToTest() {
37-
// TODO
38-
return null;
19+
public String getScriptToTest() {
20+
return getString("Auto Script", "NOTHING");
3921
}
4022
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pynetworktables==2018.0.0
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#nt setup
2+
from networktables import NetworkTables
3+
NetworkTables.initialize(server='roboRIO-199-FRC.local')
4+
prefs = NetworkTables.getTable("Preferences")
5+
6+
go = False #true when file has been successfully read
7+
file = [] #an array of strings which represent each line of the file
8+
filename = input("File name: ") #the name of the file to read (user input)
9+
10+
#loops until a file is read into the file array
11+
while not go:
12+
try:
13+
if filename == "quit":
14+
quit()
15+
16+
with open(filename) as script:
17+
file = script.readlines()
18+
#balex's testing
19+
for line in file:
20+
print(repr(line))
21+
22+
break
23+
except:
24+
filename = input("Not found. Try another name (enter to quit): ") or "quit" #retry, or quit (in case the file doesn't exist)
25+
26+
#puts the string array
27+
prefs.putStringArray("autoscripts", file)
28+
print("Uploaded %s as a String[] to key \"autoscripts\"" % filename)

0 commit comments

Comments
 (0)