Skip to content

Commit

Permalink
Reworked climber state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSDropBear committed Jan 20, 2024
1 parent 0d09422 commit b19e969
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions controllers/climber.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
from magicbot import StateMachine, state
from components.climb import Climber
from components.climber import ClimberComponent


class Climber(StateMachine):
climber_component: Climber
climber_component: ClimberComponent

def setup(self) -> None:
pass

@state(first=True)
def extend_hook(self) -> None:
self.next_state("retract_hook")
@state(must_finish=True, first=True)
def extend_hook(self, initial_call: bool) -> None:
if initial_call:
self.climber_component.deploy()
if self.climber_component.has_deploy_finished():
self.next_state("retract_hook")

@state(must_finish=True)
def retract_hook(self) -> None:
self.done()
def retract_hook(self, initial_call: bool) -> None:
if initial_call:
self.climber_component.retract()
if self.climber_component.has_climbed_finished:

Check failure on line 22 in controllers/climber.py

View workflow job for this annotation

GitHub Actions / mypy

"ClimberComponent" has no attribute "has_climbed_finished"; maybe "has_climb_finished"?
self.done()

0 comments on commit b19e969

Please sign in to comment.