def _set_current_baseline(self, user_id): """Get last user's baseline from database and store it on slot for further use.""" xa, ya, xb, yb, xc, yc, t = data_manager.baseline_get_last(user_id) self.logger.info( "Take baseline from time: " + t + " while current time is: " + data_manager.current_time_to_string() ) if (time.time() - data_manager.time_from_string(t)) > 10 * 60: self.logger.warning( "WARNING!!! Baseline for this scenario was collected more than 10 minutes ago!!! Is it expected???" ) if self._dummy: self.xa = 0.005 self.ya = 0.005 self.xb = 0.005 self.yb = 0.005 self.xc = 0.0 self.yc = 0.0 else: self.xa = float(xa) self.ya = float(ya) self.xb = float(xb) self.yb = float(yb) self.xc = float(xc) self.yc = float(yc)
def _set_current_baseline(self, user_id): """Get last user's baseline from database and store it on slot for further use.""" xa, ya, xb, yb, xc, yc, t = data_manager.baseline_get_last(user_id) self.logger.info("Take baseline from time: " + t + " while current time is: " + data_manager.current_time_to_string()) if (time.time() - data_manager.time_from_string(t)) > 10 * 60: self.logger.warning( "WARNING!!! Baseline for this scenario was collected more than 10 minutes ago!!! Is it expected???" ) if self._dummy: self.xa = 0.005 self.ya = 0.005 self.xb = 0.005 self.yb = 0.005 self.xc = 0.0 self.yc = 0.0 else: self.xa = float(xa) self.ya = float(ya) self.xb = float(xb) self.yb = float(yb) self.xc = float(xc) self.yc = float(yc)
def _set_user_maxes(self, user_id): """Get last user's calibration data - his maxes - from database and store it for further use. Used in game scenario. """ up, right, down, left, t = data_manager.calibration_get_last(user_id) self.logger.info( "Take maxes from calibration on time: " + t + " while current time is: " + data_manager.current_time_to_string() ) if (time.time() - data_manager.time_from_string(t)) > 10 * 60: self.logger.warning( "WARNING!!! Calibration for this game scenario was collected more than 10 minutes ago!!! Is it expected???" ) self._maxes = {"up": float(up), "right": float(right), "down": float(down), "left": float(left)} print "******************************************" print self._maxes self.logger.info("_maxes set to user maxes which is: " + str(self._maxes))
def _set_user_maxes(self, user_id): """Get last user's calibration data - his maxes - from database and store it for further use. Used in game scenario. """ up, right, down, left, t = data_manager.calibration_get_last(user_id) self.logger.info("Take maxes from calibration on time: " + t + " while current time is: " + data_manager.current_time_to_string()) if (time.time() - data_manager.time_from_string(t)) > 10 * 60: self.logger.warning( "WARNING!!! Calibration for this game scenario was collected more than 10 minutes ago!!! Is it expected???" ) self._maxes = { 'up': float(up), 'right': float(right), 'down': float(down), 'left': float(left) } print '******************************************' print self._maxes self.logger.info("_maxes set to user maxes which is: " + str(self._maxes))