-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/abstractingndparenting' into abs…
…tractingndparenting
- Loading branch information
Showing
3 changed files
with
160 additions
and
5 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
MeepMeepTesting/src/main/java/com/example/meepmeeptesting/GoToBoard.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,76 @@ | ||
package com.example.meepmeeptesting; | ||
|
||
import com.acmerobotics.roadrunner.geometry.Pose2d; | ||
import com.acmerobotics.roadrunner.geometry.Vector2d; | ||
import com.noahbres.meepmeep.roadrunner.trajectorysequence.TrajectorySequence; | ||
import com.noahbres.meepmeep.roadrunner.trajectorysequence.TrajectorySequenceBuilder; | ||
|
||
public class GoToBoard extends Component{ | ||
|
||
protected GoToBoard(Robot robot) { | ||
super(robot); | ||
} | ||
|
||
@Override | ||
public void drive() { | ||
//getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.BLUE_BOARD | ||
|
||
Pose2d startPose = getRobot().getDrive().getPoseEstimate(); | ||
|
||
TrajectorySequenceBuilder trajB = getRobot().getDrive().trajectorySequenceBuilder(startPose); | ||
|
||
if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.RED_AUDIENCE) { | ||
trajB = trajB.lineTo(new Vector2d(startPose.getX(), -36)) | ||
.lineTo(new Vector2d(50, -36)) | ||
//TODO: fix this turning it hurts :( | ||
.turn(Math.toRadians(-90-startPose.getHeading())); | ||
//TODO:fix error with temporal marker because ryan is a dum dum | ||
// .addTemporalMarker(() -> { | ||
// android.util.Log.i("PLACE PIXEL", "Placed pixel at Red Board"); | ||
// }); | ||
|
||
} else if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.RED_BOARD) { | ||
trajB = trajB.lineTo(new Vector2d(startPose.getX(), -36)) | ||
.lineTo(new Vector2d(50, -36)) | ||
//TODO: fix this turning it hurts :( | ||
.turn(Math.toRadians(-90-startPose.getHeading())); | ||
|
||
//TODO:fix error with temporal marker because ryan is a dum dum | ||
// .addTemporalMarker(() -> { | ||
// android.util.Log.i("PLACE PIXEL", "Placed pixel at Red Board"); | ||
// }); | ||
|
||
} else if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.BLUE_BOARD) { | ||
trajB = trajB.lineTo(new Vector2d(startPose.getX(), 36)) | ||
.lineTo(new Vector2d(50, 36)) | ||
//TODO: fix this turning it hurts :( | ||
.turn(Math.toRadians(90-startPose.getHeading())); | ||
|
||
//TODO:fix error with temporal marker because ryan is a dum dum | ||
// .addTemporalMarker(() -> { | ||
// android.util.Log.i("PLACE PIXEL", "Placed pixel at Blue Board"); | ||
// }); | ||
|
||
}else { | ||
trajB = trajB.lineTo(new Vector2d(startPose.getX(), 36)) | ||
.lineTo(new Vector2d(50, 36)) | ||
//TODO: fix this turning it hurts :( | ||
.turn(Math.toRadians(90-startPose.getHeading())); | ||
|
||
|
||
//TODO:fix error with temporal marker because ryan is a dum dum | ||
// .addTemporalMarker(() -> { | ||
// android.util.Log.i("PLACE PIXEL", "Placed pixel at Blue Board"); | ||
// }); | ||
|
||
} | ||
|
||
TrajectorySequence traj = trajB.build(); | ||
getRobot().getDrive().followTrajectorySequence(traj); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
} |
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
73 changes: 73 additions & 0 deletions
73
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/components/GoToBoard.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,73 @@ | ||
package org.firstinspires.ftc.teamcode.opmode.components; | ||
|
||
import android.util.Log; | ||
|
||
import com.acmerobotics.roadrunner.geometry.Pose2d; | ||
import com.acmerobotics.roadrunner.geometry.Vector2d; | ||
|
||
import org.firstinspires.ftc.teamcode.drive.Robot; | ||
import org.firstinspires.ftc.teamcode.drive.TrajectoryDrive; | ||
import org.firstinspires.ftc.teamcode.trajectorysequence.TrajectorySequence; | ||
import org.firstinspires.ftc.teamcode.trajectorysequence.TrajectorySequenceBuilder; | ||
public class GoToBoard extends Component{ | ||
|
||
protected GoToBoard(Robot robot) { | ||
super(robot); | ||
} | ||
|
||
@Override | ||
public void drive() { | ||
//getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.BLUE_BOARD | ||
|
||
Pose2d startPose = getRobot().getDrive().getPoseEstimate(); | ||
TrajectorySequenceBuilder trajB = getRobot().getDrive().trajectorySequenceBuilder(startPose); | ||
|
||
if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.RED_AUDIENCE) { | ||
trajB = trajB.lineTo(new Vector2d(startPose.getX(), -36)) | ||
.lineTo(new Vector2d(50, -36)) | ||
|
||
.turn(Math.toRadians(-90-startPose.getHeading())); | ||
//TODO:fix error with temporal marker because ryan is a dum dum | ||
// .addTemporalMarker(() -> { | ||
// android.util.Log.i("PLACE PIXEL", "Placed pixel at Red Board"); | ||
// }); | ||
|
||
} else if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.RED_BOARD) { | ||
trajB = trajB.lineTo(new Vector2d(startPose.getX(), -36)) | ||
.lineTo(new Vector2d(50, -36)) | ||
|
||
.turn(Math.toRadians(-90-startPose.getHeading())); | ||
//TODO:fix error with temporal marker because ryan is a dum dum | ||
// .addTemporalMarker(() -> { | ||
// android.util.Log.i("PLACE PIXEL", "Placed pixel at Red Board"); | ||
// }); | ||
|
||
} else if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.BLUE_BOARD) { | ||
trajB = trajB.lineTo(new Vector2d(startPose.getX(), 36)) | ||
.lineTo(new Vector2d(50, 36)) | ||
|
||
.turn(Math.toRadians(90-startPose.getHeading())); | ||
//TODO:fix error with temporal marker because ryan is a dum dum | ||
// .addTemporalMarker(() -> { | ||
// android.util.Log.i("PLACE PIXEL", "Placed pixel at Blue Board"); | ||
// }); | ||
|
||
}else { | ||
trajB = trajB.lineTo(new Vector2d(startPose.getX(), 36)) | ||
.lineTo(new Vector2d(50, 36)) | ||
|
||
.turn(Math.toRadians(90-startPose.getHeading())); | ||
//TODO:fix error with temporal marker because ryan is a dum dum | ||
// .addTemporalMarker(() -> { | ||
// android.util.Log.i("PLACE PIXEL", "Placed pixel at Blue Board"); | ||
// }); | ||
|
||
} | ||
|
||
TrajectorySequence traj = trajB.build(); | ||
getRobot().getDrive().followTrajectorySequence(traj); | ||
|
||
} | ||
|
||
|
||
} |