Skip to content

Commit 10c02e2

Browse files
committed
synchro
1 parent 4c8a13a commit 10c02e2

File tree

5 files changed

+37
-18
lines changed

5 files changed

+37
-18
lines changed

src/main/java/frc/team5115/Constants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public static enum Mode {
3636
public static final byte DEALGAE_REVERSE_CHANNEL = 3;
3737

3838
public static final byte ARM_MOTOR_ID = 11;
39+
public static final double ARM_STOW_ANGLE_DEG = 75.0;
40+
public static final double ARM_DEPLOY_ANGLE_DEG = 0.0;
41+
3942
public static final byte INTAKE_MOTOR_ID = 12;
43+
public static final double INTAKE_SPEED = 0.15;
4044

4145
public static final byte BLOCK_ACTUATOR_ID = 9;
4246

src/main/java/frc/team5115/RobotContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public class RobotContainer {
6969
private boolean slowMode = false;
7070
private boolean hasFaults = true;
7171
private double faultPrintTimeout = 0;
72+
private boolean intakeMode = false;
7273

7374
/** The container for the robot. Contains subsystems, OI devices, and commands. */
7475
public RobotContainer() {

src/main/java/frc/team5115/commands/DriveCommands.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@
88
import edu.wpi.first.math.kinematics.ChassisSpeeds;
99
import edu.wpi.first.wpilibj2.command.Command;
1010
import edu.wpi.first.wpilibj2.command.Commands;
11+
import frc.team5115.Constants;
1112
import frc.team5115.Constants.SwerveConstants;
13+
import frc.team5115.subsystems.arm.Arm;
1214
import frc.team5115.subsystems.drive.Drivetrain;
15+
import frc.team5115.subsystems.intakewheel.IntakeWheel;
16+
17+
1318
import java.util.function.BooleanSupplier;
1419
import java.util.function.DoubleSupplier;
1520

@@ -68,20 +73,18 @@ public static Command joystickDrive(
6873
drivetrain);
6974
}
7075

71-
// public static Command cleanStart(
72-
// Height height, Elevator elevator, Dealgaefacationinator5000 dealgae) {
73-
// return Commands.sequence(
74-
// elevator.setHeightAndWait(height, 5),
75-
// Commands.print("Cleaner at Height"),
76-
// Commands.waitSeconds(0.2),
77-
// elevator.waitForSetpoint(5),
78-
// dealgae.extend(),
79-
// elevator.setHeightAndWait((height == Height.L2 ? Height.CLEAN2 : Height.CLEAN3),
80-
// 5));
81-
// }
76+
public static Command modeSwap(boolean intakeMode, IntakeWheel intakeWheel, Arm arm) {
77+
return Commands.run(
78+
() -> {
79+
if (intakeMode) {
80+
intakeWheel.intake().execute();
81+
arm.deploy().execute();
8282

83-
// public static Command cleanEnd(Elevator elevator, Dealgaefacationinator5000 dealgae) {
84-
// return Commands.sequence(
85-
// dealgae.retract(), Commands.waitSeconds(0.5), elevator.setHeight(Height.INTAKE));
86-
// }
83+
} else {
84+
intakeWheel.stop().execute();
85+
arm.stow().execute();
86+
}
87+
},
88+
intakeWheel);
89+
}
8790
}

src/main/java/frc/team5115/subsystems/arm/Arm.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public class Arm extends SubsystemBase {
1818
private final ArmFeedforward feedforward;
1919
private final PIDController pid;
2020
private final double ks;
21+
22+
private boolean frozen = false;
2123

2224
public Arm(ArmIO io) {
2325
this.io = io;
@@ -81,7 +83,15 @@ public Command goToAngle(Rotation2d setpoint, double timeout) {
8183
}
8284

8385
public Command stow() {
84-
return setAngle(Rotation2d.fromDegrees(75.0));
86+
return setAngle(Rotation2d.fromDegrees(Constants.ARM_STOW_ANGLE_DEG));
87+
}
88+
89+
public Command deploy(){
90+
return setAngle(Rotation2d.fromDegrees(Constants.ARM_DEPLOY_ANGLE_DEG));
91+
}
92+
93+
public void freeze(){
94+
frozen = true;
8595
}
8696

8797
public void stop() {

src/main/java/frc/team5115/subsystems/intakewheel/IntakeWheel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
import edu.wpi.first.wpilibj2.command.Command;
55
import edu.wpi.first.wpilibj2.command.Commands;
66
import edu.wpi.first.wpilibj2.command.SubsystemBase;
7+
import frc.team5115.Constants;
8+
79
import java.util.ArrayList;
810
import java.util.function.BooleanSupplier;
911
import org.littletonrobotics.junction.Logger;
1012

1113
public class IntakeWheel extends SubsystemBase {
12-
private static final double INTAKE_SPEED = 0.15;
1314
private final IntakeWheelIO io;
1415
private final IntakeWheelIOInputsAutoLogged inputs = new IntakeWheelIOInputsAutoLogged();
1516

@@ -28,7 +29,7 @@ public Command setSpeed(double speed) {
2829
}
2930

3031
public Command intake() {
31-
return setSpeed(INTAKE_SPEED);
32+
return setSpeed(Constants.INTAKE_SPEED);
3233
}
3334

3435
public Command vomit() {

0 commit comments

Comments
 (0)