def start(self, env): import params env.set_params(params) self.configure(env) falcon('server', action='start')
def stop(self, env, rolling_restart=False): import params env.set_params(params) falcon('server', action='stop') # if performing an upgrade, backup some directories after stopping falcon if rolling_restart: falcon_server_upgrade.post_stop_backup()
def start(self, env, rolling_restart=False): import params env.set_params(params) self.configure(env) falcon('server', action='start')
def stop(self, env, upgrade_type=None): import params env.set_params(params) falcon('server', action='stop', upgrade_type=upgrade_type) # if performing an upgrade (ROLLING / NON_ROLLING), backup some directories after stopping falcon if upgrade_type is not None: falcon_server_upgrade.post_stop_backup()
def main(callback=None): m = PyMouse() def exit_handler(): for button in range(3): m.release(0, 0, button + 1) atexit.register(exit_handler) width, height = m.screen_size() width /= 2 height /= 2 old_buttons = 0 for f in falcon(): x, y, z = xyz(f.getPosition()) new_buttons = buttons(f) xx = int(width + x * width // 0.03) yy = int(height - y * height // 0.03) m.move(xx, yy) if callback: callback(f, xx, yy) for button in range(3): if new_buttons & 1 << button and not old_buttons & 1 << button: m.press(xx, yy, button + 1) if not new_buttons & 1 << button and old_buttons & 1 << button: m.release(xx, yy, button + 1) if new_buttons & 1 << 3: print("â–¶ pressed; exiting") break old_buttons = new_buttons time.sleep(1 / 60)
def main(): entry = None for f in falcon(): p = np.array(xyz(f.getPosition())) if (CUBE[0] < p).all() and (CUBE[1] > p).all(): f.setForces(vec(STIFFNESS * (entry - p))) else: entry = p f.setForces(vec([0, 0, 0]))
def mysql(statement): db = pymysql.connect(host="106.15.208.12", user="******", password="******", port=3306, charset='utf8') try: with db.cursor() as cursor: cur = db.cursor() sql = statement cur.execute(sql) result = cur.fetchall() for value in result: # print(value) v_list = [] for v in value: v_list.append(v) falcon.falcon(v_list[0], float(v_list[3]), v_list[4]) finally: cur.close()
def main(): entry = None for f in falcon(): force = np.array([0.0, 0.0, 0.0]) p = np.array(xyz(f.getPosition())) if (CUBE[0] < p).all() and (CUBE[1] > p).all(): closest_edge, dist = min(enumerate( np.append(CUBE[0] - p, CUBE[1] - p)), key=lambda x: abs(x[1])) force[closest_edge % 3] = dist f.setForces(vec(STIFFNESS * force))
def main(): frame_no = 0 color = np.array([0.0, 0.0, 0.0]) for f in falcon(): f.setLEDStatus( int( np.packbits( np.append([0, 0, 0, 0], frame_no < np.array( tuple(map(lambda x: math.sin(x) * 25, color))))))) frame_no += 1 frame_no %= FRAMES color += SPEED color %= math.pi * 2
def configure(self, env): import params env.set_params(params) falcon('client', action='config')
def configure(self, env): falcon()
def start(self, env, upgrade_type=None): import params env.set_params(params) self.configure(env, upgrade_type=upgrade_type) falcon('server', action='start', upgrade_type=upgrade_type)
def configure(self, env, upgrade_type=None): import params env.set_params(params) falcon('server', action='config', upgrade_type=upgrade_type)
def stop(self, env): import params env.set_params(params) falcon('server', action='stop')
def main(): window = pyglet.window.Window(fullscreen=True) loading = pyglet.text.Label('Loading…', x=window.width // 2, y=window.height // 2, anchor_x='center', anchor_y='center') background = pyglet.graphics.vertex_list( 4, ('v2i', (0, 0, window.width, 0, window.width, window.height, 0, window.height)), ('c3B', (0, 0xFF, 0, 0, 0xFF, 0, 0, 0, 0xFF, 0, 0, 0xFF))) f = falcon() @window.event def on_draw(): background.draw(pyglet.gl.GL_QUADS) if all: all.draw() else: loading.draw() @window.event def on_key_press(symbol, modifiers): pyglet.app.event_loop.exit() def update(dt): global old_buttons, recoil, all, sight, bang if not all: _all = pyglet.graphics.Batch() sight = pyglet.sprite.Sprite(pyglet.image.load('sight.gif'), batch=_all) bang = pyglet.resource.media('bang.wav', streaming=False) all = _all ff = next(f) if recoil > 0: recoil -= 1 ff.setForces(vec(FORCE)) else: ff.setForces(vec([0, 0, 0])) x, y, z = xyz(ff.getPosition()) sight.x = window.width // 2 + x * window.width // 0.06 sight.y = window.height // 2 + y * window.width // 0.06 new_buttons = buttons(ff) if new_buttons & 1 << 2 and not old_buttons & 1 << 2: recoil = DURATION bang.play() if new_buttons & 1 << 3: print("▶ pressed; exiting") pyglet.app.event_loop.exit() old_buttons = new_buttons pyglet.clock.schedule_interval(update, 1 / 60.) pyglet.app.run()
def main(): for f in falcon(): print('{0[0]:+.5f} {0[1]:+.5f} {0[2]:+.5f} : {1:04b} : {2}'.format( xyz(f.getPosition()), buttons(f), 'not homed' if homing(f) else 'homed'))