Skip to content

Commit

Permalink
add pull over mrm
Browse files Browse the repository at this point in the history
  • Loading branch information
yabuta committed Jun 26, 2024
1 parent 79a9165 commit 2a53734
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src/signage/src/signage/autoware_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

DISCONNECT_THRESHOLD = 2


@dataclass
class AutowareInformation:
autoware_control: bool = False
Expand Down Expand Up @@ -94,9 +95,13 @@ def __init__(self, node):
self._node.create_timer(1, self.reset_timer)

def reset_timer(self):
if utils.check_timeout(self._node.get_clock().now(), self._autoware_connection_time, DISCONNECT_THRESHOLD):
if utils.check_timeout(
self._node.get_clock().now(), self._autoware_connection_time, DISCONNECT_THRESHOLD
):
self.information = AutowareInformation()
self._node.get_logger().error("Autoware disconnected", throttle_duration_sec=DISCONNECT_THRESHOLD)
self._node.get_logger().error(
"Autoware disconnected", throttle_duration_sec=DISCONNECT_THRESHOLD
)
self.is_disconnected = True
else:
self.is_disconnected = False
Expand Down
8 changes: 4 additions & 4 deletions src/signage/src/signage/route_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ def emergency_checker_callback(self):

self._in_slowing_state = (
self._autoware.information.mrm_behavior == MrmState.COMFORTABLE_STOP
and self._autoware.information.motion_state == MotionState.MOVING
)
or self._autoware.information.mrm_behavior == MrmState.PULL_OVER
) and self._autoware.information.motion_state == MotionState.MOVING

self._in_slow_stop_state = (
self._autoware.information.mrm_behavior == MrmState.COMFORTABLE_STOP
and self._autoware.information.motion_state == MotionState.STOPPED
)
or self._autoware.information.mrm_behavior == MrmState.PULL_OVER
) and self._autoware.information.motion_state == MotionState.STOPPED

if in_emergency and not self._in_emergency_state:
self._announce_interface.announce_emergency("emergency")
Expand Down

0 comments on commit 2a53734

Please sign in to comment.