コード例 #1
0
def doWait():
    global move_flag
    if not (move_flag):
        move_flag = True
        naocmd.stop(motion)
        print "En Pause"
    time.sleep(0.5)
    newKey, val = getMouv()
    event = "Again"  # define the default event
    if newKey:
        if val == t_avance:
            move_flag = False
            event = "Walk"
        if val == t_end:
            move_flag = False
            event = "End"
        if val == t_pivot_l:
            move_flag = False
            event = "Turn on the Left"
        if val == t_pivot_r:
            move_flag = False
            event = "Turn on the Right"
        if val == t_r:
            move_flag = False
            event = "Right"
        if val == t_l:
            move_flag = False
            event = "Left"
        if val == t_b:
            move_flag = False
            event = "Go back"
        if val == t_tir:
            move_flag = False
            event = "Move foot"
    return event  # return event to be able to define the transition
コード例 #2
0
ファイル: FSM_NAO.py プロジェクト: porlanax/FC-NAO_BEDIN
def doWait():
    global move_flag
    if not (move_flag):
        move_flag = True
        naocmd.stop(motion)
        print "En Pause"
    time.sleep(0.5)
    newKey, val = getKey()
    event = "Again"  # define the default event
    if newKey:
        if val == "q":
            move_flag = False
            event = "Walk"
        if val == "s":
            move_flag = False
            event = "End"
        if val == "l":
            move_flag = False
            event = "Turn on the Left"
        if val == "r":
            move_flag = False
            event = "Turn on the Right"
    return event  # return event to be able to define the transition