首个点异常位置剔除

This commit is contained in:
2026-07-17 13:52:10 +08:00
parent 7cc5cfa3ac
commit 622d721a77
3 changed files with 20 additions and 6 deletions
+1
View File
@@ -82,6 +82,7 @@ struct Constraint {
bool time_space_filter;
bool speed_filter;
bool use_system_time;
mutable bool fail_clear_pos = false; // 如果启用那么解码位置失败,将会清空状态
};
template <typename That>
struct CPR_MSG : CPR_Data {
+15 -4
View File
@@ -119,16 +119,21 @@ bool parse_absb_17(SSR::Data_Source_Interface* src, SSR::P_S mode_s_msg, JSON& m
Parse_no_json(t, BDS06_surface_position)
info.refresh_pos(true);
t.base_station_pos = base_station_pos;
//bool use_system_time = src->use_system_time.load();
auto& constraint = surface_constraint;
auto& list = info.surface_pos_track_list;
constraint.fail_clear_pos = list.size() <= 1;
auto tp = t.parse_message(mode_s_msg, air_constraint);
if (tp.has_value()) {
auto t2 = t.odd_msg;
Position_Info p(tp.value(), info.altitude_meter().value_or(0));
info.surface_pos_track_list.push(p);
list.push(p);
info.mlat = false;
parse_pos_call_back(&info, mode_s_msg, true);
msg_json.append_list(t.toJson().children);
}
else if (constraint.fail_clear_pos) {
list.reset();
}
msg_json.append(Psc::JSON("地表位置消息", get_current_time_as_string()));
}
else if ((tc >= 9 && tc <= 18) || (tc >= 20 && tc <= 22)) {
@@ -140,16 +145,22 @@ bool parse_absb_17(SSR::Data_Source_Interface* src, SSR::P_S mode_s_msg, JSON& m
else if (info.absb_version == 2) {
Parse(t2, BDS05_airborne_Position_v2)
}
auto& constraint = air_constraint;
auto& list = info.air_pos_track_list;
constraint.fail_clear_pos = list.size() <= 1;
using namespace std::chrono;
auto tp = t.parse_message(mode_s_msg, surface_constraint);
auto tp = t.parse_message(mode_s_msg, constraint);
if (tp.has_value()) {
auto alt = t.get_alt_meter();
Position_Info p(tp.value(), alt);
info.air_pos_track_list.push(p);
list.push(p);
info.mlat = false;
parse_pos_call_back(&info, mode_s_msg, false);
msg_json.append_list(t.toJson().children);
}
else if (constraint.fail_clear_pos) {
list.reset();
}
msg_json.append(Psc::JSON("空中位置消息", get_current_time_as_string()));
}
else if (tc == 19) {
+4 -2
View File
@@ -185,8 +185,10 @@ RET<Pos_Ret> CPR_MSG<That>::parse_message(P_S msg, Constraint constraint) {
return ret;
}
// 此时新来的点本地解码失败 全局解码也失败 很可能是 中间丢了很多消息 所以旧的pos
// last_parse_pos_time = 0;
// pos = std::nullopt;
if (constraint.fail_clear_pos) {
last_parse_pos_time = 0;
last_parse_pos = std::nullopt;
}
that->msg = msg;
that->time = time_s;
other->reset();