Skip to content

Commit

Permalink
Merge pull request #15 from Creekside7688/elevator
Browse files Browse the repository at this point in the history
Elevator
  • Loading branch information
oaktrees4dawin authored Feb 4, 2024
2 parents 0e56a1c + 0a87153 commit 98dd30c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/java/frc/robot/constants/ElevatorConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ public class ElevatorConstants {
public static final double MAX_ACCELERATION = 1.0;

public static final double MAX_HEIGHT = 28.0;
public static final double TARGET_HEIGHT = 28.0;
public static final double TOLERANCE = 0.1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.elevator.Elevator;

public class ElevatorCommand extends Command {
public ElevatorCommand(Elevator elevator) {
public class ElevatorDown extends Command {

private final Elevator elevator;

public ElevatorDown(Elevator elevator) {
this.elevator = elevator;
addRequirements(elevator);
}

@Override
public void initialize() {
elevator.setHeight(0);
}

@Override
Expand All @@ -17,10 +23,11 @@ public void execute() {

@Override
public void end(boolean interrupted) {

}

@Override
public boolean isFinished() {
return false;
return elevator.atGoal();
}
}
}
33 changes: 33 additions & 0 deletions src/main/java/frc/robot/elevator/commands/ElevatorUp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package frc.robot.elevator.commands;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.elevator.Elevator;
import frc.robot.constants.ElevatorConstants;

public class ElevatorUp extends Command {

private final Elevator elevator;

public ElevatorUp(Elevator elevator) {
this.elevator = elevator;
addRequirements(elevator);
}

@Override
public void initialize() {
elevator.setHeight(ElevatorConstants.TARGET_HEIGHT);
}

@Override
public void execute() {
}

@Override
public void end(boolean interrupted) {
}

@Override
public boolean isFinished() {
return elevator.atGoal();
}
}

0 comments on commit 98dd30c

Please sign in to comment.