diff --git a/src/signage/config/signage_param.yaml b/src/signage/config/signage_param.yaml index e5d57df..41661b6 100644 --- a/src/signage/config/signage_param.yaml +++ b/src/signage/config/signage_param.yaml @@ -10,3 +10,13 @@ signage: accept_start: 5.0 # second monitor_width: 1920 monitor_height: 540 + announce: + emergency: true + restart_engage: true + door_close: true + door_open: true + engage: true + thank_you: true + in_emergency: true + going_to_depart: true + going_to_arrive: true \ No newline at end of file diff --git a/src/signage/resource/sound/arrived.wav b/src/signage/resource/sound/arrived.wav deleted file mode 100644 index 0fb821a..0000000 Binary files a/src/signage/resource/sound/arrived.wav and /dev/null differ diff --git a/src/signage/resource/sound/restart_engage.wav b/src/signage/resource/sound/restart_engage.wav new file mode 100644 index 0000000..96a52ff Binary files /dev/null and b/src/signage/resource/sound/restart_engage.wav differ diff --git a/src/signage/resource/sound/wait_for_oncoming_car.wav b/src/signage/resource/sound/wait_for_oncoming_car.wav deleted file mode 100644 index 200089c..0000000 Binary files a/src/signage/resource/sound/wait_for_oncoming_car.wav and /dev/null differ diff --git a/src/signage/resource/sound/wait_for_walker.wav b/src/signage/resource/sound/wait_for_walker.wav deleted file mode 100644 index 1d9ea17..0000000 Binary files a/src/signage/resource/sound/wait_for_walker.wav and /dev/null differ diff --git a/src/signage/src/signage/announce_controller.py b/src/signage/src/signage/announce_controller.py index d997fd6..535af08 100644 --- a/src/signage/src/signage/announce_controller.py +++ b/src/signage/src/signage/announce_controller.py @@ -13,7 +13,6 @@ from tier4_hmi_msgs.srv import SetVolume from tier4_external_api_msgs.msg import ResponseStatus - # The higher the value, the higher the priority PRIORITY_DICT = { "emergency": 3, @@ -37,6 +36,7 @@ def __init__(self, node, autoware_interface, parameter_interface): self._node = node self._parameter = parameter_interface.parameter + self._announce_settings = parameter_interface.announce_settings self._current_announce = "" self._pending_announce_list = [] self._sound = QSound("") @@ -84,10 +84,21 @@ def play_sound(self, message): self._sound = QSound(self._package_path + message + ".wav") self._sound.play() + # skip announce by setting + def check_announce_or_not(self, message): + try: + return getattr(self._announce_settings, message) + except Exception as e: + self._node.get_logger().error("check announce or not: " + str(e)) + return False + def send_announce(self, message): priority = PRIORITY_DICT.get(message, 0) previous_priority = PRIORITY_DICT.get(self._current_announce, 0) + if not self.check_announce_or_not(message): + return + if priority == 3: self._sound.stop() self.play_sound(message) diff --git a/src/signage/src/signage/parameter_interface.py b/src/signage/src/signage/parameter_interface.py index a8ead50..c9f1dc8 100644 --- a/src/signage/src/signage/parameter_interface.py +++ b/src/signage/src/signage/parameter_interface.py @@ -18,10 +18,23 @@ class SignageParameter: monitor_width: int = 1920 monitor_height: int = 540 +@dataclass +class AnnounceParameter: + emergency: bool = True + restart_engage: bool = True + door_close: bool = True + door_open: bool = True + engage: bool = True + arrived: bool = True + thank_you: bool = True + in_emergency: bool = True + going_to_depart: bool = True + going_to_arrive: bool = True class ParameterInterface: def __init__(self, node): self.parameter = SignageParameter() + self.announce_settings = AnnounceParameter() node.declare_parameter("signage_stand_alone", False) node.declare_parameter("ignore_manual_driving", False) @@ -64,3 +77,23 @@ def __init__(self, node): self.parameter.monitor_height = ( node.get_parameter("monitor_height").get_parameter_value().integer_value ) + + node.declare_parameter("announce.emergency", True) + node.declare_parameter("announce.restart_engage", True) + node.declare_parameter("announce.door_close", True) + node.declare_parameter("announce.door_open", True) + node.declare_parameter("announce.engage", True) + node.declare_parameter("announce.thank_you", True) + node.declare_parameter("announce.in_emergency", True) + node.declare_parameter("announce.going_to_depart", True) + node.declare_parameter("announce.going_to_arrive", True) + + announce_prefix = node.get_parameters_by_prefix("announce") + + for key in announce_prefix.keys(): + setattr( + self.announce_settings, + key, + announce_prefix[key].get_parameter_value().bool_value, + ) + diff --git a/src/signage/src/signage/route_handler.py b/src/signage/src/signage/route_handler.py index 158cd32..f714b2e 100644 --- a/src/signage/src/signage/route_handler.py +++ b/src/signage/src/signage/route_handler.py @@ -141,7 +141,7 @@ def announce_engage_when_starting(self): self._engage_trigger_time, self._parameter.accept_start, ): - self._announce_interface.send_announce("engage") + self._announce_interface.send_announce("restart_engage") self._engage_trigger_time = self._node.get_clock().now() if self._autoware.information.motion_state == MotionState.STARTING: