Example #1
0
def Playing():
    """Playing state: play game according to phase transitions
    ledProxy:  Chest Green
    """
    global phase
    global firstCall

    if firstCall["Set"]:
        mot.stiff()  # stiffness on (if it wasnt already)
        mot.setHead(0, 0)  # head in normal position

        # if a regular player
        if playerType == 0:
            phase = "BallNotFound"
            mot.normalPose(True)  # normalPose, forcing call
        # if a keeper
        else:
            phase = "BallNotFoundKeep"
            mot.keepNormalPose()
        firstCall["Set"] = False

    if firstCall["Playing"]:
        mHandler.killWalk()
        visThread.startScan()
        print "In playing state"
        firstCall["Initial"] = True
        firstCall["Ready"] = True
        firstCall["Set"] = True
        firstCall["Playing"] = False
        firstCall["Penalized"] = True

    if mot.standUp():
        print "Fallen"

    try:
        if memProxy.getData("dntAction"):
            phase = memProxy.getData("dntAction")
            print "coach says: " + phase
        else:
            print "coach says: nothing"
    except:
        pass
    # Execute the phase as specified by phase variable
    phases.get(phase)()
Example #2
0
def Playing():
    global phase
    global firstCall
    
    if firstCall['Playing']:
        print 'In playing state'
        ledProxy.fadeRGB('ChestLeds', 0x0000ff00, 0)
        firstCall['Initial']   = True   
        firstCall['Ready']     = True
        firstCall['Set']       = True
        firstCall['Playing']   = False
        firstCall['Penalized'] = True
        
    # if nao has fallen down, stand up
    if mot.standUp():
        print 'Fallen'
        #particleFilter.reset( position )
        # relocalize
    else:
        # localization features on field:
        # - goals, both yellow
        # - lines
        # - other robots ???
        
        # hacks:
        # - rules for placement on field -> clustered particles in according place
        # - falling                      -> scattered particles
        # - ...
        # position = particleFilter.meanState
        pass
    try:
        coachPhase = coachproxy.getData('dnt'+str(robot))
        if coachPhase:
            print 'Coach says: ', coachPhase
            phase = coachPhase
    except:
        pass
    # Execute the phase as specified by phase variable
    phases.get(phase)()