Skip to content

Commit 14729df

Browse files
author
Peter Vaiko
committed
wip, JPS working now
1 parent 5e12639 commit 14729df

4 files changed

Lines changed: 189 additions & 188 deletions

File tree

scripts/pathfinder/AStar.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function AStar:init(vehicle, yieldAfter, maxIterations)
1111
self.deltaPosGoal = self.deltaPos
1212
self.deltaThetaDeg = 181
1313
self.deltaThetaGoal = math.rad(self.deltaThetaDeg)
14-
self.maxDeltaTheta = math.pi
14+
self.maxDeltaTheta = self.deltaThetaGoal
1515
self.originalDeltaThetaGoal = self.deltaThetaGoal
1616
self.analyticSolverEnabled = false
1717
self.ignoreValidityAtStart = false

scripts/pathfinder/HybridAStar.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ function HybridAStar:initRun(start, goal, turnRadius, allowReverse, constraints,
548548
self.hitchLength = hitchLength
549549
self.constraints = constraints
550550
-- a motion primitive is straight or a few degree turn to the right or left
551-
self.hybridMotionPrimitives = self:getMotionPrimitives(turnRadius, allowReverse)
551+
self.motionPrimitives = self:getMotionPrimitives(turnRadius, allowReverse)
552552
-- create the open list for the nodes as a binary heap where
553553
-- the node with the lowest total cost is at the top
554554
self.openList = BinaryHeap.minUnique(function(a, b)
@@ -628,10 +628,12 @@ function HybridAStar:run(start, goal, turnRadius, allowReverse, constraints, hit
628628
closeIntervalTimer(self.timer)
629629
-- if we had the coroutine package, we would coursePlayCoroutine.yield(false) here
630630
return PathfinderResult(false)
631-
end -- pop lowest cost node from queue
631+
end
632+
-- pop lowest cost node from queue
632633
---@type State3D
633634
local pred = State3D.pop(self.openList)
634635
self.logger:trace('pop %s', tostring(pred))
636+
self.logger:trace('dPos %.1f dTheta %.1f', self.deltaPosGoal, math.deg(self.deltaThetaGoal))
635637

636638
if pred:equals(self.goal, self.deltaPosGoal, self.deltaThetaGoal) then
637639
-- done!
@@ -657,9 +659,9 @@ function HybridAStar:run(start, goal, turnRadius, allowReverse, constraints, hit
657659
end
658660
end
659661
-- create the successor nodes
660-
for _, primitive in ipairs(self.hybridMotionPrimitives:getPrimitives(pred)) do
662+
for _, primitive in ipairs(self.motionPrimitives:getPrimitives(pred)) do
661663
---@type State3D
662-
local succ = self.hybridMotionPrimitives:createSuccessor(pred, primitive, self.hitchLength)
664+
local succ = self.motionPrimitives:createSuccessor(pred, primitive, self.hitchLength)
663665
if succ:equals(self.goal, self.deltaPosGoal, self.deltaThetaGoal) then
664666
succ.pred = succ.pred
665667
self:debug('Successor at the goal (%d).', self.iterations)

0 commit comments

Comments
 (0)