Skip to content

Commit b0b2d7b

Browse files
committed
feat: full manual elevator command implemented
1 parent c7011e0 commit b0b2d7b

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

src/main/java/org/team1540/robot2024/Constants.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static class Elevator {
119119
public static final double CLIMBING_HOOKS_MINIMUM_HEIGHT = Units.inchesToMeters(12.0);
120120
public static final double CLIMBING_HOOKS_MAX_HEIGHT = CLIMBING_HOOKS_MINIMUM_HEIGHT + ELEVATOR_MAX_HEIGHT - ELEVATOR_MINIMUM_HEIGHT;
121121

122-
public static final double ELEVATOR_GEAR_RATIO = -1;
122+
public static final double ELEVATOR_GEAR_RATIO = 1.0;
123123
public static final int TALON_ID_1 = -1;
124124
public static final int TALON_ID_2 = -1;
125125
public static final double KS = 0.25;

src/main/java/org/team1540/robot2024/RobotContainer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.littletonrobotics.junction.networktables.LoggedDashboardNumber;
1313
import org.team1540.robot2024.commands.FeedForwardCharacterization;
1414
import org.team1540.robot2024.commands.SwerveDriveCommand;
15-
import org.team1540.robot2024.commands.elevator.ElevatorAnalog;
15+
import org.team1540.robot2024.commands.elevator.ElevatorManualCommand;
1616
import org.team1540.robot2024.subsystems.drive.*;
1717
import org.team1540.robot2024.subsystems.elevator.Elevator;
1818
import org.team1540.robot2024.subsystems.elevator.ElevatorIO;
@@ -118,7 +118,7 @@ public RobotContainer() {
118118
*/
119119
private void configureButtonBindings() {
120120
drivetrain.setDefaultCommand(new SwerveDriveCommand(drivetrain, driver));
121-
elevator.setDefaultCommand(new ElevatorAnalog(copilot, elevator));
121+
elevator.setDefaultCommand(new ElevatorManualCommand(driver, elevator)); // TODO: change back to copilot
122122
driver.x().onTrue(Commands.runOnce(drivetrain::stopWithX, drivetrain));
123123
driver.b().onTrue(
124124
Commands.runOnce(

src/main/java/org/team1540/robot2024/commands/elevator/ElevatorAnalog.java src/main/java/org/team1540/robot2024/commands/elevator/ElevatorManualCommand.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
import edu.wpi.first.wpilibj2.command.Command;
77
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
88

9-
public class ElevatorAnalog extends Command {
9+
public class ElevatorManualCommand extends Command {
1010

1111
private final Elevator elevator;
1212
private final CommandXboxController copilot;
1313

14-
public ElevatorAnalog(CommandXboxController copilot, Elevator elevator) {
14+
public ElevatorManualCommand(CommandXboxController copilot, Elevator elevator) {
1515
this.elevator = elevator;
1616
this.copilot = copilot;
1717
addRequirements(elevator);
1818
}
1919

2020
@Override
2121
public void execute() {
22-
elevator.setVoltage(copilot.getRightTriggerAxis() + Constants.Elevator.KG);
22+
elevator.setVoltage(copilot.getRightTriggerAxis() - copilot.getLeftTriggerAxis() + Constants.Elevator.KG);
2323
}
2424
}

src/main/java/org/team1540/robot2024/commands/elevator/ElevatorSetpointCommand.java

+2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
public class ElevatorSetpointCommand extends Command {
88
private final Elevator elevator;
99
private final ElevatorState state;
10+
1011
public ElevatorSetpointCommand(Elevator elevator, ElevatorState state) {
1112
this.elevator = elevator;
1213
this.state = state;
1314
addRequirements(elevator);
15+
System.out.println("Setting point, get rekt");
1416
}
1517
@Override
1618
public void initialize() {

src/main/java/org/team1540/robot2024/subsystems/elevator/Elevator.java

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class Elevator extends SubsystemBase {
1313

1414
public Elevator(ElevatorIO elevatorIO) {
1515
this.elevatorIO = elevatorIO;
16+
setVoltage(10);
1617
}
1718

1819
// periodic

src/main/java/org/team1540/robot2024/subsystems/elevator/ElevatorIOSim.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void updateInputs(ElevatorIOInputs inputs){
2323
inputs.lowerLimit = elevatorSim.hasHitLowerLimit();
2424
}
2525

26-
public void setElevatorAppliedVolts(double volts){
26+
public void setVoltage(double volts){
2727
elevatorAppliedVolts = MathUtil.clamp(volts, -12.0, 12.0); //TODO: check this range
2828
elevatorSim.setInputVoltage(elevatorAppliedVolts);
2929
}

0 commit comments

Comments
 (0)