|
6 | 6 |
|
7 | 7 | package org.frc6423.robot.subsystems.superstructure.elevator; |
8 | 8 |
|
| 9 | +import static edu.wpi.first.units.Units.Meters; |
9 | 10 | import static edu.wpi.first.units.Units.MetersPerSecond; |
10 | 11 | import static edu.wpi.first.units.Units.MetersPerSecondPerSecond; |
11 | 12 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.CANBUS; |
12 | 13 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.CHILD_MOTOR_ID; |
13 | 14 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.MAX_ACCELERATION; |
| 15 | +import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.MAX_EXTENSION_HEIGHT; |
14 | 16 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.MAX_VELOCITY; |
15 | 17 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.PARENT_MOTOR_ID; |
16 | 18 | import static org.frc6423.robot.subsystems.superstructure.elevator.Elevator.SENSOR_TO_MECH_RATIO; |
@@ -49,10 +51,13 @@ public ElevatorIOReal() { |
49 | 51 | conf.MotorOutput.NeutralMode = NeutralModeValue.Brake; |
50 | 52 | conf.MotorOutput.Inverted = InvertedValue.CounterClockwise_Positive; |
51 | 53 |
|
52 | | - conf.CurrentLimits.StatorCurrentLimit = 80.0; |
| 54 | + conf.HardwareLimitSwitch.ForwardLimitAutosetPositionEnable = true; |
| 55 | + conf.HardwareLimitSwitch.ForwardLimitAutosetPositionValue = MAX_EXTENSION_HEIGHT.in(Meters); |
| 56 | + |
53 | 57 | conf.CurrentLimits.StatorCurrentLimitEnable = true; |
54 | | - conf.CurrentLimits.SupplyCurrentLimit = 40.0; |
| 58 | + conf.CurrentLimits.StatorCurrentLimit = 80.0; |
55 | 59 | conf.CurrentLimits.SupplyCurrentLimitEnable = true; |
| 60 | + conf.CurrentLimits.SupplyCurrentLimit = 40.0; |
56 | 61 |
|
57 | 62 | conf.Feedback.SensorToMechanismRatio = SENSOR_TO_MECH_RATIO; |
58 | 63 | conf.ClosedLoopRamps.TorqueClosedLoopRampPeriod = 0.1; |
|
0 commit comments