Pavement Drive Assist

by Arcitos

Introduces a driver assistance system that autonomously follows paved roads, while maintaining a preset cruise speed if desired.

Utilities
4 years ago
0.14 - 0.18
182

b Crash when driving near road in certain angel

5 years ago

Mod version: 2.1.8
Factorio version: 0.17.11
Other mods installed: None

If I drive in a certain angel into some road the mod crashes with the following error message:

Error while running event PavementDriveAssist::on_tick (ID 0)
real number expected got inf.
stack traceback:
PavementDriveAssist/pda.lua:439: in function 'manage_drive_assistant'
PavementDriveAssist/pda.lua:644: in function 'on_tick'
PavementDriveAssist/control.lua:72: in function <PavementDriveAssist/control.lua:71>
stack traceback:
[C]: in function 'newindex'
__PavementDriveAssist
/pda.lua:439: in function 'manage_drive_assistant'
PavementDriveAssist/pda.lua:644: in function 'on_tick'
PavementDriveAssist/control.lua:72: in function <PavementDriveAssist/control.lua:71>

I can reproduce the bug again and again if the angel is correct while getting the specific angel is relatively hard so the bug is rare. But very annoying nevertheless.

5 years ago

I think I found the problematic code. In pda.lua at line 439 "newdir" can become infinity if in line 430 or 432 "sr" and "ss" respectively "sl" and "ss" are in each case both zero. I couldn't find the reason why this can happen yet, but fixing this or alternatively catching this edge case should solve the problem.

5 years ago

This part of the code is ancient. You just found a bug which hid there for years :D
Of course you're right: If the scores for left/right and center cancel themselve out, this will happen. But not if both of them are zero: I think more of a -1 + 1 scenario.
I'll fix it this weekend.

5 years ago

Should be fixed by now.

5 years ago

Thank you very much! I cannot reproduce the bug anymore.

New response