This commit is contained in:
Horldsence
2026-09-11 02:32:31 +08:00
parent 8c18a1f499
commit 4f91f242fe
19 changed files with 971 additions and 45 deletions
+26
View File
@@ -227,6 +227,32 @@ class LocalSimObservationTests(unittest.TestCase):
# 误差在 ±1° 内均匀分布,返回值再保留两位小数。
self.assertLessEqual(abs(outcome.svd_deg - true_bearing), 1.005)
def test_same_position_error_is_fixed(self):
"""同一(源,位置)重复测量读数不变 [题面/官方演练实测]。"""
source = Source(channel=1, x=1000, y=300, r_eff_m=1500)
simulator = LocalSimulator([source], robot_id="T001")
client = SimulatorClient("T001", transport=LocalSimTransport(simulator))
client.enter()
first = client.measure((0, 0), 1)
second = client.measure((0, 0), 1) # 新 request_id,同位置
self.assertEqual(first.result, "direction")
self.assertEqual(first.svd_deg, second.svd_deg,
"同位置重复测量的示向度必须相同")
def test_error_field_deterministic_per_seed(self):
"""同种子误差场逐点一致;不同种子得到不同误差场(逐点白噪声)。"""
source = Source(channel=1, x=1000, y=0, r_eff_m=1500)
readings = {}
for label, seed in (("a", 1), ("b", 1), ("c", 2)):
simulator = LocalSimulator([source], error_seed=seed, robot_id="T001")
client = SimulatorClient("T001", transport=LocalSimTransport(simulator))
client.enter()
readings[label] = [client.measure((float(x), 0.0), 1).svd_deg
for x in (0, 100, 200, 300, 400)]
self.assertEqual(readings["a"], readings["b"])
self.assertNotEqual(readings["a"], readings["c"],
"不同种子应在至少一个测点产生不同读数")
class SessionLogTests(unittest.TestCase):
def test_log_records_attempts_and_accepted(self):