import time import math from flask import request, Flask, send_from_directory from Omnibot import * app = Flask(__name__) twitch = Omnibot() @app.route('/') def hello(): return send_from_directory('html', 'index.html') @app.route('/move') def move(): direction, speed = float(request.args.get('direction')), float( request.args.get('speed')) twitch.move(math.radians(direction), speed) return 'hooray' @app.route('/spin') def spin(): speed = float(request.args.get('speed')) twitch.spin(speed) return 'dizzy' @app.route('/stop') def halt():
from termcolor import colored from time import sleep import math from IMU import * from Omnibot import * from PID import * imu = IMU(1) zeroAngle = math.radians(180) twitch = Omnibot() def getDriveAngle(x, y, zeroAngle): fallingAngle = math.atan2(x, y) if fallingAngle < 0: fallingAngle = fallingAngle + 2 * math.pi drivingAngle = fallingAngle + math.pi + zeroAngle if drivingAngle > 2 * math.pi: drivingAngle = drivingAngle - 2 * math.pi return drivingAngle def getDriveSpeed(x, y): drivingSpeed = 200 * (x**2 + y**2)**(.5) return drivingSpeed pitch = [] roll = [] pitchPIDController = PIDController()
import time import math from Omnibot import * twitch = Omnibot() twitch.move(math.radians(77), 2) time.sleep(2) while True: #twitch.move(math.radians(77), 2) time.sleep(60.0 / 400 / 50)
from termcolor import colored from time import sleep import math from IMU import * from Omnibot import * from PID import * imu = IMU(1) zeroAngle = math.radians(103) twitch = Omnibot() def getDriveAngle (x, y, zeroAngle): fallingAngle = math.atan2(x, y) if fallingAngle < 0: fallingAngle = fallingAngle + 2 * math.pi drivingAngle = fallingAngle + math.pi + zeroAngle if drivingAngle > 2 * math.pi: drivingAngle = drivingAngle - 2 * math.pi return drivingAngle def getDriveSpeed (x, y): drivingSpeed = 200 * (x ** 2 + y ** 2) ** (.5) return drivingSpeed pitch = [] roll = [] pitchPIDController = PIDController() rollPIDController = PIDController() count = 0 while True:
import time import math from Omnibot import * zeroAngle = math.radians(103) twitch = Omnibot() twitch.move(0, 2) while True: time.sleep(.1)
import time import math from Omnibot import * zeroAngle = math.radians(103) twitch = Omnibot() # for direction in range(0, 360, 10): # twitch.move(math.radians(direction), 5) # time.sleep(.5) # print math.radians(direction) # time.sleep(.25) # twitch.spin(40) # time.sleep(.5) # twitch.spin(0) # time.sleep(2) # twitch.spin(-10) # time.sleep(2) twitch.stop()