From 906428fc3b196160c30fec1f9715cf22207638f6 Mon Sep 17 00:00:00 2001 From: nnbcccscdscdsc <2709767634@qq.com> Date: Sat, 11 Apr 2026 13:56:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E6=9B=B4=E6=96=B0gps=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .codex | 0 backend/monitoring/common.py | 4 +-- backend/monitoring/telemetry.py | 2 ++ backend/monitoring/video.py | 4 +++ frontend/src/components/GpsMapPanel.vue | 38 ++++++++++++++++++++++--- 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 .codex diff --git a/.codex b/.codex new file mode 100644 index 0000000..e69de29 diff --git a/backend/monitoring/common.py b/backend/monitoring/common.py index 9989012..a64ceaa 100644 --- a/backend/monitoring/common.py +++ b/backend/monitoring/common.py @@ -19,8 +19,8 @@ VIDEO_TRAILER_ENDIANNESS = "little" VIDEO_TRAILER_TIMESTAMP_UNIT = "ms" VIDEO_TRAILER_TIMESTAMP_MULTIPLIER_NS = 1_000_000 VIDEO_TRAILER_TIMESTAMP_MAX_SKEW_NS = 7 * 24 * 60 * 60 * 1_000_000_000 -VIDEO_TRAILER_COORDINATE_FORMAT = "float32 little-endian" -VIDEO_TRAILER_STRUCT = struct.Struct(" VIDEO_TRAILER_TIMESTAMP_MAX_SKEW_NS: @@ -191,6 +193,8 @@ class OmniSocketVideoReceiver: timestamp_ns=timestamp_ns, latitude=latitude, longitude=longitude, + raw_latitude_hex=trailer[8:16].hex(), + raw_longitude_hex=trailer[16:24].hex(), received_at=received_at if received_at is not None else time.time(), ) diff --git a/frontend/src/components/GpsMapPanel.vue b/frontend/src/components/GpsMapPanel.vue index d9331be..d8d1300 100644 --- a/frontend/src/components/GpsMapPanel.vue +++ b/frontend/src/components/GpsMapPanel.vue @@ -53,6 +53,10 @@ function formatNumber(value: number) { return value.toFixed(6) } +function formatHexText(value: string | null | undefined) { + return value || '暂无' +} + async function loadAmapScript(key: string, securityJsCode: string) { if (window.AMap) { return window.AMap @@ -161,8 +165,10 @@ function updateMap(gps: GpsTelemetry | null) { [ '
', '
Robot GPS 定位
', - `
原始 WGS84: ${formatNumber(rawLatitude)}, ${formatNumber(rawLongitude)}
`, + `
WGS84: ${formatNumber(rawLatitude)}, ${formatNumber(rawLongitude)}
`, `
高德 GCJ-02: ${formatNumber(lat)}, ${formatNumber(lng)}
`, + `
纬度原始 8B: ${formatHexText(gps.raw_latitude_hex)}
`, + `
经度原始 8B: ${formatHexText(gps.raw_longitude_hex)}
`, `
UTC 时间: ${gps.utc_time || '--:--:--'}
`, `
卫星数: ${gps.satellites ?? '未知'}
`, `
海拔: ${gps.altitude_m ?? '未知'} m
`, @@ -206,6 +212,17 @@ const rawCoordinateText = computed(() => { return `${formatNumber(props.gps.latitude)}, ${formatNumber(props.gps.longitude)}` }) +const rawLatitudeHexText = computed(() => formatHexText(props.gps?.raw_latitude_hex)) + +const rawLongitudeHexText = computed(() => formatHexText(props.gps?.raw_longitude_hex)) + +const coordinateMetaText = computed(() => { + if (!props.gps) { + return '暂无' + } + return `${props.gps.coordinate_system} / ${props.gps.raw_coordinate_format}` +}) + const metaText = computed(() => { if (!props.gps) { return '暂无' @@ -268,13 +285,21 @@ watch(
- 原始 WGS84 + WGS84 坐标 {{ rawCoordinateText }}
高德 GCJ-02 {{ amapCoordinateText }}
+
+ 纬度原始 8 字节 + {{ rawLatitudeHexText }} +
+
+ 经度原始 8 字节 + {{ rawLongitudeHexText }} +
UTC 时间 {{ gps?.utc_time ?? '--:--:--' }} @@ -284,8 +309,8 @@ watch( {{ metaText }}
- 坐标系 - {{ gps?.coordinate_system ?? 'WGS84' }} + 坐标系 / 格式 + {{ coordinateMetaText }}
最近刷新 @@ -397,6 +422,11 @@ h2 { word-break: break-word; } +.detail-card strong.mono { + font-family: "JetBrains Mono", "SFMono-Regular", monospace; + font-size: 14px; +} + .map-canvas { position: relative; min-height: 420px;