Skip to content

Commit 5c8e7f0

Browse files
committed
Allow thirty percent checked coastal preference detours
1 parent c364ca1 commit 5c8e7f0

4 files changed

Lines changed: 19 additions & 12 deletions

File tree

‎README.ko.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ path = planner.route(start, goal)
6363

6464
목적지 항구로 진행할 때만 해안 가까운 경로를 우선합니다. 마지막 구간은
6565
항로 목표와 항구를 향해야 합니다. 같은 후속 목표까지 검증한 짧은 경로보다
66-
전체 거리가 15% 넘게 늘어나면 일반 수상 경로를 사용합니다.
66+
전체 거리가 30% 넘게 늘어나면 일반 수상 경로를 사용합니다.
6767
육지나 여울을 피하려면 만과 섬을 돌아갈 수 있습니다.
6868
항구와 필수 통과점은 도착 조건을 유지합니다.
6969

@@ -76,7 +76,7 @@ path = planner.route(start, goal)
7676
| 수상 차량 로컬 수심 여유 | 1.5 m |
7777
| 수상 차량 반경 + 추적 여유 | 3.5 m + 4 m |
7878
| 해안 선호 거리 | 250 m |
79-
| 해안 선호에 따른 추가 거리 한도 | 15% |
79+
| 해안 선호에 따른 추가 거리 한도 | 30% |
8080
| 해안 지역 여유 폭 / 수심 | 40 m / 2 m |
8181
| 도착 반경 | 300 m |
8282
| 도착 목표 검사 | 반경 350 m / 수심 3 m |

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ checked segment. Longitude wrapping supports the international date line.
6363

6464
Coastal lookahead favours shore only while progressing toward the destination
6565
port. Its final stretch must approach both the course target and the port.
66-
The full coastal route may add at most 15% to a shorter checked route to the
66+
The full coastal route may add at most 30% to a shorter checked route to the
6767
same onward target. Longer scenic detours use the ordinary water route instead.
6868
Land and shallow water can still require a detour around bays or islands.
6969
Ports and required passage points retain their arrival checks.
@@ -77,7 +77,7 @@ shortened route preserves its checked exit.
7777
| Surface local depth clearance | 1.5 m |
7878
| Surface hull radius + tracking margin | 3.5 m + 4 m |
7979
| Coastal preferred distance | 250 m |
80-
| Maximum extra distance for coastal preference | 15% |
80+
| Maximum extra distance for coastal preference | 30% |
8181
| Coastal regional buffer / depth | 40 m / 2 m |
8282
| Arrival radius | 300 m |
8383
| Arrival target screening | 350 m buffer / 3 m depth |

‎src/posim_routing/coastal.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
MINIMUM_DEPTH_M = 2.
2626
REGIONAL_BUFFER_M = 40.
2727
WAYPOINT_FORMAT = "checked-segment-ends-v2-destination-progress"
28-
MAXIMUM_COASTAL_DETOUR_RATIO = 1.15
28+
MAXIMUM_COASTAL_DETOUR_RATIO = 1.30
2929

3030

3131
def sphere(coordinates):
@@ -122,7 +122,7 @@ def coastal_approach(start, target, shore, progress_target=None):
122122
def coastal_corridor(terrain, spec, start, target, timeout=25., guard=None, progress_target=None):
123123
"""Return a coastal or shorter checked water path, or retain the course.
124124
125-
A checked coast preference may add at most 15 percent to the shortest
125+
A checked coast preference may add at most 30 percent to the shortest
126126
checked route to the same onward goal. Its final stretch must approach
127127
both that goal and the destination. Required land detours remain available
128128
through the ordinary planner. Close to a waypoint, exact arrival wins.

‎tests/test_coastal_navigation.py‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_stays_near_coast_and_progresses(self):
4949
self.assertEqual(plan['mode'], 'coastal')
5050
self.assertLess(abs(plan['endpoint_standoff_m']-STANDOFF_M), 200)
5151
self.assertGreater(plan['progress_to_course_waypoint_m'], 1000)
52-
self.assertLessEqual(plan['coastal_through_length_m'], plan['shortest_checked_length_m']*1.15)
52+
self.assertLessEqual(plan['coastal_through_length_m'], plan['shortest_checked_length_m']*1.30)
5353
self.assert_swept_safe(terrain, start, plan)
5454

5555
def test_close_safe_start_is_not_rejected_by_an_extra_grid_ring(self):
@@ -72,13 +72,15 @@ def test_offshore_start_does_not_take_a_scenic_detour(self):
7272
def test_headland_cannot_be_shortcut(self):
7373
terrain = grid(headland=True)
7474
start = geo(800, -4000)
75-
# Land avoidance remains mandatory when scenic preference is rejected.
75+
# The relaxed coastal preference still requires going around land.
7676
target = geo(800, 9000)
7777
plan = coastal_corridor(terrain, SPEC, start, target)
78-
self.assertEqual(plan['mode'],'detour')
79-
points = np.array([FORWARD.transform(*p) for p in plan['points']])
78+
self.assertEqual(plan['mode'],'coastal')
79+
self.assertLessEqual(plan['coastal_through_length_m'], plan['shortest_checked_length_m']*1.30)
80+
through = plan['points']+plan['onward_points']
81+
points = np.array([FORWARD.transform(*p) for p in through])
8082
self.assertGreater(points[:, 0].max(), 1800+REGIONAL_BUFFER_M)
81-
self.assert_swept_safe(terrain, start, plan)
83+
self.assert_swept_safe(terrain, start, dict(points=through))
8284

8385
def test_closed_bay_requires_an_onward_water_exit(self):
8486
terrain = grid()
@@ -164,7 +166,12 @@ def test_distant_coast_approach_advances_without_changing_course_target(self):
164166
self.assertEqual(target,geo(0,-90000))
165167
self.assertIsNone(coastal_approach(geo(800,0),target,geo(0,0)))
166168
self.assertIsNone(coastal_approach(geo(30000,0),geo(90000,0),geo(0,0)))
167-
self.assertIsNone(coastal_approach(start,target,geo(0,-12000)))
169+
relaxed=coastal_approach(start,target,geo(0,-12000))
170+
self.assertIsNotNone(relaxed)
171+
travel=distance(start,relaxed)
172+
progress=distance(start,target)-distance(relaxed,target)
173+
self.assertGreaterEqual(progress,travel/1.30)
174+
self.assertLess(progress,travel/1.15)
168175
self.assertIsNone(coastal_approach(start,target,shore,progress_target=geo(90000,0)))
169176

170177
def test_real_progressive_shore_excludes_backward_coast(self):

0 commit comments

Comments
 (0)