Example #1
0
def startInteraction(infoFromPrevState):
    global nextSideToLookAt
    global changeActivityReceived

    if infoFromPrevState['state_cameFrom'] != "STARTING_INTERACTION":
        #print('------------------------------------------ WAITING_FOR_WORD')
        rospy.loginfo("STATE: STARTING_INTERACTION")

    if changeActivityReceived == 'joke_nao':
        if naoSpeaking:
            if (alternateSidesLookingAt):
                lookAndAskForFeedback(introJokePhrase, nextSideToLookAt,
                                      naoWriting, naoSpeaking, textToSpeech,
                                      motionProxy, armJoints_standInit,
                                      effector)
            else:
                lookAndAskForFeedback(introJokePhrase, personSide, naoWriting,
                                      naoSpeaking, textToSpeech, motionProxy,
                                      armJoints_standInit, effector)
        nextState = "TELL_JOKE"
        infoForNextState = {'state_cameFrom': "STARTING_INTERACTION"}
    else:
        nextState = "STARTING_INTERACTION"
        infoForNextState = {'state_cameFrom': "STARTING_INTERACTION"}

    if stopRequestReceived:
        nextState = "STOPPING"

    return nextState, infoForNextState
Example #2
0
def pauseInteraction(infoFromPrevState):
    global changeActivityReceived
    if changeActivityReceived == 'drawing_nao':
        if naoSpeaking:
            if(alternateSidesLookingAt):
                rospy.sleep(2)
                lookAndAskForFeedback(againDrawingPhrase, nextSideToLookAt, naoWriting, naoSpeaking, textToSpeech, motionProxy, armJoints_standInit, effector)
            else:
                rospy.sleep(2)
                lookAndAskForFeedback(againDrawingPhrase, nextSideToLookAt, naoWriting, naoSpeaking, textToSpeech, motionProxy, armJoints_standInit, effector)        
        nextState = "DRAWING"
        infoForNextState = {'state_cameFrom': "PAUSE_INTERACTION"}
    else:
        nextState = "PAUSE_INTERACTION"
        infoForNextState = {'state_cameFrom': "PAUSE_INTERACTION"}
        
    if stopRequestReceived:
        nextState = "STOPPING"
        
    return nextState, infoForNextState 
def startInteraction(infoFromPrevState):
    global nextSideToLookAt
    #print('------------------------------------------ STARTING_INTERACTION')
    rospy.loginfo("STATE: STARTING_INTERACTION")
    if naoSpeaking:
        if (alternateSidesLookingAt):
            lookAndAskForFeedback(introPhrase, nextSideToLookAt, naoWriting,
                                  naoSpeaking, textToSpeech, motionProxy,
                                  armJoints_standInit, effector)
            pub_activity.publish("learning_words_nao")
            rospy.sleep(1)
        else:
            lookAndAskForFeedback(introPhrase, personSide, naoWriting,
                                  naoSpeaking, textToSpeech, motionProxy,
                                  armJoints_standInit, effector)
            rospy.sleep(1)
            pub_activity.publish("learning_words_nao")

    nextState = "ACTIVITY"
    infoForNextState = {'state_cameFrom': "STARTING_INTERACTION"}
    if stopRequestReceived:
        nextState = "STOPPING"
    return nextState, infoForNextState