def start(self): if self._started: return self.trace("Starting") self._timer.start() self._started = True self._startFrame = util.currentFrame() self._iterations += 1
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()
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()
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()
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))
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)
def isFirstFrameInState(self): return self.startFrame == util.currentFrame()
def getFrames(self): return util.currentFrame() - self._startFrame
def framesSinceTransition(self): return util.currentFrame() - self.startFrame
def start(self): self._started = True self._timer.start() self._startFrame = util.currentFrame() self._iterations += 1