Skip to content

Commit 924a65a

Browse files
committed
feat: manual elevator now runs motion magic PIDs
1 parent 703df01 commit 924a65a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ public static class Elevator {
129129
public static final double KI = 0;
130130
public static final double KD = 0.1;
131131
public static final double KG = 0;
132-
public static final int CRUISE_VELOCITY_MPS = 80;
133-
public static final int MAXIMUM_ACCELERATION_MPS2 = 160;
134-
public static final int JERK_MP3 = 1600;
135-
public static final double SPROCKET_CIRCUMFERENCE = .0508 * Math.PI;
132+
public static final int CRUISE_VELOCITY_MPS = 2;
133+
public static final int MAXIMUM_ACCELERATION_MPS2 = 20;
134+
public static final int JERK_MP3 = 40;
135+
public static final double SPROCKET_CIRCUMFERENCE = .044 * Math.PI;
136136
public static final double MOTOR_ROTS_TO_METERS = GEAR_RATIO * SPROCKET_CIRCUMFERENCE;
137137
public static final double ERROR_TOLERANCE = 0.03;
138138
public static final double SIM_CARRIAGE_MASS_KG = 1.55; //TODO: check this number :)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public ElevatorManualCommand(Elevator elevator, CommandXboxController copilot) {
1919

2020
@Override
2121
public void execute() {
22-
elevator.setVoltage(copilot.getRightTriggerAxis() - copilot.getLeftTriggerAxis() + Constants.Elevator.KG);
22+
// elevator.setVoltage(copilot.getRightTriggerAxis() - copilot.getLeftTriggerAxis() + Constants.Elevator.KG);
23+
elevator.goToSetpoint(elevator.getSetpoint() + Constants.Elevator.CRUISE_VELOCITY_MPS*2/100*(copilot.getRightTriggerAxis()-copilot.getLeftTriggerAxis()));
2324
}
2425

2526
@Override

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class Elevator extends SubsystemBase {
1818

1919
public Elevator(ElevatorIO elevatorIO) {
2020
this.elevatorIO = elevatorIO;
21-
setVoltage(10);
2221
}
2322

2423
// periodic
@@ -48,4 +47,8 @@ public void setVoltage(double voltage) {
4847
public void stop() {
4948
elevatorIO.setVoltage(0.0);
5049
}
50+
51+
public double getSetpoint() {
52+
return setpointMeters;
53+
}
5154
}

0 commit comments

Comments
 (0)