Exemple #1
0
def main_list(nh,sub):

    '''

    Wrap individual tasks in their own timeouts so we can assign time to 
    the task and any support moves needed that are not included in the tasks
    mission main function

    '''

    yield sub.move.depth(1).go()
    yield sub.move.forward(10).go()

    try:
        yield util.wrap_timeout(buoy(nh), BUOY_TIME)
    except Exception:
        traceback.print_exc()
    finally: pass
        #sub.change_current_vision(False,False,False,False,False,False)

    try:
        #sub.change_current_vision(False,False,False,False,True,False)
        yield util.wrap_timeout(path.main(nh), PATH_TIME)
    except Exception:
        traceback.print_exc()
    finally: pass

    yield sub.move.forward(3).go()
    try:
        #sub.change_current_vision(False,False,False,False,True,False)
        yield util.wrap_timeout(portal.main(nh), PORTAL_TIME)
    except Exception:
        traceback.print_exc()
    finally: pass
        #sub.change_current_vision(False,False,False,False,False,False)

    try:
        #sub.change_current_vision(False,False,False,False,True,False)
        yield util.wrap_timeout(path.main(nh), PATH_TIME)
    except Exception:
        traceback.print_exc()
    finally: pass
        #sub.change_current_vision(False,False,False,False,False,False)

    yield sub.move.forward(3).go()

    try:
        yield util.wrap_timeout(torpedos(nh), TORPEDO_TIME)
    except Exception:
        traceback.print_exc()
    finally: pass
Exemple #2
0
def main(nh, freq=25e3):
    sub = yield sub_scripting.get_sub(nh)
    yield sub.raise_down_grabber()

    if 1:
        yield sub.move.depth(1).go()
        fwd_move = sub.move.go(linear=[.3, 0, 0])
        try:
            yield sub.hydrophone_align(freq)
        finally:
            fwd_move.cancel()
        yield sub.move.relative(RELATIVE_PINGER_MOVE).go()
        
        #print 'surfacing'
        #yield sub.move.depth(0).go()
        
        yield sub.move.depth(0.4).go()
        bin_pose = sub.move
        try:
            yield util.wrap_timeout(sub.visual_align('down', 'wreath/bin/high', 2, selector=select_centered, turn=False), 10)
            yield sub.move.relative(RELATIVE_VISION_MOVE).go()
        except util.TimeoutError:
            print 'bin alignment timed out'
            yield bin_pose.go()
        except:
            print 'bin alignment???'
            yield bin_pose.go()
        yield path.main(nh, orient_away_from=True, forward=False, depth=0.4)
        yield sub.move.forward(2).go()
    
    yield retry_to_grab(sub, 'moonrock', freq, surface=True)
    yield retry_to_grab(sub, 'moonrock', freq, bubbles=True, surface=True)
    yield retry_to_grab(sub,   'cheese', freq)
    yield retry_to_grab(sub,   'cheese', freq)
    yield retry_to_grab(sub,   'cheese', freq, bubbles=True)
    yield retry_to_grab(sub, 'moonrock', freq)
    while True:
        yield retry_to_grab(sub, 'moonrock', freq)