# ############################################################################### try: from auto.camera_pi import CameraRGB except ImportError: from auto.camera_cv2 import CameraRGB import rpyc import time import io import traceback from threading import Thread, Condition from auto import logger log = logger.init('camera_rpc_server', terminal=True) # This is how long the camera will stay open _after_ the last client disconnects. # It is common that another client will reconnect quickly after the last one disconnects, # thus keeping the camera open for some amount of time helps make things faster for the # next client. CAMERA_TIMEOUT_SECONDS = 60 # Camera parameters. For options, see: http://picamera.readthedocs.io/en/release-1.10/fov.html # Consider 640x480 or 320x240. Unfortunately, 640x480 seems to bog-down the CPU too much. CAM_WIDTH = 320 CAM_HEIGHT = 240 CAM_FPS = 8 # Global synchronized state. CLIENT_SET = set()
from auto.capabilities import acquire, release from auto.db import secure_db from auto import print_all from auto import console import myzbarlight import util import subprocess import json import time import cv2 import sys from auto import logger log = logger.init('wifi_controller', terminal=True) STORE = secure_db() wireless = Wireless(list_wifi_ifaces()[0]) system_priv_user = sys.argv[1] # the "Privileged" system user log.info("Starting Wifi controller using the privileged user: {}".format( system_priv_user)) def _get_one_button_press(): buttons = acquire('PushButtons') try: while True:
############################################################################### # # Copyright (c) 2017-2020 Master AI, Inc. # ALL RIGHTS RESERVED # # Use of this library, in source or binary form, is prohibited without written # approval from Master AI, Inc. # ############################################################################### from auto.rpc.server import serve from auto import logger log = logger.init(__name__, terminal=True) class LabsService: def __init__(self): self.send_func = None async def export_send(self, msg): if self.send_func is not None: return await self.send_func(msg) else: return False async def init(pubsub_channels): interface = LabsService() interface_factory = lambda: interface # we want to always return the same instance
# Copyright (c) 2017-2018 AutoAuto, LLC # ALL RIGHTS RESERVED # # Use of this library, in source or binary form, is prohibited without written # approval from AutoAuto, LLC. # ############################################################################### import time from collections import deque from auto.capabilities import list_caps, acquire, release from auto import logger log = logger.init('battery_monitor', terminal=True) log.info("Starting menu driver process...") buttons = acquire("PushButtons") button_stream = deque() combo = [1, 2, 3, 3, 2, 1] def _run_menu(): # TODO: This should, someday, be a nice menu of options shown on the LCD screen. # For now, however, we'll just run the calibration routine.
import queue import sys from pty_manager import PtyManager from verification_method import Verification from dashboard import Dashboard from auto import print_all from auto.db import secure_db STORE = secure_db() from auto import logger log = logger.init('cdp_connector', terminal=True) from cio.rpc_client import VERSION as cio_version from auto import __version__ as libauto_version def get_token(): device_token = STORE.get('DEVICE_TOKEN', None) if device_token is None: log.info('Device token is not set.') return None return device_token class CdpService(rpyc.Service): def __init__(self):
# - https://dev.nextthought.com/blog/2018/05/implementing-gevent-locks.html # - https://dev.nextthought.com/blog/2018/06/gevent-blocking-greenlets.html # - https://dev.nextthought.com/blog/2018/06/gevent-blocking-tracing.html from gevent import monkey monkey.patch_all() from gevent.lock import Semaphore import gevent import rpyc import types import functools from collections import defaultdict import sys from auto import logger log = logger.init('cio_rpc_server', terminal=True) try: from cio import default_handle as h log.info("Was able to get the CIO handle ('h'). Yay.") except Exception as e: # The controller must not be connected ... or is malfunctioning ...? log.error("Failed to get the CIO handle ('h').") h = None error = e def get_h(): if h is not None: return h else:
# # Copyright (c) 2017-2018 AutoAuto, LLC # ALL RIGHTS RESERVED # # Use of this library, in source or binary form, is prohibited without written # approval from AutoAuto, LLC. # ############################################################################### from gevent import monkey; monkey.patch_all() from gevent.lock import Semaphore import gevent import rpyc from auto import logger log = logger.init('console_ui', terminal=True) import pygame from collections import deque import os import re import time import numpy as np os.putenv("SDL_VIDEODRIVER", "fbcon") os.putenv("SDL_FBDEV", "/dev/fb1") os.putenv("SDL_MOUSEDRV", "TSLIB") os.putenv("SDL_MOUSEDEV", "/dev/input/event0")
async def init(self): self.lock = asyncio.Lock() self.log = logger.init(__name__, terminal=True) return True