Hi, I am currently stucked at the Micro Project for Python for Robotics. The following is the code I have done so far. Please help me to spot the mistakes or provide any suggestions. Thanks.
from robot_control_class import RobotControl
rc = RobotControl()
decoy = 1
for i in range(20):
counter = 0
max_value = 0
max_direction = 0
l = rc.get_laser_full()
for value in l:
if value > max_value:
max_value = value
max_direction = counter
counter = counter + 1
correction = float((360 - max_direction)/50)
if correction < 0 :
direction = "counterclockwise"
elif correction > 0:
direction = "clockwise"
if abs(correction) < 3:
rot_speed = 0
elif abs(correction) > 3:
rot_speed = correction
if 1< rc.get_laser(360) < 2:
move_speed = 0.4
elif rc.get_laser(360) > 3:
move_speed = 0.6
elif rc.get_laser(360) < 1:
rc.stop_robot()
rc.turn(direction, rot_speed , correction )
rc.move_straight_time("forward",move_speed,0.1)