-
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 pull request #49 from svhsrobotics/robotica-split
- Loading branch information
Showing
65 changed files
with
3,154 additions
and
1,240 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
24 changes: 24 additions & 0 deletions
24
MeepMeepTesting/src/main/java/com/example/meepmeeptesting/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.example.meepmeeptesting; | ||
|
||
import com.acmerobotics.roadrunner.geometry.Vector2d; | ||
|
||
public abstract class Component { | ||
static Vector2d BLUE_BOARD_CENTER_LINE = new Vector2d(12, 24.5); | ||
static Vector2d BLUE_BOARD_LEFT_LINE = new Vector2d(23, 30); | ||
static Vector2d BLUE_BOARD_RIGHT_LINE = new Vector2d(1, 30); | ||
static Vector2d RED_BOARD_CENTER_LINE = new Vector2d(12, -24.5); | ||
// LEFT MISSING | ||
static Vector2d RED_BOARD_RIGHT_LINE = new Vector2d(23, -30); | ||
//static Vector2d RED_AUDIENCE_CENTER_LINE = new Vector2d(12, -24.5); | ||
|
||
private final Robot robot; | ||
protected Component(Robot robot) { | ||
this.robot = robot; | ||
} | ||
|
||
protected Robot getRobot() { | ||
return robot; | ||
} | ||
|
||
public abstract void drive(); | ||
} |
51 changes: 51 additions & 0 deletions
51
MeepMeepTesting/src/main/java/com/example/meepmeeptesting/DriveShimShim.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,51 @@ | ||
package com.example.meepmeeptesting; | ||
|
||
import com.acmerobotics.roadrunner.geometry.Pose2d; | ||
import com.noahbres.meepmeep.roadrunner.DriveShim; | ||
import com.noahbres.meepmeep.roadrunner.trajectorysequence.TrajectorySequence; | ||
import com.noahbres.meepmeep.roadrunner.trajectorysequence.TrajectorySequenceBuilder; | ||
|
||
public class DriveShimShim { | ||
private final DriveShim driveShim; | ||
public TrajectorySequence currentTrajectorySequence; | ||
public DriveShimShim(DriveShim driveShim) { | ||
this.driveShim = driveShim; | ||
} | ||
|
||
public void followTrajectorySequence(TrajectorySequence trajectorySequence) { | ||
currentTrajectorySequence = trajectorySequence; | ||
} | ||
|
||
public TrajectorySequenceBuilder trajectorySequenceBuilder(Pose2d startPose) { | ||
return driveShim.trajectorySequenceBuilder(startPose); | ||
} | ||
|
||
public Pose2d getPoseEstimate() { | ||
return driveShim.getPoseEstimate(); | ||
} | ||
|
||
public void setPoseEstimate(Pose2d poseEstimate) { | ||
driveShim.setPoseEstimate(poseEstimate); | ||
} | ||
|
||
public static TrajectoryDrive.Quadrant whichQuadrant(Pose2d pose) { | ||
if (pose.getX() < 0) { | ||
if (pose.getY() < 0) { | ||
return TrajectoryDrive.Quadrant.RED_AUDIENCE; | ||
} else { | ||
return TrajectoryDrive.Quadrant.BLUE_AUDIENCE; | ||
} | ||
} else { | ||
if (pose.getY() < 0) { | ||
return TrajectoryDrive.Quadrant.RED_BOARD; | ||
} else { | ||
return TrajectoryDrive.Quadrant.BLUE_BOARD; | ||
} | ||
} | ||
} | ||
|
||
public TrajectoryDrive.Quadrant currentQuadrant() { | ||
return whichQuadrant(getPoseEstimate()); | ||
} | ||
|
||
} |
77 changes: 77 additions & 0 deletions
77
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,77 @@ | ||
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)) | ||
|
||
.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"); | ||
}); | ||
//.turn | ||
|
||
} | ||
|
||
TrajectorySequence traj = trajB.build(); | ||
getRobot().getDrive().followTrajectorySequence(traj); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
} |
48 changes: 32 additions & 16 deletions
48
MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepTesting.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
54 changes: 54 additions & 0 deletions
54
MeepMeepTesting/src/main/java/com/example/meepmeeptesting/ParkingOut.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,54 @@ | ||
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 ParkingOut extends Component{ | ||
|
||
protected ParkingOut(Robot robot) { | ||
super(robot); | ||
} | ||
|
||
@Override | ||
public void drive() { | ||
|
||
//getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.BLUE_BOARD | ||
|
||
Pose2d currentPose = getRobot().getDrive().getPoseEstimate(); | ||
TrajectorySequenceBuilder trajB = getRobot().getDrive().trajectorySequenceBuilder(currentPose); | ||
|
||
|
||
|
||
if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.RED_AUDIENCE) { | ||
trajB =trajB.lineTo(new Vector2d(currentPose.getX(), -(4*12+9))) | ||
.lineTo(new Vector2d(0, -0)); | ||
} else if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.RED_BOARD) { | ||
trajB = trajB.lineTo(new Vector2d(currentPose.getX(), -56)) | ||
.lineTo(new Vector2d(36, -56)) | ||
.turn(Math.toRadians(180)) | ||
.forward(90) | ||
.turn(Math.toRadians(90)) | ||
.forward(90) | ||
.turn(Math.toRadians(90)) | ||
.forward(45) | ||
.turn(Math.toRadians(90)) | ||
.forward(90); | ||
|
||
|
||
|
||
|
||
} else if (getRobot().getDrive().currentQuadrant() == TrajectoryDrive.Quadrant.BLUE_BOARD) { | ||
trajB = trajB.lineTo(new Vector2d(currentPose.getX(), 57)) | ||
.lineTo(new Vector2d(59, 57)); | ||
} else { | ||
trajB = trajB.lineTo(new Vector2d(currentPose.getX(), 57)) | ||
.lineTo(new Vector2d(59, 57)); | ||
} | ||
TrajectorySequence traj = trajB.build(); | ||
getRobot().getDrive().followTrajectorySequence(traj); | ||
} | ||
//ryan i had to fix ur code it didn't copy ParkingIn correctly - not the values just formatting | ||
} | ||
|
Oops, something went wrong.