'''Allows you to control the head of the rover using the Geomagic Touch''' from Rover import Rover from PhantomOmni import PhantomOmni from time import sleep, time from Tkinter import Tk, Canvas, Label from threading import Thread import cv2 x = PhantomOmni("position") r = Rover() #set up tkinter window with canvas root = Tk() root.title = "PhantomOmni+Rover:Head Following" root.geometry("600x600") c = Canvas(root, width=600, height=600) c.pack() lastShowTime = 0 showDelay = 0.1 counter = 0 locked = False def capture_image(): global counter #Gets image from stream and saves it img = r.get_image() cv2.imwrite("saved_images/{}.jpg".format(counter), img) print("Saved {}.jpg!".format(counter))
from PhantomOmni import PhantomOmni from time import sleep text = raw_input("What do you want to write?") arm = PhantomOmni("gravity") STARTX = -81 RECORDX = -11 mod = STARTX - RECORDX def coords_to_write(move): a = [] for x in move: if str(x)[0] != "-": x = "+" + str(x) x = str(x).ljust(8, "0") a.append(x) return "{}|{}|{}\n".format(a[0], a[1], a[2]) def write_to_coords(txt): txt = txt.replace("\n", "").split("|") return [float(x) for x in txt] try: for n, char in enumerate(text): file = "letters/{}.txt".format(char)
def setup_phantom(self): self.phantom = PhantomOmni(mode="mouse")
'''Lets you use the geomagic touch as a mouse''' from PhantomOmni import PhantomOmni import pyautogui from subprocess import call arm = PhantomOmni(mode="mouse") while True: try: pass except KeyboardInterrupt: arm.kill() exit()
from Rover import Rover from PhantomOmni import PhantomOmni from time import sleep, time import cv2 arm = PhantomOmni("forces") sleep(2) r = Rover() claw_open = True last_claw = True jolt_delay = 1 last_jolt_time = 0 counter = 0 def show_image(): global counter img = r.get_image() cv2.imwrite("saved_images/{}.jpg".format(counter), img) print("Saved {}.jpg!".format(counter)) counter += 1 def mapValues(value, leftMin, leftMax, rightMin, rightMax): # Figure out how 'wide' each range is leftSpan = leftMax - leftMin rightSpan = rightMax - rightMin # Convert the left range into a 0-1 range (float)