-
Notifications
You must be signed in to change notification settings - Fork 1
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 #40 from ftc16072/autoWork
Auto work
- Loading branch information
Showing
20 changed files
with
473 additions
and
16 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...de/src/main/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/Delay.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,20 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class Delay extends QQTimeoutNode { | ||
public Delay(double seconds) { | ||
super(seconds); | ||
} | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (hasTimedOut()){ | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../main/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/IntakeArmIn.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,28 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class IntakeArmIn extends QQTimeoutNode { | ||
public IntakeArmIn(double seconds) { | ||
super(seconds); | ||
} | ||
State lastStatus = State.RUNNING; | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (lastStatus != State.RUNNING) { | ||
return lastStatus; | ||
}else { | ||
opMode.robot.intakeArm.goToDropPos(); | ||
if (hasTimedOut()) { | ||
opMode.robot.scoreArm.setNotScoring(); | ||
lastStatus = State.SUCCESS; | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...main/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/IntakeArmOut.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,28 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class IntakeArmOut extends QQTimeoutNode { | ||
public IntakeArmOut(double seconds) { | ||
super(seconds); | ||
} | ||
State lastStatus = State.RUNNING; | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (lastStatus != State.RUNNING) { | ||
return lastStatus; | ||
}else { | ||
opMode.robot.intakeArm.goToIntake(); | ||
if (hasTimedOut()) { | ||
opMode.robot.scoreArm.setNotScoring(); | ||
lastStatus = State.SUCCESS; | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...n/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/IntakeClawClose.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,28 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class IntakeClawClose extends QQTimeoutNode { | ||
public IntakeClawClose(double seconds) { | ||
super(seconds); | ||
} | ||
State lastStatus = State.RUNNING; | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (lastStatus != State.RUNNING) { | ||
return lastStatus; | ||
}else { | ||
opMode.robot.intakeClaw.close(); | ||
if (hasTimedOut()) { | ||
opMode.robot.scoreArm.setNotScoring(); | ||
lastStatus = State.SUCCESS; | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...in/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/IntakeClawOpen.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,28 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class IntakeClawOpen extends QQTimeoutNode { | ||
public IntakeClawOpen(double seconds) { | ||
super(seconds); | ||
} | ||
State lastStatus = State.RUNNING; | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (lastStatus != State.RUNNING) { | ||
return lastStatus; | ||
}else { | ||
opMode.robot.intakeClaw.open(); | ||
if (hasTimedOut()) { | ||
opMode.robot.scoreArm.setNotScoring(); | ||
lastStatus = State.SUCCESS; | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
...src/main/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/SlidesIn.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,30 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class SlidesIn extends QQTimeoutNode { | ||
public SlidesIn(double seconds) { | ||
super(seconds); | ||
} | ||
State lastStatus = State.RUNNING; | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (lastStatus != State.RUNNING) { | ||
return lastStatus; | ||
}else { | ||
opMode.robot.intakeSlides.startPosition(); | ||
if (hasTimedOut()) { | ||
lastStatus = State.FAILURE; | ||
return State.FAILURE; | ||
} else if (opMode.robot.intakeSlides.getIsWithinTolerence()) { | ||
lastStatus = State.SUCCESS; | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/SlidesOutToMiddle.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,30 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class SlidesOutToMiddle extends QQTimeoutNode { | ||
public SlidesOutToMiddle(double seconds) { | ||
super(seconds); | ||
} | ||
State lastStatus = State.RUNNING; | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (lastStatus != State.RUNNING) { | ||
return lastStatus; | ||
}else { | ||
opMode.robot.intakeSlides.setAutoExtensionPosition(); | ||
if (hasTimedOut()) { | ||
lastStatus = State.FAILURE; | ||
return State.FAILURE; | ||
} else if (opMode.robot.intakeSlides.getIsWithinTolerence()) { | ||
lastStatus = State.SUCCESS; | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...ain/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/WristToIntake.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,28 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class WristToIntake extends QQTimeoutNode { | ||
public WristToIntake(double seconds) { | ||
super(seconds); | ||
} | ||
State lastStatus = State.RUNNING; | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (lastStatus != State.RUNNING) { | ||
return lastStatus; | ||
}else { | ||
opMode.robot.intakeClaw.wristIntake(); | ||
if (hasTimedOut()) { | ||
opMode.robot.scoreArm.setNotScoring(); | ||
lastStatus = State.SUCCESS; | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...n/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/WristToTransfer.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,28 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.ftcteams.behaviortrees.DebugTree; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.QQTimeoutNode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class WristToTransfer extends QQTimeoutNode { | ||
public WristToTransfer(double seconds) { | ||
super(seconds); | ||
} | ||
State lastStatus = State.RUNNING; | ||
|
||
@Override | ||
public State tick(DebugTree debug, QQOpMode opMode) { | ||
if (lastStatus != State.RUNNING) { | ||
return lastStatus; | ||
}else { | ||
opMode.robot.intakeClaw.wristTransfer(); | ||
if (hasTimedOut()) { | ||
opMode.robot.scoreArm.setNotScoring(); | ||
lastStatus = State.SUCCESS; | ||
return State.SUCCESS; | ||
} | ||
return State.RUNNING; | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...c/main/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Trees/DoubleIntake.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,39 @@ | ||
|
||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Trees; | ||
|
||
import com.ftcteams.behaviortrees.Failover; | ||
import com.ftcteams.behaviortrees.Node; | ||
import com.ftcteams.behaviortrees.Sequence; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.IntakeAttempt; | ||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.IntakeClawClose; | ||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.ReadyToIntakeOne; | ||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.SlidesIn; | ||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.WristToIntake; | ||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.WristToTransfer; | ||
|
||
|
||
public class DoubleIntake { | ||
public static Node root(){ | ||
final double INTAKE_TIMEOUT_SECONDS = 1.5; | ||
final double MOVEMENT_TIMEOUT_SECONDS = 5; | ||
return new Sequence( | ||
new WristToIntake(0.5), | ||
new IntakeClawClose(0.5), | ||
new WristToTransfer(0.5), | ||
new SlidesIn(MOVEMENT_TIMEOUT_SECONDS), | ||
new Failover( | ||
new IntakeAttempt(INTAKE_TIMEOUT_SECONDS), | ||
new Sequence( | ||
new ReadyToIntakeOne(MOVEMENT_TIMEOUT_SECONDS), | ||
new IntakeAttempt(INTAKE_TIMEOUT_SECONDS)))); | ||
} | ||
} | ||
|
||
/* TREE | ||
? | ||
| [IntakeAttempt] | ||
| -> | ||
| | [ReadyForIntake] | ||
| | [IntakeAttempt] | ||
*/ |
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
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
Oops, something went wrong.