Program stops randomly

Hello , last day i worked on this exercise the car was avoiding almost every obstacle in the circuit , but today ive been all afternoon trying to make it wrok again because when it reaches the first obstacle and dodges it the program finishes . i put prints all over the code and the values start to be nan or inf just before the program stops. I cannot finish the exercise like this , did anyone had this problem before?