import sys import os sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))) import asyncio from helper_keyboard_input import KeyboardHelper from sphero_sdk import SerialAsyncDal from sphero_sdk import SpheroRvrAsync # initialize global variables key_helper = KeyboardHelper() current_key_code = -1 driving_keys = [ord('w'), ord('a'), ord('s'), ord('d'), ord(' ')] max_speed = 255 max_heading = 359 speed = 0 heading = 0 flags = 0 loop = asyncio.get_event_loop() rvr = SpheroRvrAsync(dal=SerialAsyncDal(loop)) def keycode_callback(keycode): global current_key_code current_key_code = keycode print("Key code updated: ", str(current_key_code))
import sys import os import cv2 import time sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))) import asyncio from helper_keyboard_input import KeyboardHelper from sphero_sdk import SerialAsyncDal from sphero_sdk import SpheroRvrAsync from sphero_sdk import RvrStreamingServices # initialize global variables key_helper = KeyboardHelper() current_key_code = -1 driving_keys = [119, 97, 115, 100, 32] speed = 0 heading = 0 flags = 0 sleshR = 200 sleshG = 200 sleshB = 200 now_R = 0 now_G = 0 now_B = 0 loop = asyncio.get_event_loop() rvr = SpheroRvrAsync( dal=SerialAsyncDal(