Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
id 'java'
id "jaci.openrio.gradle.GradleRIO" version "2018.01.22"
}

sourceSets {
main {
java {
srcDir 'src'
}
}
}

dependencies {
compile "edu.wpi.first.wpilibj:athena-jni:+"
compile "edu.wpi.first.wpilibj:athena:+"
}

repositories {
maven {
url "http://first.wpi.edu/FRC/roborio/maven/"
}
}
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
172 changes: 172 additions & 0 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 28 additions & 10 deletions src/edu/first/commands/common/LoopingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,44 @@
* @author Joel Gallant
*/
public abstract class LoopingCommand implements Command {
private boolean first = true;

public LoopingCommand() {
}

/**
* Runs {@link #runLoop()} until {@link #continueLoop()} returns false.
*/
@Override
public final void run() {
while (continueLoop()) {
runLoop();
while(this.continueLoop()) {
if (this.first) {
this.first = false;

try {
if (this.getClass().getMethod("firstLoop").getDeclaringClass().getTypeName().endsWith("LoopingCommand")) {
this.runLoop();
} else {
this.firstLoop();
}
} catch (SecurityException | NoSuchMethodException var2) {
throw new RuntimeException(var2);
}
} else {
this.runLoop();
}
}

this.end();
}

public void firstLoop() {
}

public void end() {
}

/**
* Returns whether the loop should run again.
*
* @return if loop should continue
*/
public abstract boolean continueLoop();

/**
* Runs the actual instructions of the command.
*/
public abstract void runLoop();
}
44 changes: 0 additions & 44 deletions src/edu/first/main/Constants.java

This file was deleted.

Loading