Skip to content

Commit 7874b8e

Browse files
committed
fix elevator
1 parent 01f65af commit 7874b8e

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/main/java/frc/robot/subsystems/Elevator.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,29 @@ public class Elevator extends SubsystemBase {
1313
public Elevator() {
1414
elevator = new Neo(9);
1515
elevator.setPID(0.1, 0, 0); // 😳
16+
elevator.setSoftLimit(null, 0);
1617
}
1718

1819
@Override
1920
public void periodic() {
2021
// CommandScheduler.getInstance().run(); //This method will be called once per scheduler run
2122
}
2223

23-
24-
public Command motionUp(){
25-
return runOnce(() -> elevator.set(0.5));
24+
private Command moveUpOrDown(boolean goingUp) {
25+
elevator.getPosition();
26+
if (goingUp) {
27+
return runOnce(() -> elevator.setPosition(0.8));
28+
}
29+
else {
30+
return runOnce(() -> elevator.set(0));
31+
}
2632
}
27-
28-
public Command motionDown(){
29-
return runOnce(() -> elevator.set(-0.5));
33+
34+
public Command motionUp() {
35+
return moveUpOrDown(true);
3036
}
31-
public void limits(){
32-
double maxlimit = elevator.setrotation(0.8);
33-
double minlimit = elevator.setrotation(1.0);
37+
38+
public Command motionDown() {
39+
return moveUpOrDown(false);
3440
}
35-
3641
}

0 commit comments

Comments
 (0)