-
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 remote-tracking branch 'origin/chris_substeps' into main_nav
# Conflicts: # navigation/repulsorFieldPlanner.py
- Loading branch information
Showing
6 changed files
with
144 additions
and
45 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,38 @@ | ||
from wpilib import PWMMotorController | ||
from utils.constants import LED_STACK_LIGHT_CTRL_PWM | ||
from utils.singleton import Singleton | ||
from wpimath.filter import Debouncer | ||
|
||
BLINK = -1.0 | ||
GREEN = 0.35 | ||
RED = 0.03 | ||
BLUE = 0.85 | ||
OFF = 0.0 | ||
|
||
class LEDControl(metaclass=Singleton): | ||
def __init__(self): | ||
|
||
self._isAutoDrive = False | ||
self._isStuck = False | ||
self.stuckDebounce = Debouncer(0.3, Debouncer.DebounceType.kFalling) | ||
self.ctrlBlock = PWMMotorController("LEDCtrl", LED_STACK_LIGHT_CTRL_PWM) | ||
|
||
def update(self): | ||
|
||
stuckDebounced = self.stuckDebounce.calculate(self._isStuck) | ||
|
||
if(self._isAutoDrive): | ||
if(stuckDebounced): | ||
pwmVal = RED * BLINK | ||
else: | ||
pwmVal = BLUE | ||
else: | ||
pwmVal = GREEN | ||
|
||
self.ctrlBlock.set(pwmVal) | ||
|
||
def setAutoDrive(self, isAutoDrive:bool): | ||
self._isAutoDrive = isAutoDrive | ||
|
||
def setStuck(self, isStuck:bool): | ||
self._isStuck = isStuck |
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
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