File tree Expand file tree Collapse file tree
src/main/java/frc/robot/subsystems/elevator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public Command setElevatorPositionCommand(ElevatorHeight height) {
5757 public enum ElevatorHeight {
5858 // Positions taken from offseason bot code, inturn taken from onshape.
5959 UP (Inches .of (56.0 )),
60- MIDDLE (Inches .of (4 .0 )),
60+ MIDDLE (Inches .of (28 .0 )),
6161 DOWN (Inches .of (0.0 ));
6262
6363 public final Distance position ;
@@ -71,8 +71,9 @@ public Distance getPosition() {
7171 }
7272
7373 public Angle getPositionAngle () {
74- // NOTE: yes this code is bs, but i wanna see it work first.
75- return Rotations .of (getPosition ().in (Inches ) / ElevatorConstants .ELEVATOR_HEIGHT_CHANGE_PER_MOTOR_ROTATION );
74+ // NOTE: Divide by 2 because the motor controls the first stage only, not the second stage
75+ return Rotations .of (
76+ (getPosition ().in (Inches ) / 2 ) / ElevatorConstants .ELEVATOR_HEIGHT_CHANGE_PER_MOTOR_ROTATION );
7677 }
7778 }
7879}
Original file line number Diff line number Diff line change @@ -17,13 +17,14 @@ public class ElevatorConstants {
1717 // Correct calculation for Inches of travel per 1 Motor Rotation:
1818 // (2 * pi * Spool Radius) / Gearing
1919 // NOTE to daniel: Will need to recalculate this with the new ELEVATOR_SPOOL_RADIUS
20- public static final double ELEVATOR_HEIGHT_CHANGE_PER_MOTOR_ROTATION = 0.349727 ;
20+ public static final double ELEVATOR_HEIGHT_CHANGE_PER_MOTOR_ROTATION = 0.681933 ; // 0.272049
2121
2222 // Guess what, I asked design again.
2323 public static final Distance ELEVATOR_SPOOL_RADIUS = Inches .of (0.8755 );
2424
2525 public static final Distance ELEVATOR_MIN_HEIGHT = Inches .of (0.0 );
26- public static final Distance ELEVATOR_MAX_HEIGHT = Inches .of (56.0 );
26+ public static final Distance ELEVATOR_MAX_HEIGHT =
27+ Inches .of (28.0 ); // This is the max height of the first stage, which we simulate.
2728
2829 public static final double ELEVATOR_kG = 0.0 ; // 0.29
2930 public static final double ELEVATOR_kS = 0.0 ; // 0.11
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ public Distance getCarriagePosition() {
8181 }
8282
8383 private static Distance motorRotationToCarriagePosition (Angle motorPosition ) {
84- return Inches .of (motorPosition .in (Rotations ) * ELEVATOR_HEIGHT_CHANGE_PER_MOTOR_ROTATION );
84+ return Inches .of (motorPosition .in (Rotations ) * ELEVATOR_HEIGHT_CHANGE_PER_MOTOR_ROTATION )
85+ .times (2 );
8586 }
8687}
You can’t perform that action at this time.
0 commit comments