Hi!
Very new with python here. What am I doing wrong?
The robot_control_class is copied from lesson 6. Rotate does seem to work, but my Turtlebot only decides to turn right… even when left > right?
I tried changing that syntax around but never figured it out…
from robot_control_class import RobotControl
rc = RobotControl()
def check_surroundings():
front = rc.get_laser(360)
left = rc.get_laser(719)
right = rc.get_laser(0)
print ("Front: ", front," / Left: ", left, " / Right: ", right)
def try_fwd():
front = rc.get_laser(360)
while front > 1:
print ("Path is clear... going straight")
rc.move_straight()
front = rc.get_laser(360)
else:
print ("Something is in the way, I'll try turning")
rc.stop_robot()
try_turn()
def try_turn():
print ("try_turn")
check_surroundings()
if left > right: #why does this always turn right?
print ("Left is clear, I'll turn that way...")
rc.rotate(-90)
try_fwd()
else:
print ("Left is blocked so I'll turn right...")
rc.rotate(90)
try_fwd()
front = 0
left = 0
right = 0
check_surroundings()
try_fwd()