Skip to content

Commit

Permalink
Add intake subsystem to RobotContainer.java (#60)
Browse files Browse the repository at this point in the history
# Description

This pull request adds the intake subsystem to the robot container,
allowing the intake to be used.

Scoring states have also been updated to be publicly accessible

Fixes #53 

## Type of change

Please delete options that are not relevant.

- [X] New feature (non-breaking change which adds functionality)

# Checklist:

- [X] My code follows the style guidelines of this project
- [X] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [X] I have made corresponding changes to the documentation, if any
- [X] My changes generate no new warnings
- [X] I have performed tests that prove my fix is effective or that my
feature works, if necessary
- [X] New and existing unit tests pass locally with my changes

---------

Co-authored-by: github-actions <>
  • Loading branch information
HoodieRocks authored Jan 6, 2024
1 parent 8ea1b85 commit 7dc84b0
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 14 deletions.
18 changes: 18 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import com.ctre.phoenix6.mechanisms.swerve.SwerveModule.DriveRequestType;
import com.ctre.phoenix6.mechanisms.swerve.SwerveRequest;

import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import frc.robot.subsystems.drive.DriveConstants;
import frc.robot.subsystems.drive.DriveSubsystem;
import frc.robot.subsystems.intake.IntakeSubsystem;
import frc.robot.subsystems.intake.enums.IntakeGamepiece;
import frc.robot.subsystems.intake.states.scoring.cone.HighCone;
import frc.robot.subsystems.led.LEDSubsystem;

public class RobotContainer {
Expand All @@ -20,6 +24,9 @@ private class Controller {
}

private final LEDSubsystem ledSubsystem;
private final IntakeSubsystem intakeSubsystem;

private final PowerDistribution pdp = new PowerDistribution();

// Set up the base for the drive and drivetrain
final DriveSubsystem drivetrain = DriveConstants.DriveTrain;
Expand Down Expand Up @@ -57,11 +64,22 @@ private void configureBindings() {
// (left)
)
.ignoringDisable(true));

Controller.operator
.yellowButton()
.toggleOnTrue(intakeSubsystem.intakeHoldCommand(IntakeGamepiece.CONE));
Controller.operator
.blueButton()
.toggleOnTrue(intakeSubsystem.intakeHoldCommand(IntakeGamepiece.CUBE));
Controller.operator
.greenButton()
.toggleOnTrue(intakeSubsystem.intakeScoreCommand(new HighCone(), IntakeGamepiece.CONE));
}

public RobotContainer() {
configureBindings();
ledSubsystem = new LEDSubsystem();
intakeSubsystem = new IntakeSubsystem(pdp);
}

public Command getAutonomousCommand() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public Command stopIntakeCommand() {
* @param expectedPiece the type of gamepiece to expect when scoring
* @return a command that scores a gamepiece
*/

public Command intakeScoreCommand(ScoringState scoringState, IntakeGamepiece expectedGamepiece) {

SmartDashboard.putString("INTAKE STATE", scoringState.getStateName());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package frc.robot.subsystems.intake.states;


import frc.robot.subsystems.intake.enums.IntakeGamepiece;


public abstract class ScoringState {
double outtakeSpeed;
double cubeOuttakeSpeed;
Expand Down Expand Up @@ -48,7 +46,6 @@ public String getStateName() {
* Gets the outtake speed for the scoring state depending on the gamepiece that is expected to be
* scored
*
* @param expectedGamepiece The gamepiece that is expected to be scored
* @return The outtake speed for the scoring state
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class HighCone extends ScoringState {

HighCone() {
public HighCone() {
super(IntakeConstants.OuttakeSpeeds.HIGH_CONE, "High Cone");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class HighConeAuto extends ScoringState {

HighConeAuto() {
public HighConeAuto() {
super(IntakeConstants.OuttakeSpeeds.HIGH_CONE_AUTO, "High Cone Auto");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class MidCone extends ScoringState {

MidCone() {
public MidCone() {
super(IntakeConstants.OuttakeSpeeds.MID_CONE, "Mid Cone");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class MidConeTipped extends ScoringState {

MidConeTipped() {
public MidConeTipped() {
super(IntakeConstants.OuttakeSpeeds.MID_CONE_TIPPED, "Mid Cone Tipped");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class HighCube extends ScoringState {

HighCube() {
public HighCube() {
super(IntakeConstants.OuttakeSpeeds.HIGH_CUBE, "High Cube");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class HighCubeAuto extends ScoringState {

HighCubeAuto() {
public HighCubeAuto() {
super(IntakeConstants.OuttakeSpeeds.HIGH_CUBE, "High Cube Auto");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class MidCube extends ScoringState {

MidCube() {
public MidCube() {
super(IntakeConstants.OuttakeSpeeds.MID_CUBE, "Mid Cube");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class MidCubeAuto extends ScoringState {

MidCubeAuto() {
public MidCubeAuto() {
super(IntakeConstants.OuttakeSpeeds.MID_CUBE, "Mid Cube Auto");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class Low extends ScoringState {

Low() {
public Low() {
super(IntakeConstants.OuttakeSpeeds.LOW_CUBE, IntakeConstants.OuttakeSpeeds.LOW_CONE, "Low");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public class LowAuto extends ScoringState {

LowAuto() {
public LowAuto() {
super(
IntakeConstants.OuttakeSpeeds.LOW_CUBE_AUTO,
IntakeConstants.OuttakeSpeeds.LOW_CONE_AUTO,
Expand Down

0 comments on commit 7dc84b0

Please sign in to comment.