-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from grt192/elevator-merge
Elevator merge
- Loading branch information
Showing
10 changed files
with
443 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"Clients": { | ||
"open": true | ||
}, | ||
"Connections": { | ||
"open": true | ||
}, | ||
"[email protected]:59486": { | ||
"Publishers": { | ||
"open": true | ||
}, | ||
"Subscribers": { | ||
"open": true | ||
}, | ||
"open": true | ||
}, | ||
"[email protected]:59984": { | ||
"Publishers": { | ||
"open": true | ||
}, | ||
"Subscribers": { | ||
"open": true | ||
}, | ||
"open": true | ||
}, | ||
"[email protected]:61719": { | ||
"Publishers": { | ||
"open": true | ||
}, | ||
"open": true | ||
}, | ||
"[email protected]:65507": { | ||
"Publishers": { | ||
"open": true | ||
}, | ||
"open": true | ||
}, | ||
"NetworkTables Settings": { | ||
"mode": "Client (NT4)", | ||
"serverTeam": "192" | ||
}, | ||
"Server": { | ||
"open": true | ||
}, | ||
"outlineviewer@5": { | ||
"open": true | ||
}, | ||
"retained": { | ||
"elevator": { | ||
"open": true | ||
} | ||
}, | ||
"shuffleboard@2": { | ||
"Subscribers": { | ||
"open": true | ||
} | ||
}, | ||
"transitory": { | ||
"Shuffleboard": { | ||
"Auton": { | ||
"Field": { | ||
"open": true | ||
}, | ||
"open": true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/frc/robot/commands/elevator/ElevatorSetAutoCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package frc.robot.commands.elevator; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.elevator.ElevatorSubsystem; | ||
|
||
public class ElevatorSetAutoCommand extends Command{ | ||
private ElevatorSubsystem elevatorSubsystem; | ||
public ElevatorSetAutoCommand(ElevatorSubsystem elevatorSubsystem){ | ||
this.addRequirements(elevatorSubsystem); | ||
this.elevatorSubsystem = elevatorSubsystem; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted){ | ||
return; | ||
} | ||
|
||
@Override | ||
public void execute(){ | ||
this.elevatorSubsystem.setAuto(); | ||
} | ||
|
||
public boolean isFinished(){ | ||
return true; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/frc/robot/commands/elevator/ElevatorSetManualCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package frc.robot.commands.elevator; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.elevator.ElevatorSubsystem; | ||
|
||
public class ElevatorSetManualCommand extends Command{ | ||
private ElevatorSubsystem elevatorSubsystem; | ||
public ElevatorSetManualCommand(ElevatorSubsystem elevatorSubsystem){ | ||
this.addRequirements(elevatorSubsystem); | ||
this.elevatorSubsystem = elevatorSubsystem; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted){ | ||
return; | ||
} | ||
|
||
@Override | ||
public void execute(){ | ||
this.elevatorSubsystem.setManual(); | ||
} | ||
|
||
public boolean isFinished(){ | ||
return true; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/frc/robot/commands/elevator/ElevatorToAMPCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package frc.robot.commands.elevator; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.elevator.ElevatorState; | ||
import frc.robot.subsystems.elevator.ElevatorSubsystem; | ||
|
||
public class ElevatorToAMPCommand extends Command{ | ||
private ElevatorSubsystem elevatorSubsystem; | ||
public ElevatorToAMPCommand(ElevatorSubsystem elevatorSubsystem){ | ||
this.addRequirements(elevatorSubsystem); | ||
this.elevatorSubsystem = elevatorSubsystem; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted){ | ||
return; | ||
} | ||
|
||
@Override | ||
public void execute(){ | ||
this.elevatorSubsystem.setTargetState(ElevatorState.AMP); | ||
} | ||
|
||
@Override | ||
public boolean isFinished(){ | ||
if(this.elevatorSubsystem.getState()==ElevatorState.AMP){ | ||
return true; | ||
} | ||
else return false; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/frc/robot/commands/elevator/ElevatorToChuteCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package frc.robot.commands.elevator; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.elevator.ElevatorState; | ||
import frc.robot.subsystems.elevator.ElevatorSubsystem; | ||
|
||
public class ElevatorToChuteCommand extends Command{ | ||
private ElevatorSubsystem elevatorSubsystem; | ||
public ElevatorToChuteCommand(ElevatorSubsystem elevatorSubsystem){ | ||
this.addRequirements(elevatorSubsystem); | ||
this.elevatorSubsystem = elevatorSubsystem; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted){ | ||
return; | ||
} | ||
|
||
@Override | ||
public void execute(){ | ||
this.elevatorSubsystem.setTargetState(ElevatorState.CHUTE); | ||
} | ||
|
||
@Override | ||
public boolean isFinished(){ | ||
if(this.elevatorSubsystem.getState()==ElevatorState.CHUTE){ | ||
return true; | ||
} | ||
else return false; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/frc/robot/commands/elevator/ElevatorToGroundCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package frc.robot.commands.elevator; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.elevator.ElevatorState; | ||
import frc.robot.subsystems.elevator.ElevatorSubsystem; | ||
|
||
public class ElevatorToGroundCommand extends Command{ | ||
private ElevatorSubsystem elevatorSubsystem; | ||
public ElevatorToGroundCommand(ElevatorSubsystem elevatorSubsystem){ | ||
this.addRequirements(elevatorSubsystem); | ||
this.elevatorSubsystem = elevatorSubsystem; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted){ | ||
return; | ||
} | ||
|
||
@Override | ||
public void execute(){ | ||
this.elevatorSubsystem.setTargetState(ElevatorState.GROUND); | ||
} | ||
|
||
@Override | ||
public boolean isFinished(){ | ||
if(this.elevatorSubsystem.getState()==ElevatorState.GROUND){ | ||
return true; | ||
} | ||
else return false; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/frc/robot/commands/elevator/ElevatorToSpeakerCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package frc.robot.commands.elevator; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.elevator.ElevatorState; | ||
import frc.robot.subsystems.elevator.ElevatorSubsystem; | ||
|
||
public class ElevatorToSpeakerCommand extends Command{ | ||
private ElevatorSubsystem elevatorSubsystem; | ||
public ElevatorToSpeakerCommand(ElevatorSubsystem elevatorSubsystem){ | ||
this.addRequirements(elevatorSubsystem); | ||
this.elevatorSubsystem = elevatorSubsystem; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted){ | ||
return; | ||
} | ||
|
||
@Override | ||
public void execute(){ | ||
this.elevatorSubsystem.setTargetState(ElevatorState.SPEAKER); | ||
} | ||
|
||
@Override | ||
public boolean isFinished(){ | ||
if(this.elevatorSubsystem.getState()==ElevatorState.SPEAKER){ | ||
return true; | ||
} | ||
else return false; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/frc/robot/subsystems/Elevator/ElevatorState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package frc.robot.subsystems.elevator; | ||
|
||
import edu.wpi.first.math.util.Units; | ||
|
||
import frc.robot.Constants; | ||
|
||
public enum ElevatorState { | ||
GROUND(Constants.ElevatorConstants.GROUND_POSITION), | ||
SPEAKER(Constants.ElevatorConstants.SPEAKER_POSITION), | ||
AMP(Constants.ElevatorConstants.AMP_POSITION), | ||
CHUTE(Constants.ElevatorConstants.CHUTE_POSITION), | ||
TRAP(Constants.ElevatorConstants.TRAP_POSITION), | ||
START(Constants.ElevatorConstants.START_POSITION); | ||
|
||
private final double extendDistanceMeters; | ||
|
||
private ElevatorState(double extendDistanceMeters){ | ||
this.extendDistanceMeters = extendDistanceMeters; | ||
} | ||
|
||
public double getExtension(){ | ||
return this.extendDistanceMeters; | ||
} | ||
|
||
} |
Oops, something went wrong.