I’m looking for a solution to help the robot come out of the maze. However, my code when using the python command to run, nothing happens. Please help me
Code:
from robot_control_class import RobotControl
robot_control = RobotControl()
def get_line():
print("Start get line...")
count = 719
max_distance = 0
max_position = 0
while count > 0:
count -= 1
distance = robot_control.get_laser(count)
if distance > max_distance:
max_distance = distance
max_position = count
print("The max distance:", max_distance, "m")
return max_position
def move(a):
angle = (90 - (a / 719) * 180)
robot_control.rotate(angle)
robot_control.move_straight()
if robot_control.get_laser(360) == 1:
robot_control.stop_robot()
# Main loop
for c in range(6, 0, -1):
temp = get_line()
move(temp)