-
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.
- Loading branch information
1 parent
c79e4ff
commit d00290c
Showing
4 changed files
with
112 additions
and
24 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
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
10 changes: 10 additions & 0 deletions
10
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/components/Component.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
48 changes: 48 additions & 0 deletions
48
.../src/main/java/org/firstinspires/ftc/teamcode/opmode/components/PurplePixelComponent.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,48 @@ | ||
package org.firstinspires.ftc.teamcode.opmode.components; | ||
|
||
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; | ||
import org.firstinspires.ftc.teamcode.vision.TensorFlowDetection; | ||
|
||
public class PurplePixelComponent extends Component { | ||
private TensorFlowDetection.PropPosition propPosition; | ||
public PurplePixelComponent(Robot robot, TensorFlowDetection.PropPosition propPosition) { | ||
super(robot); | ||
this.propPosition = propPosition; | ||
} | ||
|
||
@Override | ||
public void drive() { | ||
TrajectorySequenceBuilder trajBuilder = getRobot().getDrive().trajectorySequenceBuilder(getRobot().getDrive().getPoseEstimate()); | ||
|
||
if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.BLUE_BOARD) { | ||
if (propPosition == TensorFlowDetection.PropPosition.LEFT) { | ||
trajBuilder = trajBuilder.lineTo(new Vector2d(3 * 12 + 7, 5 * 12 + 4)); | ||
} else if (propPosition == TensorFlowDetection.PropPosition.RIGHT) { | ||
trajBuilder = trajBuilder.lineTo(new Vector2d(3 * 12 + 7, -5 * 12 + 4)); | ||
} else { | ||
// CENTER, drive straight forward | ||
trajBuilder = trajBuilder.lineTo(BLUE_BOARD_CENTER_LINE); | ||
} | ||
} | ||
|
||
TrajectorySequence traj = trajBuilder.build(); | ||
getRobot().getDrive().followTrajectorySequence(traj); | ||
|
||
// trajBuilder = trajBuilder.lineTo(new Vector2d(startPose.getX(), -2*12 - 3)); | ||
// .addTemporalMarker(() -> { | ||
// Log.i("DROP", "dropping purple"); | ||
// purpleServo.setPosition(1); | ||
// }) | ||
// .waitSeconds(1) | ||
// .lineTo(new Vector2d(startPose.getX(), -5 * 12+3)) | ||
// .turn(Math.toRadians(90)) | ||
// .lineTo(new Vector2d(3*12+7, -5*12+4)) | ||
// .build(); | ||
|
||
} | ||
} |