forked from FFFabulousRobotics/FtcRobotController
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from FFFabulousRobotics/task-concept
Task system update
- Loading branch information
Showing
8 changed files
with
108 additions
and
102 deletions.
There are no files selected for viewing
11 changes: 0 additions & 11 deletions
11
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OneTimeTask.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Task.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/TaskStatus.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/task/OneTimeTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.firstinspires.ftc.teamcode.task; | ||
|
||
public interface OneTimeTask extends Task { | ||
|
||
void init(); | ||
|
||
@Override | ||
default void iterate() {} | ||
|
||
@Override | ||
default boolean hasNext() { | ||
return false; | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...firstinspires/ftc/teamcode/SleepTask.java → ...inspires/ftc/teamcode/task/SleepTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/task/Task.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.firstinspires.ftc.teamcode.task; | ||
|
||
public interface Task { | ||
int TICK_MS = 50; | ||
|
||
/** | ||
* This method is called in the main loop of OpMode | ||
* It should contain the code of EACH TICK, instead of a loop in it! | ||
*/ | ||
void iterate(); | ||
|
||
/** | ||
* To judge whether the task needs to continue. | ||
* @return Return true when it need to continue, otherwise false. | ||
*/ | ||
boolean hasNext(); | ||
|
||
/** | ||
* This method is called when the task is registered in the TaskOpMode. | ||
*/ | ||
default void init() { | ||
} | ||
|
||
/** | ||
* The method is called when the task is finished. | ||
*/ | ||
default void finish() { | ||
} | ||
|
||
/** | ||
* The method is called when the task is canceled. | ||
*/ | ||
default void cancel() { | ||
} | ||
} |