Skip to content

Commit 3d0c3af

Browse files
authored
Merge pull request #72 from strykeforce/l1-positions
Level 1 - New End Effector
2 parents 998dfba + 2019ce9 commit 3d0c3af

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

src/main/java/frc/robot/constants/AlgaeConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class AlgaeConstants {
3232
public static final double kProcessorScoreSpeed = -1;
3333
public static final double kCoralScoreSpeed = 0.5;
3434
public static final double kIntakingSpeed = 1; // 0.75
35-
public static final double kCoralIntakingSpeed = -0.75;
35+
public static final double kCoralIntakingSpeed = -0.3; // -0.75;
3636

3737
public static final double kHasAlgaeVelThreshold = 70; // 10
3838
public static final double kSuperCycleHasAlgaeVelThres = 40; // was 40

src/main/java/frc/robot/constants/RobotConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public static TalonFXSConfiguration getFXSConfig() {
349349

350350
public static class CompConstants {
351351
public static Angle kElevatorFunnelSetpoint = Rotations.of(0.3676757);
352-
public static Angle kElevatorL1LoadSetpoint = Rotations.of(1.84);
352+
public static Angle kElevatorL1LoadSetpoint = Rotations.of(0.63);
353353
public static Angle kElevatorStowSetpoint = kElevatorFunnelSetpoint;
354354

355355
// Biscuit
@@ -366,7 +366,7 @@ public static class CompConstants {
366366
// Idle
367367
public static Angle kBiscuitStowSetpoint = Rotations.of(1.862 / 2);
368368
public static Angle kFunnelSetpoint = kBiscuitStowSetpoint;
369-
public static Angle kL1CoralLoadSetpoint = Rotations.of(8.078);
369+
public static Angle kL1CoralLoadSetpoint = Rotations.of(6.29); // 0.05 is about an inch
370370
public static Angle kPrestageSetpoint = Rotations.of(-2.94);
371371
public static Angle kPrestageAlgaeSetpoint = kBiscuitStowSetpoint;
372372

src/main/java/frc/robot/constants/RobotStateConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public class RobotStateConstants {
3030
public static final double kClimbAngleSmall = -0.235; // -0.245
3131
public static final double kClimbAngleBig = -0.213; // -0.215
3232

33+
// Funnel load algae on
34+
public static final double kL1FunnelLoadX = 2.5;
35+
3336
// Offsets
3437
public static final Angle kStuckCoralElevatorOffset = Rotations.of(3.746);
3538
public static final Angle[][][] kBlueCoralElevatorOffset = {

src/main/java/frc/robot/subsystems/robotState/RobotStateSubsystem.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import frc.robot.constants.RobotStateConstants;
1616
import frc.robot.constants.TagServoingConstants;
1717
import frc.robot.subsystems.algae.AlgaeSubsystem;
18+
import frc.robot.subsystems.algae.AlgaeSubsystem.AlgaeStates;
1819
import frc.robot.subsystems.battMon.BattMonSubsystem;
1920
import frc.robot.subsystems.biscuit.BiscuitSubsystem;
2021
import frc.robot.subsystems.climb.ClimbAlignSubsystem;
@@ -463,13 +464,14 @@ public void toFunnelLoad() {
463464

464465
if (scoringLevel == ScoringLevel.L1) {
465466
elevatorSubsystem.setPosition(RobotConstants.kElevatorL1LoadSetpoint);
466-
algaeSubsystem.intakeCoral();
467+
467468
funnelSubsystem.reverse();
468469
coralSubsystem.stop();
469470

470471
setState(RobotStates.TO_ALGAE_CORAL_LOAD, false);
471472
} else {
472473
setBiscuitTransfer(RobotConstants.kFunnelSetpoint, true);
474+
algaeSubsystem.holdAlgae();
473475
elevatorSubsystem.setPosition(RobotConstants.kElevatorFunnelSetpoint);
474476
coralSubsystem.intake();
475477
setState(RobotStates.FUNNEL_LOAD, true);
@@ -1116,6 +1118,20 @@ public void periodic() {
11161118
if (scoringLevel != ScoringLevel.L1) {
11171119
toFunnelLoad();
11181120
}
1121+
1122+
double currentX = driveSubsystem.getPoseMeters().getX();
1123+
1124+
if (allianceColor == Alliance.Blue && currentX < RobotStateConstants.kL1FunnelLoadX
1125+
|| allianceColor == Alliance.Red
1126+
&& currentX > (DriveConstants.kFieldMaxX - RobotStateConstants.kL1FunnelLoadX)) {
1127+
if (algaeSubsystem.getState() != AlgaeStates.CORAL_INTAKE
1128+
&& algaeSubsystem.getState() != AlgaeStates.HAS_CORAL) {
1129+
algaeSubsystem.intakeCoral();
1130+
}
1131+
} else if (algaeSubsystem.getState() == AlgaeStates.CORAL_INTAKE) {
1132+
algaeSubsystem.holdAlgae();
1133+
}
1134+
11191135
if (algaeSubsystem.hasCoral()) {
11201136
coralLoc = CoralLoc.ALGAE;
11211137
toPrestage();

0 commit comments

Comments
 (0)