Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into advantage_kit
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSimon8 committed Feb 8, 2025
2 parents 8569e3e + d93df11 commit ad25c4e
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 10 deletions.
1 change: 1 addition & 0 deletions Team-3749-2025/simgui-ds.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
],
"robotJoysticks": [
{

"guid": "Keyboard0"
}
]
Expand Down
1 change: 1 addition & 0 deletions Team-3749-2025/src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import frc.robot.subsystems.elevator.Elevator;
import frc.robot.subsystems.arm.climb.ClimbArm;
import frc.robot.subsystems.arm.coral.CoralArm;

import frc.robot.subsystems.roller.Roller;
import frc.robot.subsystems.roller.implementations.AlgaeRoller;
import frc.robot.subsystems.roller.implementations.CoralRoller;
Expand Down
2 changes: 1 addition & 1 deletion Team-3749-2025/src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.RobotController;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.buttons.JoystickIO;
import frc.robot.commands.auto.AutoUtils;
import frc.robot.commands.auto.Autos;
import frc.robot.utils.JoystickIO;

public class RobotContainer {

Expand Down
59 changes: 59 additions & 0 deletions Team-3749-2025/src/main/java/frc/robot/buttons/ButtonBoard.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package frc.robot.buttons;

import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;

public class ButtonBoard {

public GenericHID buttonBoardPlayer1 = new GenericHID(1);
public GenericHID buttonBoardPlayer2 = new GenericHID(2);
public GenericHID buttonBoardPlayer3 = new GenericHID(3);

// coral elevator positions
public JoystickButton buttonl1 = new JoystickButton(buttonBoardPlayer3, 2);
public JoystickButton buttonl2 = new JoystickButton(buttonBoardPlayer3, 1);
public JoystickButton buttonl3 = new JoystickButton(buttonBoardPlayer1, 6);
public JoystickButton buttonl4 = new JoystickButton(buttonBoardPlayer1, 5);

// source buttons
public JoystickButton buttonRightSource = new JoystickButton(buttonBoardPlayer1, 4);
public JoystickButton buttonLeftSource = new JoystickButton(buttonBoardPlayer1, 7);

// reef positions
public JoystickButton buttonReefZoneA = new JoystickButton(buttonBoardPlayer3, 6);
public JoystickButton buttonReefZoneB = new JoystickButton(buttonBoardPlayer2, 5);
public JoystickButton buttonReefZoneC = new JoystickButton(buttonBoardPlayer2, 6);
public JoystickButton buttonReefZoneD = new JoystickButton(buttonBoardPlayer3, 3);
public JoystickButton buttonReefZoneE = new JoystickButton(buttonBoardPlayer3, 4);
public JoystickButton buttonReefZoneF = new JoystickButton(buttonBoardPlayer2, 8);
public JoystickButton buttonReefZoneG = new JoystickButton(buttonBoardPlayer2, 7);
public JoystickButton buttonReefZoneH = new JoystickButton(buttonBoardPlayer2, 4);
public JoystickButton buttonReefZoneI = new JoystickButton(buttonBoardPlayer2, 3);
public JoystickButton buttonReefZoneJ = new JoystickButton(buttonBoardPlayer2, 2);
public JoystickButton buttonReefZoneK = new JoystickButton(buttonBoardPlayer2, 1);
public JoystickButton buttonReefZoneL = new JoystickButton(buttonBoardPlayer3, 5);

// miscellaneous buttons
public JoystickButton buttonAlgaeKnockoff = new JoystickButton(buttonBoardPlayer1, 3);
public JoystickButton buttonUtilityA = new JoystickButton(buttonBoardPlayer1, 1);
public JoystickButton buttonUtilityB = new JoystickButton(buttonBoardPlayer1, 2);
public JoystickButton buttonPlayer1Start = new JoystickButton(buttonBoardPlayer1, 8);

public ButtonBoard() {
}

private ScoringMode scoringMode;

public enum ScoringMode {
L1,
L2,
L3,
L4,
ALGAE;
}

public ScoringMode getScoringMode() {
return scoringMode;
}

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package frc.robot.utils;
package frc.robot.buttons;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.Robot;


import frc.robot.commands.swerve.DriveStraight;
import frc.robot.commands.swerve.SwerveDefaultCommand;

/**
Expand All @@ -16,11 +17,12 @@
* @author Rohin Sood
* @author Noah Simon
*/
@SuppressWarnings("unused")
public class JoystickIO {

private static final CommandXboxController pilot = new CommandXboxController(0);
private static final CommandXboxController operator = new CommandXboxController(1);
private static final Command DriveStraight = new DriveStraight();
private static final ButtonBoard buttonBoard = new ButtonBoard();

public JoystickIO() {
}
Expand Down Expand Up @@ -53,6 +55,35 @@ public static void getButtonBindings() {
public static void pilotAndOperatorBindings() {
// gyro reset
pilot.start().onTrue(Commands.runOnce(() -> Robot.swerve.resetGyro()));

// Example binding
// operator.a().whileTrue(new ExampleSubsystemCommand());
buttonBoard.buttonl1.onTrue(Commands.runOnce(() -> System.out.println("1, 5")));
buttonBoard.buttonl2.onTrue(Commands.runOnce(() -> System.out.println("1, 6")));
buttonBoard.buttonl3.onTrue(Commands.runOnce(() -> System.out.println("3, 1")));
buttonBoard.buttonl4.onTrue(Commands.runOnce(() -> System.out.println("3, 2")));

buttonBoard.buttonRightSource.onTrue(Commands.runOnce(() -> System.out.println("1, 4")));
buttonBoard.buttonLeftSource.onTrue(Commands.runOnce(() -> System.out.println("1, 7")));

buttonBoard.buttonReefZoneA.onTrue(Commands.runOnce(() -> System.out.println("3, 6")));
buttonBoard.buttonReefZoneB.onTrue(Commands.runOnce(() -> System.out.println("2, 5")));
buttonBoard.buttonReefZoneC.onTrue(Commands.runOnce(() -> System.out.println("2, 6")));
buttonBoard.buttonReefZoneD.onTrue(Commands.runOnce(() -> System.out.println("3, 3")));
buttonBoard.buttonReefZoneE.onTrue(Commands.runOnce(() -> System.out.println("3, 4")));
buttonBoard.buttonReefZoneF.onTrue(Commands.runOnce(() -> System.out.println("2, 8")));
buttonBoard.buttonReefZoneG.onTrue(Commands.runOnce(() -> System.out.println("2, 7")));
buttonBoard.buttonReefZoneH.onTrue(Commands.runOnce(() -> System.out.println("2, 4")));
buttonBoard.buttonReefZoneI.onTrue(Commands.runOnce(() -> System.out.println("2, 3")));
buttonBoard.buttonReefZoneJ.onTrue(Commands.runOnce(() -> System.out.println("2, 2")));
buttonBoard.buttonReefZoneK.onTrue(Commands.runOnce(() -> System.out.println("2, 1")));
buttonBoard.buttonReefZoneL.onTrue(Commands.runOnce(() -> System.out.println("3, 5")));

buttonBoard.buttonAlgaeKnockoff.onTrue(Commands.runOnce(() -> System.out.println("1, 3")));
buttonBoard.buttonUtilityA.onTrue(Commands.runOnce(() -> System.out.println("1, 1")));
buttonBoard.buttonUtilityB.onTrue(Commands.runOnce(() -> System.out.println("1, 2")));
buttonBoard.buttonPlayer1Start.onTrue(Commands.runOnce(() -> System.out.println("1, 8")));


}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ public boolean getIsStableState() {
case L4:
return UtilityFunctions.withinMargin(0.01, data.positionMeters,
ElevatorConstants.StateHeights.l4Height);
case MAX:
return UtilityFunctions.withinMargin(0.01, data.positionMeters,
ElevatorConstants.ElevatorSpecs.maxHeightMeters);
case STOW:
return UtilityFunctions.withinMargin(0.01, data.positionMeters,
ElevatorConstants.ElevatorSpecs.baseHeight);
default:
return false;
}
Expand All @@ -136,7 +142,7 @@ public void setState(ElevatorStates state) {
this.state = state;
switch (state) {
case STOP:
runStateStop();
stop();
break;
case L1:
setGoal(ElevatorConstants.StateHeights.l1Height);
Expand All @@ -151,9 +157,11 @@ public void setState(ElevatorStates state) {
setGoal(ElevatorConstants.StateHeights.l4Height);
break;
case MAX:
setGoal(6);
setGoal(ElevatorConstants.ElevatorSpecs.maxHeightMeters);
break;
case STOW:
setGoal(ElevatorConstants.ElevatorSpecs.baseHeight);
break;
default:
setGoal(0);
break;
Expand All @@ -167,7 +175,7 @@ public void setGoal(double height) {
private void runState() {
switch (state) {
case STOP:
runStateStop();
stop();
break;
default:
moveToGoal();
Expand All @@ -185,9 +193,6 @@ private void moveToGoal() {
elevatorio.setPosition(firstState.position, ffVoltage);
}

private void runStateStop() {
stop();
}

public void stop() {
elevatorio.setVoltage(0);
Expand Down

0 comments on commit ad25c4e

Please sign in to comment.