Skip to content

Commit

Permalink
fix: use distance from waypoint when stopping in pocket
Browse files Browse the repository at this point in the history
Instead of the dz, as it depends on the vehicle's heading.
  • Loading branch information
pvaiko committed Nov 2, 2024
1 parent 26dcccc commit ba3b64f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions scripts/ai/AIDriveStrategyCombineCourse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,7 @@ function AIDriveStrategyCombineCourse:onWaypointPassed(ix, course)
if self.state == self.states.UNLOADING_ON_FIELD and
self.unloadState == self.states.MAKING_POCKET and
self.unloadInPocketReferenceIx then
local _, _, dz = self.course:getWaypointLocalPosition(self.vehicle:getAIDirectionNode(), self.unloadInPocketReferenceIx)
if dz < 15 then
if self.course:getDistanceBetweenVehicleAndWaypoint(self.vehicle, self.unloadInPocketReferenceIx) < 15 then
-- we are close enough to the reference waypoint, so stop making the pocket and wait for unload.
self:debug('Waiting for unload in the pocket')
self.unloadState = self.states.WAITING_FOR_UNLOAD_IN_POCKET
Expand Down

0 comments on commit ba3b64f

Please sign in to comment.