Skip to content

Commit 968c67f

Browse files
committed
Algae one piece center auto
1 parent 7161d56 commit 968c67f

File tree

4 files changed

+112
-43
lines changed

4 files changed

+112
-43
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"version": "2025.0",
3+
"command": {
4+
"type": "sequential",
5+
"data": {
6+
"commands": [
7+
{
8+
"type": "path",
9+
"data": {
10+
"pathName": "OneP Center"
11+
}
12+
},
13+
{
14+
"type": "path",
15+
"data": {
16+
"pathName": "One piece part 2 barge"
17+
}
18+
},
19+
{
20+
"type": "path",
21+
"data": {
22+
"pathName": "One piece part 3 barge"
23+
}
24+
},
25+
{
26+
"type": "path",
27+
"data": {
28+
"pathName": "One piece part 4 barge"
29+
}
30+
}
31+
]
32+
}
33+
},
34+
"resetOdom": true,
35+
"folder": null,
36+
"choreoAuto": false
37+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"version": "2025.0",
3+
"waypoints": [
4+
{
5+
"anchor": {
6+
"x": 7.408,
7+
"y": 5.134
8+
},
9+
"prevControl": null,
10+
"nextControl": {
11+
"x": 7.523031014796091,
12+
"y": 6.049442112922044
13+
},
14+
"isLocked": false,
15+
"linkedName": null
16+
},
17+
{
18+
"anchor": {
19+
"x": 6.041803278688524,
20+
"y": 6.788165983606557
21+
},
22+
"prevControl": {
23+
"x": 7.339851338398133,
24+
"y": 6.1537541705130065
25+
},
26+
"nextControl": null,
27+
"isLocked": false,
28+
"linkedName": null
29+
}
30+
],
31+
"rotationTargets": [],
32+
"constraintZones": [],
33+
"pointTowardsZones": [],
34+
"eventMarkers": [],
35+
"globalConstraints": {
36+
"maxVelocity": 4.752,
37+
"maxAcceleration": 5.0,
38+
"maxAngularVelocity": 540.0,
39+
"maxAngularAcceleration": 720.0,
40+
"nominalVoltage": 12.0,
41+
"unlimited": false
42+
},
43+
"goalEndState": {
44+
"velocity": 0,
45+
"rotation": 178.91907581333933
46+
},
47+
"reversed": false,
48+
"folder": null,
49+
"idealStartingState": {
50+
"velocity": 0,
51+
"rotation": 0.0
52+
},
53+
"useDefaultConstraints": true
54+
}

