Example #1
0
def check_turning(dis):
    if int(dis[1]) < 100:
        dr.goCustom(80, 90)
        #print("Adjusting left")
    elif int(dis[1]) > 150:
        dr.goCustom(90, 80)
        #print('Adjusting right')
    else:
        #print('going forward')
        dr.goStraight()
def check_turning(dis):
    if int(dis[0]) < 245:
        dr.goCustom(110, 90)
        print('-->')
    elif int(dis[1]) < 235:
        dr.goCustom(90, 110)
        print('<--')
    else:
        print('^')
        dr.goStraight()
Example #3
0
def check_turning(dis):
    if int(dis[0]) < 265:
        dr.goCustom(100, 90)
        print('-->')
    elif int(dis[1]) < 255:
        dr.goCustom(100, 90)
        print('<--')
    else:
        print('^')
        dr.goStraight()
def check_turning(dis):
    if int(dis[1]) < 100:
        dr.goCustom(80, 90)
        print('left')
    elif int(dis[1]) > 150:
        dr.goCustom(90, 80)
        print('right')
    else:
        #dr.goStraight()
        dr.goStraight()
        print('straight')
Example #5
0
def turn(direction):
    if direction == 'Left':
        stop(3)
        dr.goStraight()
        time.sleep(2)
        dr.stop(1)
        dr.left()
        #print('Turning left')
    if direction == 'Right':
        stop(3)
        dr.goStraight()
        time.sleep(2)
        dr.stop(1)
        dr.right()
Example #6
0
         check_turning(distance)
         cv2.imshow('Result', image_with_lanes)
         out.write(image_with_lanes)
     except:
         cv2.imshow('Result', frame)
         out.write(frame)
         turn_com = True
         dr.stop(0.5)
         print('Stop')
 else:
     try:
         image_with_h_lane, turn_command = detect_h_line(frame)
         cv2.imshow('Result', image_with_h_lane)
         out.write(image_with_h_lane)
         print('Going for forward horizontal line')
         dr.goStraight()
         if turn_command == True:
             print('stop')
             dr.stop(0.5)
             for i in range(5):
                 arrow_image, direction = arrow_detection(frame)
                 direction_list.append(direction)
                 cv2.imshow('Result', arrow_image)
                 out.write(arrow_image)
             direction = mode(direction_list)
             if direction != 'Undefined':
                 turn(direction)
                 print("Im turning", direction)
             cv2.imshow('Result', arrow_image)
             out.write(image_with_h_lane)
             time.sleep(0.5)