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
+37
View File
@@ -81,6 +81,43 @@ class FallbackClearCellsTests(unittest.TestCase):
self.assertLessEqual(len(cells), bound)
class ProbeLadderGeometryTests(unittest.TestCase):
"""对跖复核探点几何:圆心对称点裁进保证接收盘,不得塌缩到圆心附近。"""
def _probe_after_block(self, region, blocked_point):
simulator = LocalSimulator([], robot_id="T001", config=CONFIG)
client = SimulatorClient("T001", config=CONFIG,
transport=LocalSimTransport(simulator))
client.enter()
loop = DirectionalExtension(client, CONFIG)
loop.blocked_probes[7] = [blocked_point]
return loop._next_probe(region, 7)
def test_antipode_reflects_blocked_probe_through_center(self):
"""圆心为原点、原探点 (200,0):对跖复核应返回 (-200,0)。"""
region = CandidateRegion.disk((0.0, 0.0), 100.0, 192) # safe≈900>=200
probe = self._probe_after_block(region, (200.0, 0.0))
self.assertAlmostEqual(probe[0], -200.0, places=6)
self.assertAlmostEqual(probe[1], 0.0, places=6)
def test_antipode_clipped_into_safe_disk(self):
"""原探点距离超过安全盘半径时:落在距圆心 safe 处的对跖方向上。"""
region = CandidateRegion.disk((0.0, 0.0), 900.0, 192)
safe = safe_disk_radius(region, CONFIG)
self.assertLess(safe, 200.0)
probe = self._probe_after_block(region, (200.0, 0.0))
self.assertAlmostEqual(math.hypot(probe[0], probe[1]), safe, places=6)
self.assertLess(probe[0], 0.0, "应位于原探点的对跖方向")
def test_degenerate_center_block_walks_full_safe_radius(self):
"""被遮挡探点恰在圆心:沿 +x 走满安全盘半径,不再钳到 1m。"""
region = CandidateRegion.disk((0.0, 0.0), 100.0, 192)
probe = self._probe_after_block(region, (0.0, 0.0))
safe = safe_disk_radius(region, CONFIG)
self.assertAlmostEqual(probe[0], safe, places=6)
self.assertAlmostEqual(probe[1], 0.0, places=6)
class MixedLoopAcceptanceTests(unittest.TestCase):
def test_mixed_ten_sources_all_cleared(self):
sources = mixed_scene(seed=5, count=10, directional=3)