Robot program not working

The program should follow this pattern. But I don’t know where my code is going wrong as whenever my robot takes a left turn it gets hit by a wall and doesn’t move further. Please help!!
I HAVE ADDED MY CODE IN THE COMMENT SECTION!

  1. If the laser reading in front of the robot is higher than 1 meter (there is no obstacle closer than 1 meter in front of the robot), the robot will move forward.
  2. If the laser reading in front of the robot is lower than 1 meter (there is an obstacle closer than 1 meter in front of the robot), the robot will turn left.
  3. If the laser reading at the right side of the robot is lower than 1 meter (there is an obstacle closer than 1 meter at the right side of the robot), the robot will turn left.
  4. If the laser reading at the left side of the robot is lower than 1 meter (there is an obstacle closer than 1 meter at the left side of the robot), the robot will turn right.

could you provide the course name or rosject ?
thnx

The name of the course is Part 4, Basics of python

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.