Skip to content

Commit

Permalink
Set starting poses for auto routines, and flash cyan if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
james-ward authored and LucienMorey committed Mar 11, 2024
1 parent c66e2f3 commit d7a02f0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
21 changes: 18 additions & 3 deletions autonomous/autonomous.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ def __init__(self) -> None:
Path([ShootingPositions.amp_speaker_bounce]),
Path([NotePositions.amp]),
]
super().__init__(note_paths, shoot_paths)
# Start pose only needs to be on the correct half of the field,
# so choose the podium as a reference point
start_pose = Pose2d(
NotePositions.podium, rotation_to_red_speaker(NotePositions.podium)
)
super().__init__(note_paths, shoot_paths, start_pose)


class AmpCentre1(AutoBase):
Expand All @@ -52,7 +57,12 @@ def __init__(self) -> None:
Path([NotePositions.amp]),
Path([PathPositions.avoid_wall, NotePositions.amp]),
]
super().__init__(note_paths, shoot_paths)
# Start pose only needs to be on the correct half of the field,
# so choose the amp as a reference point
start_pose = Pose2d(
NotePositions.amp, rotation_to_red_speaker(NotePositions.amp)
)
super().__init__(note_paths, shoot_paths, start_pose)


class SpeakerCentre3(AutoBase):
Expand All @@ -68,7 +78,12 @@ def __init__(self) -> None:
Path([NotePositions.speaker]),
Path([PathPositions.stage_transition_N, NotePositions.speaker]),
]
super().__init__(note_paths, shoot_paths)
# Start pose only needs to be on the correct half of the field,
# so choose the speaker as a reference point
start_pose = Pose2d(
NotePositions.speaker, rotation_to_red_speaker(NotePositions.speaker)
)
super().__init__(note_paths, shoot_paths, start_pose)


class Centre3Centre5(AutoBase):
Expand Down
9 changes: 7 additions & 2 deletions components/led.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def rainbow(self) -> None:
def invalid_start(self) -> None:
self.pattern = Flash(HsvColour.RED)

def missing_start_pose(self) -> None:
self.pattern = Flash(HsvColour.CYAN)

def no_vision(self) -> None:
self.pattern = Flash(HsvColour.ORANGE)

Expand All @@ -111,7 +114,8 @@ def execute(self) -> None:


class Pattern(Protocol):
def update(self) -> Hsv: ...
def update(self) -> Hsv:
...


@dataclasses.dataclass
Expand All @@ -128,7 +132,8 @@ class TimeBasedPattern(ABC, Pattern):
clock: Callable[[], float] = time.monotonic

@abstractmethod
def update(self) -> Hsv: ...
def update(self) -> Hsv:
...


@dataclasses.dataclass
Expand Down
2 changes: 2 additions & 0 deletions robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ def disabledPeriodic(self) -> None:
self.status_lights.rainbow()
else:
self.status_lights.invalid_start()
else:
self.status_lights.missing_start_pose()

def autonomousInit(self) -> None:
pass
Expand Down

0 comments on commit d7a02f0

Please sign in to comment.