Skip to content

Commit c16dbbe

Browse files
authored
Merge pull request #239 from thedropbears/add_intake_short_circuit
2 parents 4f57ad9 + 97a64e9 commit c16dbbe

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

controllers/floor_intake.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ def intake(self) -> None:
2626

2727
@state(first=True, must_finish=True)
2828
def intaking(self, initial_call: bool):
29+
# This is different to the regular business logic below because these two things are mutually exclusive unless we have already got something
30+
if initial_call and self.injector_component.has_algae():
31+
self.done()
32+
return
33+
2934
if self.injector_component.has_algae():
3035
self.next_state("measuring")
3136
return

controllers/reef_intake.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ def intaking(self, initial_call: bool):
5454
self.done()
5555
return
5656

57+
if self.injector_component.has_algae():
58+
self.done()
59+
return
60+
5761
if self.injector_component.has_algae():
5862
self.next_state("safing")
63+
return
5964

6065
nearest_tag_pose = (game.nearest_reef_tag(current_pose))[1]
6166
self.rotation_lock = nearest_tag_pose.rotation()

robot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ def testPeriodic(self) -> None:
277277
self.climber.execute()
278278
self.coral_placer_component.execute()
279279
self.shooter_component.execute()
280+
self.injector_component.execute()
280281
if self.gamepad.getStartButton():
281282
self.vision.zero_servo_()
282283
else:

0 commit comments

Comments
 (0)