diff --git a/多模态融合_声学订阅补丁.md b/多模态融合_声学订阅补丁.md deleted file mode 100644 index 612c03bc..00000000 --- a/多模态融合_声学订阅补丁.md +++ /dev/null @@ -1,64 +0,0 @@ -# 多模态融合节点 — 声学威胁订阅补丁 - -> 问题:C++ 多模态融合节点未订阅 `/acoustic/threats`,导致声源数据无法参与融合避障。 -> 适用文件:`src/多模态融合/cpp/src/main.cpp` - ---- - -## 修改 1:添加成员变量 - -在 `ros::Subscriber flash_det_sub_;` 之后添加: - -```cpp - ros::Subscriber acoustic_sub_; // /acoustic/threats -``` - -## 修改 2:在 setup_ros() 中订阅声学话题 - -在 `flash_enabled` 订阅块之后、`// ── 定时器 ──` 之前添加: - -```cpp - // ── 声学威胁订阅者 ── - if (cfg_.acoustic_enabled) { - acoustic_sub_ = nh.subscribe("/acoustic/threats", 5, - &ThreatFusionNode::acoustic_threats_cb, this); - ROS_INFO("[ThreatFusion] 已订阅 /acoustic/threats"); - } -``` - -## 修改 3:添加回调函数 - -在 `flash_detection_cb` 之后、`fusion_timer_cb` 之前添加: - -```cpp - void acoustic_threats_cb(const acoustic_analyzer::AcousticThreatArray::ConstPtr& msg) { - for (const auto& t : msg->threats) { - if (t.confidence < cfg_.acoustic_confidence_threshold) continue; - AcousticThreatData a; - a.threat_id = t.threat_id; - a.sound_type = t.sound_type; - a.confidence = t.confidence; - a.azimuth = t.azimuth; - a.elevation = t.elevation; - a.distance = t.distance; - a.distance_confidence = t.distance_confidence; - a.timestamp = get_time(); - cache_.add_acoustic(a); - } - modality_status_["acoustic"] = "OK"; - } -``` - -## 修改 4:添加消息头文件 include - -在文件顶部的 include 区域添加: - -```cpp -#include -``` - -> 注:若构建时提示找不到该头文件,需确保 `acoustic_analyzer` 包已编译(`catkin_make`),并在 CMakeLists.txt 的 `find_package` 中声明依赖。 - ---- - -*补丁生成时间:2026-05-23*