dctian / DeepPiCar

Deep Learning Autonomous Car based on Raspberry Pi, SunFounder PiCar-V Kit, TensorFlow, and Google's EdgeTPU Co-Processor
GNU General Public License v3.0
400 stars 271 forks source link

Overflow error: cannot convert float infinity to integer #19

Closed VicoLeChips closed 3 years ago

VicoLeChips commented 3 years ago

Hello,

I'm currently following all steps which are awesome and well explained. It works great, however sometimes (usually when turning), the car stops and shows an overflow error specifying : cannot convert float infinity to integer (line 294 in hand_coded_lane_follower) : x1 = max(-width, min(2 * width, int((y1 - intercept) / slope)))

Has anyone had this issue and has been able to fix it ?

VicoLeChips commented 3 years ago

Fixed the issue with a infinite small number for the slope within a try ... except