Skip to content

Commit c3b4279

Browse files
Soumik updated auto on develop as well
1 parent 9a4120d commit c3b4279

File tree

2 files changed

+61
-6
lines changed

2 files changed

+61
-6
lines changed

src/main/java/frc/robot/HeadHoncho.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -680,20 +680,37 @@ public Command autonomousScoreCommand() { {
680680
END_EFFECTOR_SUBSYSTEM.setState(EndEffectorStates.SCORE_L4);
681681
DRIVE_SUBSYSTEM.cancelAutoAlign();
682682
},
683-
() -> {
684-
LIFT_SUBSYSTEM.setState(TargetLiftStates.STOW);
685-
INTAKE_SUBSYSTEM.startIntake();
686-
END_EFFECTOR_SUBSYSTEM.requestIntake();
687-
},
683+
() -> {},
688684
this
689685
)
690686
.until(() -> {
691687
return END_EFFECTOR_SUBSYSTEM.isEmpty();
692688
})
693-
.withTimeout(0.8);
689+
.withTimeout(0.8)
690+
.andThen(
691+
Commands.startEnd(
692+
() -> {
693+
Logger.recordOutput("Auto/Command", Constants.NamedCommands.AUTO_SCORE_COMMAND_NAME);
694+
LIFT_SUBSYSTEM.setState(TargetLiftStates.PANIC);
695+
END_EFFECTOR_SUBSYSTEM.setState(EndEffectorStates.SCORE_L4);
696+
},
697+
() -> {
698+
LIFT_SUBSYSTEM.setState(TargetLiftStates.STOW);
699+
INTAKE_SUBSYSTEM.startIntake();
700+
END_EFFECTOR_SUBSYSTEM.requestIntake();
701+
},
702+
this
703+
)
704+
.until(() -> {
705+
return END_EFFECTOR_SUBSYSTEM.isEmpty();
706+
})
707+
.withTimeout(0.5));
694708
}
695709
}
696710

711+
712+
713+
697714
/**
698715
* Sets the intake and end effector subsystems to intake state in autonomous
699716
* @return Command which sets the intake and end-effector to the intake state in autonomous

src/main/java/frc/robot/subsystems/lift/LiftSubsystem.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static enum TargetLiftStates {
5454
L2,
5555
L3,
5656
L4,
57+
PANIC,
5758
A1,
5859
A2,
5960
A_SCORE,
@@ -97,6 +98,7 @@ public static enum TargetLiftStates {
9798
static final Distance CLEAR_HEIGHT = LiftSubsystem.convertToDistance(Rotations.of(3.824)).minus(Inches.of(1.375));
9899
static final Distance L3_HEIGHT = LiftSubsystem.convertToDistance(Rotations.of(0));
99100
static final Distance L4_HEIGHT = LiftSubsystem.convertToDistance(Rotations.of(4.49)).minus(Inches.of(1.625));
101+
static final Distance PANIC_HEIGHT = LiftSubsystem.convertToDistance(Rotations.of(4.5)).minus(Inches.of(1.125));
100102
static final Distance TURBO_HEIGHT = L4_HEIGHT;
101103
static final Distance A1_HEIGHT = LiftSubsystem.convertToDistance(Rotations.of(0.45)).minus(Inches.of(0.375));
102104
static final Distance A2_HEIGHT = LiftSubsystem.convertToDistance(Rotations.of(2.65678)).minus(Inches.of(0.375));
@@ -1172,6 +1174,42 @@ public SystemState nextState() {
11721174
if (nextState == TargetLiftStates.TURBO) {
11731175
return L4_TURBO_S1;
11741176
}
1177+
if (nextState == TargetLiftStates.PANIC) {
1178+
return PANIC;
1179+
}
1180+
return this;
1181+
}
1182+
},
1183+
PANIC {
1184+
@Override
1185+
public void initialize() {
1186+
s_liftinstance.setElevatorHeight(PANIC_HEIGHT);
1187+
s_liftinstance.setArmAngle(SCORING_L4_ANGLE);
1188+
}
1189+
1190+
@Override
1191+
public void execute() {
1192+
isLiftReady = true;
1193+
}
1194+
1195+
@Override
1196+
public SystemState nextState() {
1197+
curState = TargetLiftStates.PANIC;
1198+
if (nextState == TargetLiftStates.STOW) {
1199+
return L4_STOW_S1;
1200+
}
1201+
if (nextState == TargetLiftStates.L1) {
1202+
return L4_L1_S1;
1203+
}
1204+
if (nextState == TargetLiftStates.L2) {
1205+
return L4_L2_S1;
1206+
}
1207+
if (nextState == TargetLiftStates.L3) {
1208+
return L4_L3_S1;
1209+
}
1210+
if (nextState == TargetLiftStates.TURBO) {
1211+
return L4_TURBO_S1;
1212+
}
11751213
return this;
11761214
}
11771215
},

0 commit comments

Comments
 (0)