From 658f85f18fd676830384f491e5206a7632abca99 Mon Sep 17 00:00:00 2001 From: Lucasmotabr Date: Mon, 13 Apr 2026 16:17:38 +0900 Subject: [PATCH] feat: add SoundDetection msg and ListenForSound action for yamnet_ros Adds the two interfaces required by the yamnet_ros bell/sound detection package: SoundDetection.msg (detection event topic) and ListenForSound.action (blocking action server for SMACH integration). Removes ModeCtrl.srv which is no longer used by the team. --- CMakeLists.txt | 2 ++ action/ListenForSound.action | 14 ++++++++++++++ msg/SoundDetection.msg | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 action/ListenForSound.action create mode 100644 msg/SoundDetection.msg diff --git a/CMakeLists.txt b/CMakeLists.txt index 478a607..139af40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ set(msg_files msg/Feature.msg msg/DetectMask.msg msg/DetectMaskArray.msg + msg/SoundDetection.msg ) set(srv_files srv/GetHandToTargetCoord.srv @@ -39,6 +40,7 @@ set(action_files action/MoveWheelRotate.action action/VlaRecordState.action action/DisplayControl.action + action/ListenForSound.action ) rosidl_generate_interfaces(${PROJECT_NAME} diff --git a/action/ListenForSound.action b/action/ListenForSound.action new file mode 100644 index 0000000..c06fd2b --- /dev/null +++ b/action/ListenForSound.action @@ -0,0 +1,14 @@ +# Goal — start listening for a bell/doorbell sound +float64 timeout_sec # max seconds to listen; 0 = no timeout +float32 threshold 0.15 # YAMNet score threshold to trigger; 0 = use node default +--- +# Result +bool detected # true if sound was detected before timeout +string label # class name that triggered (e.g. "Doorbell") +float32 score # score of the detected class +float32 elapsed_time # seconds from goal start to result +--- +# Feedback — sent every hop (~0.5 s) while listening +string current_top_label # overall top class right now +float32 current_top_score # its score +bool candidate_detected # any doorbell-like class above threshold this frame diff --git a/msg/SoundDetection.msg b/msg/SoundDetection.msg new file mode 100644 index 0000000..5c1ce95 --- /dev/null +++ b/msg/SoundDetection.msg @@ -0,0 +1,5 @@ +std_msgs/Header header +string label # best doorbell-like class detected (e.g. "Doorbell", "Bell") +float32 score # YAMNet score for that class [0-1] +string top_label # overall top class regardless of category (for diagnostics) +float32 top_score # overall top score (for diagnostics)