Skip to content

Commit 7fbc48a

Browse files
committed
2 parents 89d97c2 + 10c02e2 commit 7fbc48a

File tree

5 files changed

+53
-18
lines changed

5 files changed

+53
-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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
import frc.team5115.Constants.AutoConstants.Side;
1313
import frc.team5115.Constants.Mode;
1414
import frc.team5115.commands.DriveCommands;
15+
import frc.team5115.subsystems.arm.Arm;
16+
import frc.team5115.subsystems.arm.ArmIO;
17+
import frc.team5115.subsystems.arm.ArmIOSim;
18+
import frc.team5115.subsystems.arm.ArmIOSparkMax;
1519
import frc.team5115.subsystems.bling.Bling;
1620
import frc.team5115.subsystems.bling.BlingIO;
1721
import frc.team5115.subsystems.bling.BlingIOReal;
@@ -22,6 +26,10 @@
2226
import frc.team5115.subsystems.drive.ModuleIO;
2327
import frc.team5115.subsystems.drive.ModuleIOSim;
2428
import frc.team5115.subsystems.drive.ModuleIOSparkMax;
29+
import frc.team5115.subsystems.intakewheel.IntakeWheel;
30+
import frc.team5115.subsystems.intakewheel.IntakeWheelIO;
31+
import frc.team5115.subsystems.intakewheel.IntakeWheelIOSim;
32+
import frc.team5115.subsystems.intakewheel.IntakeWheelIOSparkMax;
2533
import frc.team5115.subsystems.outtake.Outtake;
2634
import frc.team5115.subsystems.outtake.OuttakeIO;
2735
import frc.team5115.subsystems.outtake.OuttakeIOReal;
@@ -46,6 +54,8 @@ public class RobotContainer {
4654
private final PhotonVision vision;
4755
private final Bling bling;
4856
private final Outtake outtake;
57+
private final Arm arm;
58+
private final IntakeWheel intakeWheel;
4959

5060
// Controllers
5161
private final CommandXboxController joyDrive = new CommandXboxController(0);
@@ -59,6 +69,7 @@ public class RobotContainer {
5969
private boolean slowMode = false;
6070
private boolean hasFaults = true;
6171
private double faultPrintTimeout = 0;
72+
private boolean intakeMode = false;
6273

6374
/** The container for the robot. Contains subsystems, OI devices, and commands. */
6475
public RobotContainer() {
@@ -81,6 +92,8 @@ public RobotContainer() {
8192
vision = new PhotonVision(new PhotonVisionIOReal(), drivetrain);
8293
bling = new Bling(new BlingIOReal());
8394
outtake = new Outtake(new OuttakeIOReal(hub));
95+
arm = new Arm(new ArmIOSparkMax());
96+
intakeWheel = new IntakeWheel(new IntakeWheelIOSparkMax());
8497
break;
8598
case SIM:
8699
// Sim robot, instantiate physics sim IO implementations
@@ -91,6 +104,8 @@ public RobotContainer() {
91104
vision = new PhotonVision(new PhotonVisionIOSim(), drivetrain);
92105
bling = new Bling(new BlingIOSim());
93106
outtake = new Outtake(new OuttakeIOSim());
107+
arm = new Arm(new ArmIOSim());
108+
intakeWheel = new IntakeWheel(new IntakeWheelIOSim());
94109
break;
95110

96111
default:
@@ -102,6 +117,8 @@ public RobotContainer() {
102117
vision = new PhotonVision(new PhotonVisionIO() {}, drivetrain);
103118
bling = new Bling(new BlingIO() {});
104119
outtake = new Outtake(new OuttakeIO() {});
120+
arm = new Arm(new ArmIO() {});
121+
intakeWheel = new IntakeWheel(new IntakeWheelIO() {});
105122
break;
106123
}
107124

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;
@@ -82,7 +84,15 @@ public Command goToAngle(Rotation2d setpoint, double timeout) {
8284
}
8385

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

8898
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)