-
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 branch 'master' into debugBehaviorTrees
- Loading branch information
Showing
47 changed files
with
697 additions
and
165 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
.../java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/ReleaseAutoPixel.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 org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.Trajectories.SetLeftSpikeTrajectory; | ||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.Trajectories.SetMiddleSpikeTrajectory; | ||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions.Trajectories.SetRightSpikeTrajectory; | ||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Node; | ||
import org.firstinspires.ftc.teamcode.ftc16072.Mechanisms.PixelServo; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class ReleaseAutoPixel extends Node { | ||
|
||
|
||
@Override | ||
public State tick(QQOpMode opmode) { | ||
opmode.robot.pixelServo.releasePixel(); | ||
return State.SUCCESS; | ||
} | ||
|
||
|
||
} |
71 changes: 71 additions & 0 deletions
71
...inspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/SetBackboardFromSpikeTrajectory.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,71 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import com.acmerobotics.roadrunner.trajectory.Trajectory; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Node; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
import org.firstinspires.ftc.teamcode.ftc16072.Util.Alliance; | ||
import org.firstinspires.ftc.teamcode.ftc16072.Util.SpikePosition; | ||
import org.firstinspires.ftc.teamcode.ftc16072.Util.StartPosition; | ||
import org.firstinspires.ftc.teamcode.rr_trajectorysequence.TrajectorySequence; | ||
import org.firstinspires.ftc.teamcode.rr_trajectorysequence.TrajectorySequenceBuilder; | ||
|
||
public class SetBackboardFromSpikeTrajectory extends Node { | ||
@Override | ||
public State tick(QQOpMode opmode) { | ||
Alliance alliance = opmode.board.get(Alliance.class, "Alliance"); | ||
StartPosition startPosition = opmode.board.get(StartPosition.class,"StartPosition"); | ||
SpikePosition spikePosition = opmode.board.get(SpikePosition.class,"SpikePosition"); | ||
TrajectorySequenceBuilder builder = opmode.robot.nav.trajectorySequenceBuilder(opmode.robot.nav.getPoseEstimate()); | ||
TrajectorySequence sequence = null; | ||
|
||
if(alliance == Alliance.RED){ | ||
if(startPosition == StartPosition.CLOSE){ | ||
if(spikePosition == SpikePosition.LEFT){ | ||
//TODO: Put RedCloseLeft trajectory builder here | ||
} else if (spikePosition == SpikePosition.RIGHT) { | ||
//TODO: Put REDCLOSERight trajectory builder here | ||
} | ||
else if (spikePosition == SpikePosition.MIDDLE){ | ||
//TODO: Put REDCLOSEMIDDLE trajectory builder here | ||
} | ||
} else if (startPosition == StartPosition.FAR){ | ||
if(spikePosition == SpikePosition.LEFT){ | ||
//TODO: Put RedFarLeft trajectory builder here | ||
} else if (spikePosition == SpikePosition.RIGHT) { | ||
//TODO: Put REDFarRight trajectory builder here | ||
} | ||
else if (spikePosition == SpikePosition.MIDDLE){ | ||
//TODO: Put REDFarMIDDLE trajectory builder here | ||
} | ||
} | ||
} | ||
if(alliance == Alliance.BLUE){ | ||
if(startPosition == StartPosition.CLOSE){ | ||
if(spikePosition == SpikePosition.LEFT){ | ||
//TODO: Put BlueCloseLeft trajectory builder here | ||
} else if (spikePosition == SpikePosition.RIGHT) { | ||
//TODO: Put BlueCLOSERight trajectory builder here | ||
} | ||
else if (spikePosition == SpikePosition.MIDDLE){ | ||
//TODO: Put BlueCLOSEMIDDLE trajectory builder here | ||
} | ||
} else if (startPosition == StartPosition.FAR){ | ||
if(spikePosition == SpikePosition.LEFT){ | ||
//TODO: Put BlueFarLeft trajectory builder here | ||
} else if (spikePosition == SpikePosition.RIGHT) { | ||
//TODO: Put BlueFarRight trajectory builder here | ||
} | ||
else if(spikePosition == SpikePosition.MIDDLE){ | ||
//TODO: Put BlueFarMIDDLE trajectory builder here | ||
} | ||
} | ||
} | ||
|
||
if (sequence == null){ | ||
return State.FAILURE; | ||
} | ||
opmode.board.add("TrajectorySequence", sequence); | ||
return State.SUCCESS; | ||
} | ||
} |
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
12 changes: 0 additions & 12 deletions
12
...n/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/StopIntakeMotor.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
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
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
18 changes: 18 additions & 0 deletions
18
.../org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Conditions/EnoughTimeForCycle.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,18 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Conditions; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Node; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class EnoughTimeForCycle extends Node{ | ||
public static final int CYCLE_TIME = 0; //TODO: THIS IS WRONG!!!! | ||
|
||
@Override | ||
public State tick(QQOpMode opmode) { | ||
if(opmode.time > CYCLE_TIME){ | ||
return State.SUCCESS; | ||
} | ||
return State.FAILURE; | ||
} | ||
} | ||
|
||
// need to change |
14 changes: 0 additions & 14 deletions
14
...rg/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Conditions/IfEjectButtonPressed.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...g/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Conditions/IfIntakeButtonPressed.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
4 changes: 4 additions & 0 deletions
4
...src/main/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Conditions/isRed.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,4 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Conditions; | ||
|
||
public class isRed { | ||
} |
29 changes: 29 additions & 0 deletions
29
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Not.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,29 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
//Not reverses a value | ||
public class Not extends Node { | ||
Node child; | ||
|
||
public Not(Node a) { | ||
this.child = a; | ||
} | ||
|
||
@Override | ||
public State tick(QQOpMode opmode) { | ||
State state = child.tick(opmode); | ||
|
||
if (state == State.FAILURE) { | ||
return State.SUCCESS; | ||
} else if (state == State.SUCCESS) { | ||
return State.FAILURE; | ||
} | ||
|
||
return state; | ||
} | ||
} |
Oops, something went wrong.