src/main/java/team1403/robot/RobotContainer.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,13 @@ private Command getAlignCommandCenter() {
207207
return Commands.sequence(
208208
Blackbox.setAligningCmd(true),
209209
new DeferredCommand(() -> {
210-
211210
Pose2d currentPose = m_swerve.getPose();
212211
Pose2d target = Blackbox.getNearestAlignPositionReef(currentPose);
213-
if (target == null) return Commands.none();
214-
215-
212+
if (target == null) return Commands.none();
216213
target = CougarUtil.addDistanceToPoseLeft(target,((m_coralIntake.getAlignOffset() - 0.201)) + 0.13);
217214
target = CougarUtil.addDistanceToPose(target, 0.15);
218-
219-
220215
Command finalAlign = new AlignCommand(m_swerve, target);
221216
if (DriverStation.isAutonomous()) finalAlign = finalAlign.withTimeout(timeout);
222-
223217
if(CougarUtil.getDistance(target, m_swerve.getPose()) > 0.2)
224218
return Commands.sequence(
225219
AutoBuilder.pathfindToPose(target, TunerConstants.kAutoAlignConstraints),
@@ -524,14 +518,22 @@ private void configureBindings() {
524518
NamedCommands.registerCommand("ReefAlignR", getAlignCommand(Blackbox.ReefSelect.RIGHT));
525519
NamedCommands.registerCommand("ReefAlignCenter", getAlignCommandCenter());
526520
NamedCommands.registerCommand("Loading", Blackbox.robotStateCmd(Blackbox.State.loading));
521+
527522
NamedCommands.registerCommand("Barge L3", Commands.sequence(
528523
Blackbox.robotStateCmd(State.MoveElevator),
529-
new ElevatorCommand(m_elevator, Constants.Elevator.Setpoints.L3Algae).asProxy(),
530-
new WristCommand(m_wrist, Constants.Wrist.Setpoints.Source).asProxy()
531-
));
524+
new ElevatorCommand(m_elevator, Constants.Elevator.Setpoints.L3Algae).asProxy(),
525+
new WristCommand(m_wrist, Constants.Wrist.Setpoints.Source).asProxy()));
526+
527+
NamedCommands.registerCommand("Net Shot", Commands.sequence(
528+
Blackbox.robotStateCmd(State.MoveElevator),
529+
new ElevatorCommand(m_elevator, Constants.Elevator.Setpoints.Barge),
530+
new WristCommand(m_wrist, Constants.Wrist.Setpoints.Barge)));
532531

533-
NamedCommands.registerCommand("Algae Harvest",
534-
new CoralIntakeSpeed(m_coralIntake, Constants.CoralIntake.release).asProxy());
532+
NamedCommands.registerCommand("Algae Harvest",
533+
new CoralIntakeSpeed(m_coralIntake, Constants.CoralIntake.release).asProxy());
534+
535+
NamedCommands.registerCommand("Algae Expel",
536+
new CoralIntakeSpeed(m_coralIntake, -Constants.CoralIntake.release).asProxy());
535537

536538
NamedCommands.registerCommand("AutoWiggle",
537539
Commands.sequence(
@@ -552,12 +554,11 @@ private void configureBindings() {
552554

553555
m_autoChooser.addOption("MOVE AUTO ANYWHERE", AutoHelper.getMoveAuto(m_swerve));
554556
m_autoChooser.addOption("THREE PIECE BACK FINAL NON PROCESSOR SIDE UNTESTED", AutoHelper.getThreePieceBackNonProc(m_swerve));
555-
m_autoChooser.addOption("ONE PIECE CENTER UNTESTED", AutoHelper.getOnePCenter(m_swerve));
557+
m_autoChooser.addOption("ONE PIECE CENTER ALGAE UNTESTED", AutoHelper.getOnePCenterAlgae(m_swerve));
556558
m_autoChooser.addOption("THREE PIECE SIDE PROCESSOR UNTESTED", AutoHelper.getThreePieceSideProc(m_swerve));
557559
m_autoChooser.addOption("TWO PIECE PROCESSOR UNTESTED", AutoHelper.getTwoPieceProc(m_swerve));
558560
m_autoChooser.addOption("TWO PIECE PROCESSOR + ALGAE REMOVAL UNTESTED", AutoHelper.getTwoPieceProc_algaeRemoval(m_swerve));
559561
m_autoChooser.addOption("wiggle test", AutoHelper.wiggle(m_swerve));
560-
m_autoChooser.addOption("One piece algae", AutoHelper.getOnePCenterAlgae(m_swerve));
561562
//m_autoChooser.addOption("Testing Auto Align", AutoHelper.testAutoAlign(m_swerve));
562563
//m_autoChooser.addOption("Test 2 Piece", AutoHelper.getTwoPieceProcTest(m_swerve));
563564

src/main/java/team1403/robot/commands/auto/AutoHelper.java

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static Command getMoveAuto(SwerveSubsystem m_swerve) {
3434
});
3535
}
3636

37-
public static Command getOnePCenter(SwerveSubsystem m_swerve) {
37+
public static Command getOnePCenterAlgae(SwerveSubsystem m_swerve) {
3838
try {
3939
return Commands.sequence(
4040
Commands.parallel(
@@ -47,7 +47,6 @@ public static Command getOnePCenter(SwerveSubsystem m_swerve) {
4747
NamedCommands.getCommand("ReefAlignR"),
4848
NamedCommands.getCommand("WaitForSetpoint"),
4949
NamedCommands.getCommand("CoralScore"),
50-
Commands.waitSeconds(1),
5150
NamedCommands.getCommand("Loading"),
5251
AutoUtil.loadPathPlannerPath("One piece part 2 barge", m_swerve),
5352
NamedCommands.getCommand("Barge L3"),
@@ -57,43 +56,21 @@ public static Command getOnePCenter(SwerveSubsystem m_swerve) {
5756
Commands.sequence(
5857
Commands.waitSeconds(3.0),
5958
AutoUtil.loadPathPlannerPath("One piece part 3 barge", m_swerve),
60-
NamedCommands.getCommand("AutoBarge")
59+
NamedCommands.getCommand("Net Shot"),
60+
NamedCommands.getCommand("WaitForSetpoint"),
61+
NamedCommands.getCommand("Algae Expel")
6162
)
6263
),
64+
NamedCommands.getCommand("Loading"),
6365
AutoUtil.loadPathPlannerPath("One piece part 4 barge", m_swerve)
64-
6566
);
6667
} catch (Exception e) {
6768
System.err.println("Could not load auto: " + e.getMessage());
6869
return Commands.none();
6970
}
7071
}
7172

72-
public static Command getOnePCenterAlgae(SwerveSubsystem m_swerve) {
73-
try {
74-
return Commands.sequence(
75-
Commands.parallel(
76-
AutoUtil.loadPathPlannerPath("OneP Center", m_swerve, true),
77-
Commands.sequence(
78-
Commands.waitSeconds(0.75),
79-
NamedCommands.getCommand("CoralL4"))
80-
),
81-
NamedCommands.getCommand("ReefAlignR"),
82-
NamedCommands.getCommand("WaitForSetpoint"),
83-
NamedCommands.getCommand("CoralScore"),
84-
Commands.waitSeconds(1),
85-
NamedCommands.getCommand("Loading"),
86-
AutoUtil.loadPathPlannerPath("One piece part 2 barge", m_swerve),
87-
NamedCommands.getCommand("Barge L3")
88-
// NamedCommands.getCommand("ReefAlignCenter"),
89-
// NamedCommands.getCommand("Algae Harvest"),
90-
// Commands.waitSeconds(4)
91-
);
92-
} catch (Exception e) {
93-
System.err.println("Could not load auto: " + e.getMessage());
94-
return Commands.none();
95-
}
96-
}
73+
9774

9875
public static Command getThreePieceSideProc(SwerveSubsystem m_swerve) {
9976
try {

0 commit comments

Comments
 (0)