Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
refactor: Improve robot container.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenheroux committed Apr 27, 2024
1 parent f9f4422 commit 6c05455
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,43 @@
import frc.robot.superstructure.SuperstructureState;
import frc.robot.swerve.Swerve;

/** Initializes subsystems and commands. */
/** Robot container. */
public class RobotContainer {

/** Instance variable for the robot container singleton. */
/** Robot container singleton. */
public static RobotContainer instance = null;

/** Arm subsystem reference. */
private final Arm arm;

/** Auto subsystem reference. */
private final Auto auto;

/** Intake subsystem reference. */
private final Intake intake;

/** Odometry subsystem reference. */
private final Odometry odometry;

/** Shooter subsystem reference. */
private final Shooter shooter;

/** Superstructure subsystem reference. */
private final Superstructure superstructure;

/** Swerve subsystem reference. */
private final Swerve swerve;

private final CommandXboxController driverController, operatorController;
/** Driver controller. */
private final CommandXboxController driverController;

/** Operator controller. */
private final CommandXboxController operatorController;

/** Rumble controller. Use the same port as the operator controller to vibrate the operator controller. */
private final XboxController rumbleController;

/** Creates a new instance of the robot container. */
/** Initializes the robot container. */
private RobotContainer() {
arm = Arm.getInstance();
auto = Auto.getInstance();
Expand All @@ -46,6 +64,7 @@ private RobotContainer() {
swerve = Swerve.getInstance();

driverController = new CommandXboxController(0);

operatorController = new CommandXboxController(1);
rumbleController = new XboxController(1);

Expand All @@ -55,9 +74,9 @@ private RobotContainer() {
}

/**
* Gets the instance of the robot container.
* Returns the robot container.
*
* @return the instance of the robot container.
* @return the robot container.
*/
public static RobotContainer getInstance() {
if (instance == null) {
Expand Down Expand Up @@ -101,6 +120,12 @@ private void configureBindings() {
shooter.serializedNote().whileTrue(rumble(RumbleType.kRightRumble));
}

/**
* Rumbles the controller.
*
* @param side the side of the controller to rumble.
* @return a command that rumbles the controller.
*/
public Command rumble(RumbleType side) {
return Commands.startEnd(
() -> rumbleController.setRumble(side, 1), () -> rumbleController.setRumble(side, 0));
Expand Down

0 comments on commit 6c05455

Please sign in to comment.