-
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.
Merge pull request #82 from 4201VitruvianBots/elevator
elevatorrrr
- Loading branch information
Showing
6 changed files
with
205 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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.InstantCommand; | ||
import frc.robot.constants.ROBOT; | ||
import java.util.function.Consumer; | ||
import java.util.function.Supplier; | ||
|
||
public class ToggleGamePiece extends InstantCommand { | ||
private Supplier<ROBOT.GAME_PIECE> m_getGamePiece; | ||
private Consumer<ROBOT.GAME_PIECE> m_toggleGamePiece; | ||
|
||
/** Creates a new ToggleGamePiece. */ | ||
public ToggleGamePiece( | ||
Supplier<ROBOT.GAME_PIECE> getGamePiece, Consumer<ROBOT.GAME_PIECE> toggleGamePiece) { | ||
m_getGamePiece = getGamePiece; | ||
m_toggleGamePiece = toggleGamePiece; | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
if (m_getGamePiece.get() == ROBOT.GAME_PIECE.CORAL) { | ||
m_toggleGamePiece.accept(ROBOT.GAME_PIECE.ALGAE); | ||
} else { | ||
m_toggleGamePiece.accept(ROBOT.GAME_PIECE.CORAL); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.