def __init__(self, next_position_x=0, next_position_y=0, position_difference_x=0, position_difference_y=0, is_two_dimensional=False, final_movement=False, count=0): self.count = count self.poppy = PoppyHumanoid() self.is_two_dimensional=is_two_dimensional if self.is_two_dimensional is True: if self.count is 0: self.speed_obj = speed.Speed() self.initialize_robot() else: self.position_difference_x = position_difference_x self.position_difference_y = position_difference_y self.final_movement = final_movement self.next_position_y = next_position_x self.next_position_y = next_position_y self.speed_obj = speed.Speed() else: if self.count is 0: self.initialize_robot() else: self.position_difference_x = position_difference_x self.final_movement = final_movement self.next_position_x = next_position_x self.speed_obj = speed.Speed()
def start_speed_mode(self, linear): # Kill any previous Challenge / RC mode self.stop_threads() # Set Wiimote LED to RC Mode index if linear: self.current_mode = Mode.MODE_SPEED_LINEAR style = "LINEAR" else: self.current_mode = Mode.MODE_SPEED style = None # Default to whatever. # Set sensible speed self.core.set_speed_factor(0.35) # Inform user we are about to start RC mode logging.info("Entering into SPEED Mode") self.challenge = speed.Speed(self.core, self.oled, style) # Create and start a new thread # running the remote control script logging.info("Starting SPEED Thread") self.challenge_thread = threading.Thread(target=self.challenge.run) self.challenge_thread.start() logging.info("SPEED Thread Running")
def __init__(self, options, config): """Initializes all of the submodules bitHopper uses""" #Logging logging.basicConfig(stream=sys.stdout, format="%(asctime)s|%(module)s: %(message)s", datefmt="%H:%M:%S", level = logging.INFO) self.options = options self.config = config altercoins = ConfigParser.ConfigParser() altercoins.read(os.path.join(sys.path[0], "whatevercoin.cfg")) self.altercoins = {} for coin in altercoins.sections(): self.altercoins[coin] = dict(altercoins.items(coin)) self.altercoins[coin]['recent_difficulty'] = float(self.altercoins[coin]['recent_difficulty']) self.scheduler = None self.lp_callback = lp_callback.LP_Callback(self) self.difficulty = diff.Difficulty(self) self.exchange = exchange.Exchange(self) self.pool = None self.db = database.Database(self) self.pool = pool.Pool_Parse(self) self.api = api.API(self) self.pool.setup(self) self.work = work.Work(self) self.speed = speed.Speed() self.getwork_store = getwork_store.Getwork_store(self) self.data = data.Data(self) self.lp = lp.LongPoll(self) self.auth = None self.website = website.bitSite(self) self.pile = greenpool.GreenPool() self.plugin = plugin.Plugin(self) self.pile.spawn_n(self.delag_server)
matplotlib.use('pgf') import matplotlib.pyplot as plt #import mpl_toolkits.axisartist as axisartist font_size = 8 fig_width = 3.0 font = {'family': 'serif', 'serif': ['Times'], 'size': font_size} plt.rc('text', usetex=True) plt.rc('font', family='serif') plt.rcParams['text.latex.preamble'] = r'\usepackage{siunitx}' #matplotlib.rc('font', **font) speed_data = speed.Speed() accuracy_data = accuracy.Accuracy() speed_averages = {} speed_per_mat_element = {} accuracy_averages = {} accuracy_per_mat_element = {} series_to_rowcount = {} series_to_rowcount[1000.0] = 3000.0 series_to_rowcount[2000.0] = 5400.0 series_to_rowcount[3000.0] = 8526.0 series_to_rowcount[4000.0] = 12288.0 series_to_rowcount[6000.0] = 18468.0 series_to_rowcount[8000.0] = 24000.0 series_to_rowcount[12000.0] = 33396.0
model.load_weights(weights_path, weights_path, by_name=True) #model.load_weights(weights_path, weights_path, by_name=True, exclude=["ori_final"]) # tmp dataset_dir = os.path.join(DATA_DIR, args.dataset) # Train or evaluate if args.command == "train": # Load training and validation set if args.dataset != "speed": dataset_train = urso.Urso() dataset_train.load_dataset(dataset_dir, model.config, "train") dataset_val = urso.Urso() dataset_val.load_dataset(dataset_dir, model.config, "val") else: dataset_train = speed.Speed() dataset_train.load_dataset(dataset_dir, model.config, "train_no_val") # 'train_total') # dataset_val = speed.Speed() dataset_val.load_dataset(dataset_dir, model.config, "val") train(model, dataset_train, dataset_val) elif args.command == "test": if args.video: dataset = urso.Urso() dataset.load_dataset(dataset_dir, config, "test") detect_video(model, dataset, args.video) else: # Load validation dataset