Skip to content

Commit 02eb94f

Browse files
author
Peter Vaiko
committed
feat: analytical turn waypoints
Make sure all Dubins and Reeds-Shepp turns have enough waypoints, even with very small turning radius. #1025
1 parent 41db721 commit 02eb94f

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

scripts/pathfinder/Dubins.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function DubinsSolution:getLength(turnRadius)
4646
end
4747

4848
function DubinsSolution:getWaypoints(start, turnRadius)
49-
return dubins_path_sample_many(self.pathDescriptor, 1)
49+
return dubins_path_sample_many(self.pathDescriptor, math.min(1, turnRadius * math.pi / 12))
5050
end
5151

5252
local twoPi = 2 * math.pi

scripts/pathfinder/ReedsShepp.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ function ReedsShepp.ActionSet:getWaypoints(start, turnRadius)
174174
local waypoints = {}
175175
table.insert(waypoints, prev)
176176
for _, action in ipairs(self.actions) do
177-
local n = math.ceil(action.length * turnRadius)
177+
-- waypoints are 1 m apart, but make sure there are at least 12 waypoints per half circle
178+
-- even with very small radii
179+
local n = math.ceil(math.max(action.length * turnRadius, action.length / math.pi * 12))
180+
print(action, n)
178181
if action.steer ~= Steer.Straight then
179182
local pieceAngle = action.length / n
180183

0 commit comments

Comments
 (0)