From 567085ead3f6adaabd884f16ab4b17c62e8f0403 Mon Sep 17 00:00:00 2001
From: yincheng.zhong <634916154@qq.com>
Date: 星期日, 21 十二月 2025 22:28:09 +0800
Subject: [PATCH] OTA升级功能调通,准备增加boot的代码

---
 python/hitl/simulator.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/python/hitl/simulator.py b/python/hitl/simulator.py
index 5890bd2..aa2c66b 100644
--- a/python/hitl/simulator.py
+++ b/python/hitl/simulator.py
@@ -310,7 +310,6 @@
             frame, gps_time_s = self._build_nav_frame()
             if frame:
                 self.uart2.write(frame)
-                self._log_binary("PY->STM32 UART2 IM23A_NAV", frame, gps_time_s=gps_time_s, source_rank=0)
             self._sleep_remaining(start, period)
 
     def _loop_imu(self):
@@ -320,7 +319,6 @@
             frame, gps_time_s = self._build_imu_frame()
             if frame:
                 self.uart2.write(frame)
-                self._log_binary("PY->STM32 UART2 IM23A_IMU", frame, gps_time_s=gps_time_s, source_rank=0)
             self._sleep_remaining(start, period)
 
     def _loop_control(self):
@@ -396,7 +394,10 @@
     def _build_nav_frame(self) -> tuple[bytes | None, float]:
         state, timestamp = self._snapshot()
         lat, lon, alt = geo.enu_to_lla(state.east, state.north, state.up, self.origin)
-        heading_nav = geo.heading_math_to_nav(state.heading)
+        heading_nav_deg = geo.heading_math_to_nav(state.heading)
+        # 灏嗗鑸潗鏍囩郴瑙掑害锛�0-360搴︼級杞崲涓哄姬搴︼紙-蟺鍒跋�锛夛紝0搴︽鍖楀搴�0寮у害
+        # 0掳(姝e寳)鈫�0rad, 90掳(姝d笢)鈫捪�/2rad, 180掳(姝e崡)鈫捪�rad, 270掳(姝hタ)鈫�-蟺/2rad
+        heading_nav_rad = math.radians(heading_nav_deg) if heading_nav_deg <= 180.0 else math.radians(heading_nav_deg - 360.0)
         gps_time_s = _seconds_of_day(timestamp)
         status_flags = int(self.config.position_quality) & 0xFF
         frame = build_im23a_nav_frame(
@@ -407,7 +408,7 @@
             east_vel=state.east_velocity,
             north_vel=state.north_velocity,
             up_vel=state.up_velocity,
-            heading_deg=heading_nav,
+            heading_rad=heading_nav_rad,
             pitch_deg=state.pitch_deg,
             roll_deg=state.roll_deg,
             accel_bias=(0.0, 0.0, 0.0),

--
Gitblit v1.10.0