コード例 #1
0
def StuckResolution():
    global stuckDetectTimer

    debug = False

    irdist = HelpGlobal.getAnySensor(Constant.ssINFRARED_NEAR)
    HelpGlobal.setDefaultAction()
    scanForObstacle(10, -10, -10)

    if debug:
        print " ", irdist
        print " ", FWHead.fixHeadAt[0]

    stuckDetectTimer += 1

    if stuckDetectTimer == 30:
        stuckDetectTimer = 0

    if irdist < 200000 and HelpTeam.canSeeOpponentWithinDist(50):
        closestOpp = HelpTeam.closestGpsOpponentWithinVar(50)
        if closestOpp[0] is not None:
            if closestOpp[0].getHeading() <= 0:  # on the left
                WalkAction.setNormalWalk(-5, 5, 0)
            else:
                WalkAction.setNormalWalk(-5, -5, 0)
コード例 #2
0
def resetEachFrame():
    Global.DKD = HelpTrack.getDKDRange()

    if Global.state != Constant.FINISHED:
        Global.myRole = Constant.NOROLE

    HelpGlobal.setDefaultAction()
    IndicatorAction.setDefaultIndicators()
    FWHead.resetEachFrame()
コード例 #3
0
ファイル: lWalkLearner.py プロジェクト: anorth/runswift-2005
 def DoAction(self):
     WalkAction.setNormalWalk(0,0,0)
     if self.counter == self.STILL_ENOUGH:
         self.startTime = HelpGlobal.getCurrentSimpleTime()
         return self.outState
     else:
         return self
コード例 #4
0
def DecideNextAction():
    if (Global.debugBehaviour_line):
        print "..... new frame: ", Global.frame

    # If first call to ready state, reset the readyplayer's globals
    if (HelpGlobal.getCurrentMode() == Constant.READYSTATE
            and Global.state != Constant.READYSTATE):
        ReadyPlayer.initReadyMatchPlaying()

    Global.frameReset()

    # Ted: In python only three states are supported. Other states are in still
    #          in C++. Why? If I port all the states to python then none of the C++
    #          behaviour would work. I think Kim still need his kimForward.cc
    #          and walkingLearner.cc.

    # Finished state - the robot can't move at all.
    if Global.state == Constant.FINISHED:
        IndicatorAction.showBatteryStatus()
        HelpGlobal.resetEverything()

    # Ready state - let me move to my correct position.
    elif Global.state == Constant.READYSTATE or Debug.mustReady:
        ReadyPlayer.readyMatchPlaying()
        Defender.lockDefender = False  # shouldn't keep birding on new kickoff

    # Set state - I can't move my legs, but I can move heads to look for ball.
    elif Global.state == Constant.SETSTATE:
        SetPlayer.DecideNextAction()
        Defender.lockDefender = False  # shouldn't keep birding on new kickoff

    # Playing state - lets play a game.
    else:
        playGameMode()

    # Show debug information using head lights.
    # If landmarkDebugging is on, no more face pattern for skills will be shown.
    # superDebug will be run inside it also, so don't need to call twice.
    landmarkDebugging = False
    if (landmarkDebugging):
        LandmarkTester.DecideNextAction()
    else:
        pass  #IndicatorAction.superDebug()

    # Send wireless info to the teammates.
    HelpTeam.sendWirelessInfo()
コード例 #5
0
ファイル: lWalkLearner.py プロジェクト: anorth/runswift-2005
 def beginAction(self):
     self.walkingBackTime = HelpGlobal.getCurrentSimpleTime() - preparation3.getStartTime()
     WalkAction.setForceStepComplete()
     self.sum = 0.0
     self.minIR = 10000000000