-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made the elevator and pivot go down when needed
- Loading branch information
1 parent
f271cba
commit 2c95e5d
Showing
4 changed files
with
88 additions
and
10 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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/frc/robot/commands/AmpPreparationCommand.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,37 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands; | ||
|
||
import java.util.function.DoubleSupplier; | ||
|
||
import edu.wpi.first.wpilibj.DriverStation; | ||
import edu.wpi.first.wpilibj.DriverStation.Alliance; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import frc.robot.Constants.Elevator; | ||
import frc.robot.subsystems.DrivebaseSubsystem; | ||
import frc.robot.subsystems.ElevatorSubsystem; | ||
import frc.robot.subsystems.PivotSubsystem; | ||
import frc.robot.subsystems.ShooterSubsystem; | ||
|
||
public class AmpPreparationCommand extends SequentialCommandGroup { | ||
/** Creates a new AmpPreparationCommand. */ | ||
public AmpPreparationCommand( | ||
PivotSubsystem pivotSubsystem, | ||
ElevatorSubsystem elevatorSubsystem, | ||
ShooterSubsystem shooterSubsystem) { | ||
if (shooterSubsystem.isSerializerBeamBreakSensorTriggered()){ | ||
addCommands(new ElevatorHeightCommand(elevatorSubsystem, Elevator.AMP_HEIGHT)); | ||
} | ||
else{ | ||
addCommands( | ||
new PivotAndElevatorTransferPositionsCommand(pivotSubsystem, elevatorSubsystem) | ||
.andThen( | ||
new UnloadShooterCommand(shooterSubsystem, pivotSubsystem, elevatorSubsystem)) | ||
.andThen( | ||
new ElevatorHeightCommand(elevatorSubsystem, Elevator.AMP_HEIGHT))); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/frc/robot/commands/PivotAndElevatorTransferPositionsCommand.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,20 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; | ||
import frc.robot.subsystems.ElevatorSubsystem; | ||
import frc.robot.subsystems.PivotSubsystem; | ||
|
||
public class PivotAndElevatorTransferPositionsCommand extends ParallelCommandGroup { | ||
/** Creates a new PivotAndElevatorTransferPositionsCommand. */ | ||
public PivotAndElevatorTransferPositionsCommand( | ||
PivotSubsystem pivotSubsystem, | ||
ElevatorSubsystem elevatorSubsystem) { | ||
addCommands(new PivotAngleCommand(pivotSubsystem, 20), | ||
new ElevatorHeightCommand(elevatorSubsystem, 0)); | ||
} | ||
} |