Skip to content

Commit

Permalink
No Bumper Handling (#241)
Browse files Browse the repository at this point in the history
When the robot has no bumper the automation_watch will throw an
assertion as you can see in Issue #240. There are Fieldfriends that do
not have bumpers at all. That is why we need an appropriate handling of
it in the automation_watch. We would like to log a warning in case a
robot with bumpers has an error or disconnected bumpers but beside that
we just deactivate the bumper watcher.
  • Loading branch information
LukasBaecker authored Nov 29, 2024
1 parent 3409ff2 commit e5094d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions field_friend/automations/automation_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def stop(self, reason: str) -> None:

def try_resume(self) -> None:
# Set conditions to True by default, which means they don't block the process if the watch is not active
# TODO: what to do if we don't have bumpers?
assert self.field_friend.bumper is not None
bumper_condition = not bool(self.field_friend.bumper.active_bumpers) if self.bumper_watch_active else True
bumper_condition = True
if self.field_friend.bumper is not None and self.bumper_watch_active:
bumper_condition = not bool(self.field_friend.bumper.active_bumpers)
gnss_condition = (self.gnss.current is not None and ('R' in self.gnss.current.mode or self.gnss.current.mode == 'SSSS')) \
if self.gnss_watch_active else True

Expand Down
2 changes: 2 additions & 0 deletions field_friend/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ def watch_robot() -> None:
self.current_implement = self.monitoring
if self.field_friend.bumper:
self.automation_watcher.bumper_watch_active = True
else:
self.log.warning('Bumper is not available, does robot have bumpers?')

if self.is_real:
assert isinstance(self.field_friend, FieldFriendHardware)
Expand Down

0 comments on commit e5094d0

Please sign in to comment.