Пример #1
0
 def start(self):
     if self._started: return
     self.trace("Starting")
     self._timer.start()
     self._started = True
     self._startFrame = util.currentFrame()
     self._iterations += 1
Пример #2
0
 def start(self):
   if self._started: return
   self.trace("Starting")
   self._timer.start()
   self._started = True
   self._startFrame = util.currentFrame()
   self._iterations += 1
Пример #3
0
def processFrame():
    global currentState, lastState, currentTask
    commands.setHeadTilt()
    lastState = currentState
    currentState = game_state.state()

    if currentState == core.PLAYING and lastState != currentState and lastState != core.PENALISED:
        behavior_mem.timePlayingStarted = vision_frame_info.seconds_since_start

    if util.currentFrame() % 30 == 0:
        util.checkTemperatures()

    if areDistinct(currentState, lastState):
        if currentTask:
            currentTask.finish()
        currentTask = createStateTask(currentState)

    if util.checkFallen(
    ) and robot_state.WO_SELF != core.WO_TEAM_COACH and not game_state.isPenaltyKick:
        commands.setStiffness(cfgstiff.Zero)
        kick_request.abortKick()
        walk_request.noWalk()
        return

    currentTask.processFrame()
Пример #4
0
 def transition(self, state):
   if isinstance(state, int):
     self.istate = state
     if self.istate < 0 or self.istate >= len(self.states):
       raise Exception("Invalid state index: %i" % state)
     self.state = self.states[self.istate]
   elif isinstance(state, basestring):
     self.state = state
     if not state in self.states:
       raise Exception("State does not exist in the state machine: %s" % state)
     self.istate = self.states.index(state)
   else:
     raise Exception("Invalid state passed: %s" % str(state))
   self._timer.start()
   self.startFrame = util.currentFrame()
Пример #5
0
 def transition(self, state):
     if isinstance(state, int):
         self.istate = state
         if self.istate < 0 or self.istate >= len(self.states):
             raise Exception("Invalid state index: %i" % state)
         self.state = self.states[self.istate]
     elif isinstance(state, basestring):
         self.state = state
         if not state in self.states:
             raise Exception(
                 "State does not exist in the state machine: %s" % state)
         self.istate = self.states.index(state)
     else:
         raise Exception("Invalid state passed: %s" % str(state))
     self._timer.start()
     self.startFrame = util.currentFrame()
Пример #6
0
 def transition(self, state):
   oldstate = self.state
   if isinstance(state, int):
     istate = state
     if istate not in self.states:
       raise Exception("Invalid state index: %i" % istate)
     self.state = self.states[istate]
   elif isinstance(state, basestring):
     if state not in self.stateValues:
       raise Exception("State does not exist in the state machine: %s" % state)
     self.state = state
   else:
     raise Exception("Invalid state passed: %s" % str(state))
   self._timer.start()
   self.startFrame = util.currentFrame()
   if self.debug:
     print("transitioned from %s to %s" % (oldstate, self.state))
Пример #7
0
 def transition(self, state):
   oldstate = self.state
   if isinstance(state, int):
     istate = state
     if istate not in self.states:
       raise Exception("Invalid state index: %i" % istate)
     self.state = self.states[istate]
   elif isinstance(state, basestring):
     if state not in self.stateValues:
       raise Exception("State does not exist in the state machine: %s" % state)
     self.state = state
   else:
     raise Exception("Invalid state passed: %s" % str(state))
   self._timer.start()
   self.startFrame = util.currentFrame()
   if self.debug:
     print "transitioned from %s to %s" % (oldstate, self.state)
Пример #8
0
 def isFirstFrameInState(self):
     return self.startFrame == util.currentFrame()
Пример #9
0
 def getFrames(self):
     return util.currentFrame() - self._startFrame
Пример #10
0
 def framesSinceTransition(self):
     return util.currentFrame() - self.startFrame
Пример #11
0
 def start(self):
     self._started = True
     self._timer.start()
     self._startFrame = util.currentFrame()
     self._iterations += 1
Пример #12
0
 def isFirstFrameInState(self):
   return self.startFrame == util.currentFrame()
Пример #13
0
 def getFrames(self):
   return util.currentFrame() - self._startFrame
Пример #14
0
 def framesSinceTransition(self):
   return util.currentFrame() - self.startFrame
Пример #15
0
 def start(self):
   self._started = True
   self._timer.start()
   self._startFrame = util.currentFrame()
   self._iterations += 1