Skip to content

Commit

Permalink
Merge pull request #11 from grt192/elevator-merge
Browse files Browse the repository at this point in the history
Elevator merge
  • Loading branch information
penguin212 authored Jan 31, 2024
2 parents c26c318 + 12641f6 commit 5f89a23
Show file tree
Hide file tree
Showing 10 changed files with 443 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .OutlineViewer/outlineviewer.json
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
}
}
}
}
18 changes: 18 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@
* constants are needed, to reduce verbosity.
*/
public final class Constants {
public static class ElevatorConstants {
public static final int EXTENSION_ID = 0;
public static final int EXTENSION_FOLLOW_ID = 0;

public static final float EXTENSION_LIMIT_METERS = 0;

public static final int ZERO_LIMIT_ID = 0;

public static final int GROUND_POSITION = 0;
public static final int SPEAKER_POSITION = 0;
public static final int AMP_POSITION = 0;
public static final int CHUTE_POSITION = 0;
public static final int TRAP_POSITION = 0;
public static final int START_POSITION = 0;

public static final double POSITIONCONVERSIONFACTOR = 0;
public static final double VELOCITYCONVERSIONFACTOR = 0;
}
public static class OperatorConstants {
public static final int kDriverControllerPort = 0;
}
Expand Down
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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 src/main/java/frc/robot/subsystems/Elevator/ElevatorState.java
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;
}

}
Loading

0 comments on commit 5f89a23

Please sign in to comment.