from robot_control_class import RobotControl
ro = RobotControl()
stop_flag =1
las = ro.get_laser_full()
las_max = max(las)
inde=las.index(las_max)
left = ro.get_laser(719)
right = ro.get_laser(0)
while(stop_flag):
if(not(ro.get_laser(360)<las_max+0.5 and ro.get_laser(360)>las_max-0.5)):
if(inde<360):
ro.turn ('clockwise', 0.2, 1)
else:
ro.turn ('counter-clockwise', 0.2, 1)
else:
ro.move_straight_time('forward', 0.5, 1)
las = ro.get_laser_full()
las_max = max(las)
inde=las.index(las_max)
print(las_max)
print(inde)
print(ro.get_laser(360))
left = ro.get_laser(719)
right = ro.get_laser(0)
if(left == float('inf') and right ==float('inf') and straight==float('inf')):
stop_flag =0
ro.stop_robot()
I am basically finding the direction in which large free space that exists, then I am turning the robot to face that direction and move forward for few seconds. For some weird reason robot seems to think the direction of corner is free from obstacle?