Skip to content

Commit

Permalink
Working on spike autos
Browse files Browse the repository at this point in the history
  • Loading branch information
harnwalN committed Mar 9, 2024
1 parent f051480 commit 0300a0f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public Command sourceFRC6328Auto() {
rollers.setGoalCommand(Rollers.Goal.FLOOR_INTAKE))
.withTimeout(grabCenterline2.getDuration() - 1.0),

// Shoot centerline 2
// Shoot centerline 2l
Commands.waitUntil(
() ->
autoTimer.hasElapsed(
Expand Down Expand Up @@ -498,7 +498,7 @@ public Command davisEthicalAuto() {
.andThen(
// Drive sequence
Commands.sequence(
resetPose(DriveTrajectories.startingLinePodium),
resetPose(DriveTrajectories.startingLineSpike0),
Commands.startEnd(
() ->
drive.setHeadingGoal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,21 @@ public class DriveTrajectories {
public static final Pose2d startingCenterFace =
FieldConstants.Subwoofer.centerFace.transformBy(
new Transform2d(-DriveConstants.driveConfig.bumperWidthX() / 2, 0, new Rotation2d(0)));
public static final Pose2d startingLinePodium =

public static final Pose2d startingLineSpike0 =
new Pose2d(
FieldConstants.startingLineX - 0.5,
FieldConstants.Stage.podiumLeg.getY(),
Rotation2d.fromDegrees(180.0));
public static final Pose2d startingLineSpike2 =
public static final Pose2d startingLineSpike1 =
new Pose2d(
FieldConstants.startingLineX - 0.5,
FieldConstants.StagingLocations.spikeTranslations[2].getY(),
FieldConstants.StagingLocations.spikeTranslations[1].getY(),
Rotation2d.fromDegrees(180.0));
public static final Pose2d startingLineSpike12 =
public static final Pose2d startingLineSpike2 =
new Pose2d(
FieldConstants.startingLineX - 0.5,
(FieldConstants.StagingLocations.spikeTranslations[1].getY()
+ FieldConstants.StagingLocations.spikeTranslations[2].getY())
/ 2.0,
FieldConstants.StagingLocations.spikeTranslations[2].getY(),
Rotation2d.fromDegrees(180.0));

// Shooting positions
Expand Down Expand Up @@ -95,7 +94,7 @@ public class DriveTrajectories {
"davisEthicalAuto_grabCenterline0",
List.of(
PathSegment.newBuilder()
.addPoseWaypoint(getShootingPose(startingLinePodium.getTranslation()))
.addPoseWaypoint(getShootingPose(startingLineSpike0.getTranslation()))
.addTranslationWaypoint(
FieldConstants.Stage.podiumLeg
.getTranslation()
Expand Down Expand Up @@ -218,9 +217,12 @@ public class DriveTrajectories {
"sourceFRC6328_grabSpike0",
List.of(
PathSegment.newBuilder()
.addPoseWaypoint(startingSourceFace)
.addPoseWaypoint(startingLineSpike0)
.addPoseWaypoint(
spike0ShootingPose.transformBy(new Translation2d(0.8, 0.0).toTransform2d()))
new Pose2d(
FieldConstants.StagingLocations.spikeTranslations[0].plus(
new Translation2d(-0.6, 0)),
spike0ShootingPose.getRotation()))
.addPoseWaypoint(
spike0ShootingPose.transformBy(new Translation2d(0.5, 0.0).toTransform2d()))
.build()));
Expand Down Expand Up @@ -280,7 +282,7 @@ public class DriveTrajectories {
"centerSpike_grabSpike0",
List.of(
PathSegment.newBuilder()
.addPoseWaypoint(startingCenterFace)
.addPoseWaypoint(startingLineSpike1)
.addPoseWaypoint(
spike0ShootingPose.transformBy(new Translation2d(0.8, 0.0).toTransform2d()))
.addPoseWaypoint(
Expand All @@ -291,7 +293,7 @@ public class DriveTrajectories {
"ampSpike_grabSpike2",
List.of(
PathSegment.newBuilder()
.addPoseWaypoint(startingAmpFace)
.addPoseWaypoint(startingLineSpike2)
.addPoseWaypoint(
spike2ShootingPose.transformBy(new Translation2d(0.8, 0.0).toTransform2d()))
.addPoseWaypoint(
Expand Down Expand Up @@ -341,6 +343,15 @@ public class DriveTrajectories {
FieldConstants.StagingLocations.centerlineTranslations[2].getY()))
.addPoseWaypoint(stageCenterShootingPose)
.build()));

// N5_S01_C2_S2
/*paths.put("N5_S01_C2_S2"),
List.of(
PathSegment.newBuilder()
.addWaypoints(getLastWaypoint("sourceFRC6328_grabSpike1"))
.addPoseWaypoint()
)*/
}

// calculate Pose2d of robot given a translation
Expand Down

0 comments on commit 0300a0f

Please sign in to comment.