Skip to content

Commit 0a7b302

Browse files
author
Peter Vaiko
committed
diag: more diag when needed
We can delete this branch if the root cause turns out to be once again the deadly FS25_OzdokenRCPack mod. #761
1 parent 36876ac commit 0a7b302

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

scripts/Waypoint.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ function WaypointNode:setToWaypoint(course, ix, suppressLog)
324324
end
325325
self.ix = newIx
326326
local x, y, z = course:getWaypointPosition(self.ix)
327-
if x ~= x then
328-
CpUtil.infoVehicle(CpDebug.DBG_PPC, course.vehicle, 'PPC: %s waypoint %d position is NaN', getName(self.node), ix)
327+
if x ~= x or y ~= y or z ~= z then
328+
CpUtil.infoVehicle(course.vehicle, 'PPC: %s waypoint %d position is NaN', getName(self.node), ix)
329329
course:print()
330330
return
331331
end

scripts/ai/PurePursuitController.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,14 @@ end
394394
function PurePursuitController:findRelevantSegment()
395395
-- vehicle position
396396
local vx, vy, vz = getWorldTranslation(self.controlledNode)
397+
if MathUtil.isNan(vx) or MathUtil.isNan(vz) or MathUtil.isNan(vy) then
398+
self:infoVehicle(self.vehicle, 'findRelevantSegment: vehicle position is NaN: (%s, %s, %s), controlled node %s',
399+
tostring(vx), tostring(vy), tostring(vz), tostring(self.controlledNode))
400+
self:infoVehicle(self.vehicle, self.controlledNode and getName(self.controlledNode) or 'controlled node lost')
401+
self.course:print()
402+
self:infoVehicle('findRelevantSegment: aiTrafficCollisionTranslation %s',
403+
self.vehicle.spec_aiFieldWorker.aiTrafficCollisionTranslation and tostring(self.vehicle.spec_aiFieldWorker.aiTrafficCollisionTranslation[1]) or 'nil')
404+
end
397405
-- update the position of the relevant node (in case the course offset changed)
398406
self.relevantWpNode:setToWaypoint(self.course, self.relevantWpNode.ix)
399407
local lx, _, dzFromRelevant = worldToLocal(self.relevantWpNode.node, vx, vy, vz);

0 commit comments

Comments
 (0)