Skip to content

Commit

Permalink
add fix going to depart and arrive announce (#108) (#111)
Browse files Browse the repository at this point in the history
* add fix going to depart and arrive announce



* fix

* reset flag when no schedule

---------

Signed-off-by: tkhmy <[email protected]>
Co-authored-by: Kah Hooi Tan <[email protected]>
  • Loading branch information
yabuta and tkhmy authored Aug 20, 2024
1 parent 36341f0 commit 2a6cf7d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/signage/src/signage/announce_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ def announce_emergency(self, message):
self.send_announce(message)

def announce_going_to_depart_and_arrive(self, message):
if self._prev_depart_and_arrive_type != message:
# To stop repeat announcement
self.send_announce(message)
self._prev_depart_and_arrive_type = message
self.send_announce(message)

def publish_volume_callback(self):
self._sink = self._pulse.get_sink_by_name(self._pulse.server_info().default_sink_name)
Expand Down
19 changes: 17 additions & 2 deletions src/signage/src/signage/route_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __init__(
self._announce_engage = False
self._in_slow_stop_state = False
self._in_slowing_state = False
self._announced_depart = False
self._announced_arrive = False
self._trigger_external_signage = False

self.process_station_list_from_fms()
Expand Down Expand Up @@ -276,6 +278,8 @@ def route_checker_callback(self):
# Check whether the vehicle is move in autonomous
self._is_driving = True
self._is_stopping = False
self._announced_depart = False

if (
not self._trigger_external_signage
and self._autoware.information.autoware_control
Expand All @@ -293,6 +297,7 @@ def route_checker_callback(self):
self._is_stopping = True
self._skip_announce = False
self._announce_engage = False
self._announced_arrive = False

if (
self._autoware.information.operation_mode != OperationModeState.AUTONOMOUS
Expand Down Expand Up @@ -323,6 +328,7 @@ def route_checker_callback(self):
if self._autoware.information.goal_distance < self._parameter.goal_distance:
self._is_stopping = True
self._is_driving = False
self._announced_depart = False

if self._reach_final:
self._previous_driving_status = False
Expand Down Expand Up @@ -361,13 +367,21 @@ def calculate_time_callback(self):
else:
# the departure time is close (within 1 min), announce going to depart
self._display_phrase = utils.handle_phrase("departing")
self._announce_interface.announce_going_to_depart_and_arrive("going_to_depart")
if not self._announced_depart:
self._announce_interface.announce_going_to_depart_and_arrive(
"going_to_depart"
)
self._announced_depart = True
elif self._is_driving:
# handle text and announce while bus is running
if self._autoware.information.goal_distance < 100:
# display text and announce if the goal is within 100m
self._display_phrase = utils.handle_phrase("arriving")
self._announce_interface.announce_going_to_depart_and_arrive("going_to_arrive")
if not self._announced_arrive:
self._announce_interface.announce_going_to_depart_and_arrive(
"going_to_arrive"
)
self._announced_arrive = True
else:
self._display_phrase = ""
else:
Expand Down Expand Up @@ -410,6 +424,7 @@ def view_mode_callback(self):
view_mode = "stopping"
else:
view_mode = "out_of_service"
self._announced_depart = False

self._viewController.view_mode = view_mode
except Exception as e:
Expand Down

0 comments on commit 2a6cf7d

Please sign in to comment.