from ComputerVision2.Examples import signs import RobotAPI as rapi robot = rapi.RobotAPI() mode = 0 def manual(type): if type == 87: robot.move(150, 150, 10) if type == 83: robot.move(-150, -150, 10) if type == 68: robot.move(150, -150, 15) if type == 65: robot.move(-150, 150, 15) def robotGo(): robot.step(150, 150) frame = robot.get_frame() sign = signs.find_signs(frame) if sign is not None: return 0 else: return 1 while True: key = robot.get_key() if key == 49:
# import RoboRacers.RobotAPI as RobotAPI import RobotAPI import time import cv2 import numpy import math robot = RobotAPI.RobotAPI(0) # robot.set_camera(fps=30, width=640, height=480) frame = robot.get_frame() width = frame.shape[1] height = frame.shape[0] low = numpy.array([0, 0, 0]) high = numpy.array([255, 255, 255]) ksize = 4 robot.manual_regim = 1 print("Start") robot.ready() # robot.move(45) robot.servo(90) turns = 0 e_old = 0 while 1: if robot.manual() == 1: continue frame = robot.get_frame() # cv2.rectangle(frame, (140, height - 250), (width - 350, height - 230), (255, 0, 0), 2) # median_blur = cv2.medianBlur(frame, ksize - 1) # grey = cv2.cvtColor(median_blur, cv2.COLOR_BGR2GRAY)
# import RoboRacers.RobotAPI as RobotAPI import RobotAPI import time import cv2 import numpy import math robot = RobotAPI.RobotAPI(1) # robot.set_camera(fps=30, width=640, height=480) frame = robot.get_frame() width = frame.shape[1] height = frame.shape[0] print(width, height) low = numpy.array([0, 0, 0]) high = numpy.array([255, 255, 255]) ksize = 6 robot.manual_regim = 1 print("Start") robot.ready() # robot.move(45) robot.servo(90) while 1: if robot.manual() == 1: continue frame = robot.get_frame() # cv2.rectangle(frame, (170, 60), (width - 350, 80), (255, 0, 0), 2) # robot.set_frame(frame, 20) # continue
import RobotAPI as rapi import time import cv2 import datetime robot = rapi.RobotAPI(flag_serial=False) # robot.set_camera_high_res() # robot.beep() # robot.blue() print("Start RAW") t = time.time() c = 0 robot.manual_regim = 1 angle = 0 while 1: frame = robot.get_frame() # .copy() # if robot.button()==1:======== # z=0/0 # print(robot.mouse_x, robot.mouse_y) # robot.wait(10) # if robot.vcc()<9.5 and time.time()-t>5: # robot.beep() # t=time.time() if time.time() - t > 1.05: t = time.time() # f = open("/sys/class/thermal/thermal_zone0/temp", "r") # temp = int(f.readline()) / 1000 # print(datetime.datetime.now(),temp) print(datetime.datetime.now())