Delete 'software/多模态融合_声学订阅补丁.md'

master
pkx2w7qjn 2 weeks ago
parent 1ce73e6b94
commit 96a301cbf7

@ -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/AcousticThreatArray.h>
```
> 注:若构建时提示找不到该头文件,需确保 `acoustic_analyzer` 包已编译(`catkin_make`),并在 CMakeLists.txt 的 `find_package` 中声明依赖。
---
*补丁生成时间2026-05-23*
Loading…
Cancel
Save