Exemple #1
0
def docking(nh, boat, s):
    global docking_info
    global course

    print "Moving to position to begin docking"
    s.set_current_challenge('docking')

    try:
        yield util.wrap_timeout(go_to_ecef_pos.main(nh, DOCK[course]),
                                ECEF_TIME)
    except:
        print 'ECEF timeout'
    print "Turning to face dock"

    yield boat.move.heading(DOCK_HEADING[course]).go()

    # Get dock info
    docking_info = yield docking_info
    print 'JSON says: \n\n' + str(docking_info) + '\n\n'

    shape1 = docking_info.first_dock_symbol
    color1 = docking_info.first_dock_color
    try:
        print "Beginning Dock 1"
        yield util.wrap_timeout(find_shape.main(nh, shape1, color1),
                                DOCK_TIME / 2.0)
        print "Completed Dock 1"
    except Exception:
        print "Could not dock first shape, moving to next shape"
    finally:
        pass
    #boat.default_state()

    shape2 = docking_info.second_dock_symbol
    color2 = docking_info.second_dock_color
    try:
        print "Beginning Dock 2"
        yield util.wrap_timeout(find_shape.main(nh, shape2, color2),
                                DOCK_TIME / 2.0)
        print "Completed Dock 2"
    except Exception:
        print "Could not dock second shape, moving on"
    finally:
        pass
Exemple #2
0
def docking(nh, boat, s):
    global docking_info
    global course

    print "Moving to position to begin docking"
    s.set_current_challenge('docking')        
    
    try:
        yield util.wrap_timeout(go_to_ecef_pos.main(nh, DOCK[course]), ECEF_TIME)
    except:
        print 'ECEF timeout'
    print "Turning to face dock"

    
    yield boat.move.heading(DOCK_HEADING[course]).go()
    
    # Get dock info
    docking_info = yield docking_info
    print 'JSON says: \n\n' + str(docking_info) + '\n\n'

    shape1 = docking_info.first_dock_symbol
    color1 = docking_info.first_dock_color
    try:
        print "Beginning Dock 1"
        yield util.wrap_timeout(find_shape.main(nh, shape1, color1), DOCK_TIME / 2.0)
        print "Completed Dock 1"
    except Exception:
        print "Could not dock first shape, moving to next shape"
    finally: pass
        #boat.default_state()

    shape2 = docking_info.second_dock_symbol
    color2 = docking_info.second_dock_color
    try:
        print "Beginning Dock 2"
        yield util.wrap_timeout(find_shape.main(nh, shape2, color2), DOCK_TIME / 2.0)
        print "Completed Dock 2"
    except Exception:
        print "Could not dock second shape, moving on"
    finally: pass
Exemple #3
0
def do_dock(nh, shape):
	boat = yield boat_scripting.get_boat(nh)
	if shape == 'circle':
		try:
			print "Docking --- circle"
			yield util.wrap_timeout(find_shape.main(nh, 'circle'), CIRCLE_TIME)
		except Exception:
			print "Could not find circle, moving  to next shape"

	if shape == 'triangle':
		try:
			print "Docking --- triangle"
			yield util.wrap_timeout(find_shape.main(nh, 'triangle'), TRIANGLE_TIME)
		except Exception:
			print "Could not find triangle, moving to next shape"

	if shape == 'cross':
		try:
			print "Docking --- cross"
			yield util.wrap_timeout(find_shape.main(nh, 'cross'), CROSS_TIME)
		except Exception:
			print "Could not find cross, moving to next shape"
Exemple #4
0
def do_dock(nh, shape):
    boat = yield boat_scripting.get_boat(nh)
    if shape == 'circle':
        try:
            print "Docking --- circle"
            yield util.wrap_timeout(find_shape.main(nh, 'circle'), CIRCLE_TIME)
        except Exception:
            print "Could not find circle, moving  to next shape"

    if shape == 'triangle':
        try:
            print "Docking --- triangle"
            yield util.wrap_timeout(find_shape.main(nh, 'triangle'),
                                    TRIANGLE_TIME)
        except Exception:
            print "Could not find triangle, moving to next shape"

    if shape == 'cross':
        try:
            print "Docking --- cross"
            yield util.wrap_timeout(find_shape.main(nh, 'cross'), CROSS_TIME)
        except Exception:
            print "Could not find cross, moving to next shape"