Skip to content

Commit

Permalink
fix elevator
Browse files Browse the repository at this point in the history
  • Loading branch information
Hadizah454 committed Jan 2, 2024
1 parent 7874b8e commit a46c028
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/main/java/frc/robot/subsystems/Elevator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,30 @@ public void periodic() {
private Command moveUpOrDown(boolean goingUp) {
elevator.getPosition();
if (goingUp) {
return runOnce(() -> elevator.setPosition(0.8));
return runOnce(() -> elevator.set(0.8));
}
else {
return runOnce(() -> elevator.set(0));
return runOnce(() -> elevator.set(-0.8));
}
}

public Command motionUp() {
return moveUpOrDown(true);
if(elevator.getPosition() >= 1) {
return runOnce(() -> elevator.set(0.5));
}
else{
return runOnce(() -> elevator.set(0));
}
// return moveUpOrDown(true);
}

public Command motionDown() {
return moveUpOrDown(false);
if (elevator.getPosition() >= 1 && elevator.getPosition() <= 9) {
return runOnce(() -> elevator.set(-0.5));
}
else{
return runOnce(() -> elevator.set(0));
}
//return moveUpOrDown(false);
}
}

0 comments on commit a46c028

Please sign in to comment.