This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
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.
- Loading branch information
Jack Jewett
committed
Feb 27, 2024
1 parent
9952262
commit fc77a47
Showing
4 changed files
with
64 additions
and
6 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,29 @@ | ||
import logging | ||
import commands2 | ||
|
||
|
||
class FlyUntilTrigger(commands2.Command): | ||
def __init__(self, speed, subsystem): | ||
super().__init__() | ||
|
||
# local subsystem instance | ||
self.subsystem = subsystem | ||
|
||
# requested speed | ||
self.speed = speed | ||
|
||
def initialize(self): | ||
logging.info("Spinning up...") | ||
|
||
def execute(self): | ||
self.subsystem.setFlyWheelSpeed(self.speed) | ||
print(self.subsystem.switchPress()) | ||
|
||
def isFinished(self): | ||
return self.subsystem.switchPress() | ||
|
||
def end(self, interrupted: bool): | ||
self.subsystem.setFlyWheelSpeed(0) | ||
logging.info(f"Done, up to speed is {self.isFinished()}") | ||
# self.subsystem.setFlyWheelSpeed(0) | ||
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
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