-
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 #10 from BHSSFRC/feature/climber
Basic climber subsystem
- Loading branch information
Showing
5 changed files
with
87 additions
and
1 deletion.
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
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,27 @@ | ||
package frc.robot.commands.climb; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
import frc.robot.subsystems.Climber; | ||
|
||
/** | ||
* Command to shift the climber in or out. | ||
*/ | ||
public class Shift extends Command { | ||
|
||
private boolean value; | ||
|
||
public Shift(boolean engaged) { | ||
requires(Climber.getInstance()); | ||
this.value = engaged; | ||
} | ||
|
||
@Override | ||
protected void execute() { | ||
Climber.getInstance().setShifter(this.value); | ||
} | ||
|
||
@Override | ||
protected boolean isFinished() { | ||
return 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
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 @@ | ||
package frc.robot.subsystems; | ||
|
||
import edu.wpi.first.wpilibj.Solenoid; | ||
import edu.wpi.first.wpilibj.command.Subsystem; | ||
import frc.robot.RobotMap; | ||
|
||
public class Climber extends Subsystem { | ||
|
||
private Solenoid shifter; | ||
|
||
private static Climber INSTANCE = new Climber(); | ||
|
||
private Climber() { | ||
this.shifter = new Solenoid(RobotMap.CLIMBER.SHIFTER_CHANNEL); | ||
} | ||
|
||
public void setShifter(boolean engaged) { | ||
this.shifter.set(engaged); | ||
} | ||
|
||
public boolean isEngaged() { | ||
return this.shifter.get(); | ||
} | ||
|
||
public static Climber getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
@Override | ||
protected void initDefaultCommand() { | ||
} | ||
|
||
@Override | ||
protected Object clone() throws CloneNotSupportedException { | ||
throw new CloneNotSupportedException(); | ||
} | ||
} |