-
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 #67 from ftc16072/RoadRunnerTuning
VisionFixes
- Loading branch information
Showing
17 changed files
with
163 additions
and
33 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...org/firstinspires/ftc/teamcode/ftc16072/BehaviorTrees/Actions/SpikeLocationTelemetry.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,12 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Actions; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Node; | ||
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode; | ||
|
||
public class SpikeLocationTelemetry extends Node { | ||
@Override | ||
public State tick(QQOpMode opmode) { | ||
opmode.telemetry.addData("Prop Location: ", opmode.robot.cameraBack.getTeamPropPosition()); | ||
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
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
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
78 changes: 78 additions & 0 deletions
78
...src/main/java/org/firstinspires/ftc/teamcode/ftc16072/OpModes/MiddleSpikeToBackboard.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,78 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.OpModes; | ||
|
||
import com.acmerobotics.roadrunner.geometry.Pose2d; | ||
import com.acmerobotics.roadrunner.geometry.Vector2d; | ||
import com.acmerobotics.roadrunner.trajectory.Trajectory; | ||
import com.acmerobotics.roadrunner.util.NanoClock; | ||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; | ||
import com.qualcomm.robotcore.eventloop.opmode.OpMode; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.Robot; | ||
|
||
@Autonomous | ||
public class MiddleSpikeToBackboard extends OpMode { | ||
Robot robot = new Robot(); | ||
Trajectory trajectory; | ||
private enum State {BEGIN, AWAY, PAUSE, RETURN, DONE} | ||
State state = State.BEGIN; | ||
NanoClock clock; | ||
double startPause; | ||
@Override | ||
public void init() { | ||
robot.makeDriveOnly(); | ||
robot.init(hardwareMap); | ||
clock = NanoClock.system(); | ||
} | ||
|
||
@Override | ||
public void loop() { | ||
robot.nav.updatePoseEstimate(); | ||
Pose2d currentPose = robot.nav.getPoseEstimate(); | ||
|
||
//Trajectory to middle tape | ||
Trajectory trajectory1 = robot.nav.trajectoryBuilder(currentPose, false) | ||
.back(25) | ||
.strafeRight(25) | ||
.build(); | ||
|
||
Trajectory trajectory2 = robot.nav.trajectoryBuilder(trajectory1.end(), false) | ||
.strafeRight(25) | ||
.build(); | ||
|
||
telemetry.addData("STATE", state); | ||
telemetry.addData("POSE", "x = %.2f y = %.2f h = %.1f", currentPose.getX(), currentPose.getY(), Math.toDegrees(currentPose.getHeading())); | ||
switch (state) { | ||
case BEGIN: | ||
state = State.AWAY; | ||
|
||
robot.nav.setPoseEstimate(currentPose); | ||
robot.nav.follower.followTrajectory(trajectory1); | ||
break; | ||
case AWAY: | ||
if (robot.nav.isDoneFollowing(currentPose)) { | ||
state = State.PAUSE; | ||
startPause = clock.seconds(); | ||
} | ||
break; | ||
case PAUSE: | ||
if ((clock.seconds() - startPause) > 2.0) { | ||
|
||
state = State.RETURN; | ||
|
||
} | ||
break; | ||
case RETURN: | ||
robot.nav.setPoseEstimate(trajectory1.end()); | ||
robot.nav.follower.followTrajectory(trajectory2); | ||
|
||
break; | ||
case DONE: | ||
if (robot.nav.isDoneFollowing(currentPose)) { | ||
state = State.DONE; | ||
} | ||
break; | ||
} | ||
|
||
|
||
} | ||
} |
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
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
Oops, something went wrong.