repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/sim/lib/keyboard_ctrl.py | tools/sim/lib/keyboard_ctrl.py | import sys
import termios
import time
from multiprocessing import Queue
from termios import (BRKINT, CS8, CSIZE, ECHO, ICANON, ICRNL, IEXTEN, INPCK,
ISTRIP, IXON, PARENB, VMIN, VTIME)
from typing import NoReturn
from openpilot.tools.sim.bridge.common import QueueMessage, control_cmd_gen
# Indexe... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/sim/lib/simulated_car.py | tools/sim/lib/simulated_car.py | import traceback
import cereal.messaging as messaging
from opendbc.can.packer import CANPacker
from opendbc.can.parser import CANParser
from opendbc.car.honda.values import HondaSafetyFlags
from openpilot.common.params import Params
from openpilot.selfdrive.pandad.pandad_api_impl import can_list_to_can_capnp
from open... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/sim/lib/__init__.py | tools/sim/lib/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/sim/lib/camerad.py | tools/sim/lib/camerad.py | import numpy as np
import os
import pyopencl as cl
import pyopencl.array as cl_array
from msgq.visionipc import VisionIpcServer, VisionStreamType
from cereal import messaging
from openpilot.common.basedir import BASEDIR
from openpilot.tools.sim.lib.common import W, H
class Camerad:
"""Simulates the camerad daemon"... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/car_porting/auto_fingerprint.py | tools/car_porting/auto_fingerprint.py | #!/usr/bin/env python3
import argparse
from collections import defaultdict
from opendbc.car.debug.format_fingerprints import format_brand_fw_versions
from opendbc.car.fingerprints import MIGRATION
from opendbc.car.fw_versions import MODEL_TO_BRAND, match_fw_to_car
from openpilot.tools.lib.logreader import LogReader, ... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/car_porting/test_car_model.py | tools/car_porting/test_car_model.py | #!/usr/bin/env python3
import argparse
import sys
import unittest # noqa: TID251
from opendbc.car.tests.routes import CarTestRoute
from openpilot.selfdrive.car.tests.test_models import TestCarModel
from openpilot.tools.lib.route import SegmentRange
def create_test_models_suite(routes: list[CarTestRoute]) -> unittest... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/replay/ui.py | tools/replay/ui.py | #!/usr/bin/env python3
import argparse
import os
import sys
import cv2
import numpy as np
import pygame
import cereal.messaging as messaging
from openpilot.common.basedir import BASEDIR
from openpilot.common.transformations.camera import DEVICE_CAMERAS
from openpilot.tools.replay.lib.ui_helpers import (UP,
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/replay/__init__.py | tools/replay/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/replay/can_replay.py | tools/replay/can_replay.py | #!/usr/bin/env python3
import argparse
import os
import time
import usb1
import threading
os.environ['FILEREADER_CACHE'] = '1'
from openpilot.common.realtime import config_realtime_process, Ratekeeper, DT_CTRL
from openpilot.selfdrive.pandad import can_capnp_to_list
from openpilot.tools.lib.logreader import LogReader... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/replay/lib/ui_helpers.py | tools/replay/lib/ui_helpers.py | import itertools
from typing import Any
import matplotlib.pyplot as plt
import numpy as np
import pygame
from matplotlib.backends.backend_agg import FigureCanvasAgg
from openpilot.common.transformations.camera import get_view_frame_from_calib_frame
from openpilot.selfdrive.controls.radard import RADAR_TO_CAMERA
RE... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/replay/lib/__init__.py | tools/replay/lib/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/webcam/camera.py | tools/webcam/camera.py | import av
import cv2 as cv
class Camera:
def __init__(self, cam_type_state, stream_type, camera_id):
try:
camera_id = int(camera_id)
except ValueError: # allow strings, ex: /dev/video0
pass
self.cam_type_state = cam_type_state
self.stream_type = stream_type
self.cur_frame_id = 0
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/webcam/camerad.py | tools/webcam/camerad.py | #!/usr/bin/env python3
import threading
import os
import platform
from collections import namedtuple
from msgq.visionipc import VisionIpcServer, VisionStreamType
from cereal import messaging
from openpilot.tools.webcam.camera import Camera
from openpilot.common.realtime import Ratekeeper
ROAD_CAM = os.getenv("ROAD_C... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/clip/run.py | tools/clip/run.py | #!/usr/bin/env python3
import logging
import os
import platform
import shutil
import sys
import time
from argparse import ArgumentParser, ArgumentTypeError
from collections.abc import Sequence
from pathlib import Path
from random import randint
from subprocess import Popen
from typing import Literal
from cereal.messa... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/plotjuggler/test_plotjuggler.py | tools/plotjuggler/test_plotjuggler.py | import os
import glob
import signal
import subprocess
import time
from openpilot.common.basedir import BASEDIR
from openpilot.common.timeout import Timeout
from openpilot.tools.plotjuggler.juggle import DEMO_ROUTE, install
PJ_DIR = os.path.join(BASEDIR, "tools/plotjuggler")
class TestPlotJuggler:
def test_demo(se... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/plotjuggler/juggle.py | tools/plotjuggler/juggle.py | #!/usr/bin/env python3
import os
import sys
import platform
import shutil
import subprocess
import tarfile
import tempfile
import requests
import argparse
from functools import partial
from opendbc.car.fingerprints import MIGRATION
from openpilot.common.basedir import BASEDIR
from openpilot.common.swaglog import cloud... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/camerastream/compressed_vipc.py | tools/camerastream/compressed_vipc.py | #!/usr/bin/env python3
import av
import os
import sys
import argparse
import numpy as np
import multiprocessing
import time
import signal
import cereal.messaging as messaging
from msgq.visionipc import VisionIpcServer, VisionStreamType
V4L2_BUF_FLAG_KEYFRAME = 8
# start encoderd
# also start cereal messaging bridge... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/joystick/joystick_control.py | tools/joystick/joystick_control.py | #!/usr/bin/env python3
import os
import argparse
import threading
import numpy as np
from inputs import UnpluggedError, get_gamepad
from cereal import messaging
from openpilot.common.params import Params
from openpilot.common.realtime import Ratekeeper
from openpilot.system.hardware import HARDWARE
from openpilot.tool... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/joystick/joystickd.py | tools/joystick/joystickd.py | #!/usr/bin/env python3
import math
import numpy as np
from cereal import messaging, car
from opendbc.car.vehicle_model import VehicleModel
from openpilot.common.realtime import DT_CTRL, Ratekeeper
from openpilot.common.params import Params
from openpilot.common.swaglog import cloudlog
LongCtrlState = car.CarControl.... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/jotpluggler/views.py | tools/jotpluggler/views.py | import uuid
import threading
import numpy as np
from collections import deque
import dearpygui.dearpygui as dpg
from abc import ABC, abstractmethod
class ViewPanel(ABC):
"""Abstract base class for all view panels that can be displayed in a plot container"""
def __init__(self, panel_id: str | None = None):
se... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/jotpluggler/pluggle.py | tools/jotpluggler/pluggle.py | #!/usr/bin/env python3
import argparse
import os
import pyautogui
import subprocess
import dearpygui.dearpygui as dpg
import multiprocessing
import uuid
import signal
import yaml # type: ignore
from openpilot.common.swaglog import cloudlog
from openpilot.common.basedir import BASEDIR
from openpilot.tools.jotpluggler.d... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/jotpluggler/datatree.py | tools/jotpluggler/datatree.py | import os
import re
import threading
import numpy as np
import dearpygui.dearpygui as dpg
class DataTreeNode:
def __init__(self, name: str, full_path: str = "", parent=None):
self.name = name
self.full_path = full_path
self.parent = parent
self.children: dict[str, DataTreeNode] = {}
self.filtere... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/jotpluggler/data.py | tools/jotpluggler/data.py | import numpy as np
import threading
import multiprocessing
import bisect
from collections import defaultdict
from tqdm import tqdm
from openpilot.common.swaglog import cloudlog
from openpilot.selfdrive.test.process_replay.migration import migrate_all
from openpilot.tools.lib.logreader import _LogFileReader, LogReader
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/jotpluggler/layout.py | tools/jotpluggler/layout.py | import dearpygui.dearpygui as dpg
from openpilot.tools.jotpluggler.data import DataManager
from openpilot.tools.jotpluggler.views import TimeSeriesPanel
GRIP_SIZE = 4
MIN_PANE_SIZE = 60
class LayoutManager:
def __init__(self, data_manager, playback_manager, worker_manager, scale: float = 1.0):
self.data_manager... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/tuning/measure_steering_accuracy.py | tools/tuning/measure_steering_accuracy.py | #!/usr/bin/env python3
# type: ignore
import os
import time
import argparse
import signal
from collections import defaultdict
import cereal.messaging as messaging
from openpilot.tools.lib.logreader import LogReader
def sigint_handler(signal, frame):
exit(0)
signal.signal(signal.SIGINT, sigint_handler)
class Steer... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/framereader.py | tools/lib/framereader.py | import os
import subprocess
import json
import logging
from collections.abc import Iterator
from collections import OrderedDict
import numpy as np
from openpilot.tools.lib.filereader import FileReader, resolve_name
from openpilot.tools.lib.exceptions import DataUnreadableError
from openpilot.tools.lib.vidindex import ... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/api.py | tools/lib/api.py | import os
import requests
API_HOST = os.getenv('API_HOST', 'https://api.commadotai.com')
# TODO: this should be merged into common.api
class CommaApi:
def __init__(self, token=None):
self.session = requests.Session()
self.session.headers['User-agent'] = 'OpenpilotTools'
if token:
self.session.head... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/kbhit.py | tools/lib/kbhit.py | #!/usr/bin/env python3
import sys
import termios
import atexit
from select import select
class KBHit:
def __init__(self) -> None:
''' Creates a KBHit object that you can call to do various keyboard things.
'''
self.stdin_fd = sys.stdin.fileno()
self.set_kbhit_terminal()
def set_kbhit_terminal(se... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/logreader.py | tools/lib/logreader.py | #!/usr/bin/env python3
import bz2
from functools import partial
import multiprocessing
import capnp
import enum
import os
import pathlib
import sys
import tqdm
import urllib.parse
import warnings
import zstandard as zstd
from collections.abc import Iterable, Iterator
from urllib.parse import parse_qs, urlparse
from c... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/openpilotcontainers.py | tools/lib/openpilotcontainers.py | #!/usr/bin/env python3
from openpilot.tools.lib.azure_container import AzureContainer
OpenpilotCIContainer = AzureContainer("commadataci", "openpilotci")
DataCIContainer = AzureContainer("commadataci", "commadataci")
DataProdContainer = AzureContainer("commadata2", "commadata2")
| python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/file_sources.py | tools/lib/file_sources.py | from collections.abc import Callable
from openpilot.tools.lib.comma_car_segments import get_url as get_comma_segments_url
from openpilot.tools.lib.openpilotci import get_url
from openpilot.tools.lib.filereader import DATA_ENDPOINT, file_exists, internal_source_available
from openpilot.tools.lib.route import Route, Seg... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/url_file.py | tools/lib/url_file.py | import logging
import os
import re
import socket
import time
from hashlib import md5
from urllib3 import PoolManager, Retry
from urllib3.response import BaseHTTPResponse
from urllib3.util import Timeout
from openpilot.common.utils import atomic_write
from openpilot.system.hardware.hw import Paths
from urllib3.exceptio... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/comma_car_segments.py | tools/lib/comma_car_segments.py | import os
import requests
# Forks with additional car support can fork the commaCarSegments repo on huggingface or host the LFS files themselves
COMMA_CAR_SEGMENTS_REPO = os.environ.get("COMMA_CAR_SEGMENTS_REPO", "https://huggingface.co/datasets/commaai/commaCarSegments")
COMMA_CAR_SEGMENTS_BRANCH = os.environ.get("C... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/vidindex.py | tools/lib/vidindex.py | #!/usr/bin/env python3
import argparse
import os
import struct
from enum import IntEnum
from openpilot.tools.lib.filereader import FileReader
DEBUG = int(os.getenv("DEBUG", "0"))
# compare to ffmpeg parsing
# ffmpeg -i <input.hevc> -c copy -bsf:v trace_headers -f null - 2>&1 | grep -B4 -A32 '] 0 '
# H.265 specifica... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/route.py | tools/lib/route.py | import os
import re
import requests
from functools import cache
from urllib.parse import urlparse
from collections import defaultdict
from itertools import chain
from openpilot.tools.lib.auth_config import get_token
from openpilot.tools.lib.api import APIError, CommaApi
from openpilot.tools.lib.helpers import RE
cla... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/bootlog.py | tools/lib/bootlog.py | import functools
import re
from openpilot.tools.lib.auth_config import get_token
from openpilot.tools.lib.api import CommaApi
from openpilot.tools.lib.helpers import RE
@functools.total_ordering
class Bootlog:
def __init__(self, url: str):
self._url = url
r = re.search(RE.BOOTLOG_NAME, url)
if not r:
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/exceptions.py | tools/lib/exceptions.py | class DataUnreadableError(Exception):
pass
| python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/github_utils.py | tools/lib/github_utils.py | import base64
import requests
from http import HTTPMethod
class GithubUtils:
def __init__(self, api_token, data_token, owner='commaai', api_repo='openpilot', data_repo='ci-artifacts'):
self.OWNER = owner
self.API_REPO = api_repo
self.DATA_REPO = data_repo
self.API_TOKEN = api_token
self.DATA_TOKE... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/helpers.py | tools/lib/helpers.py | # regex patterns
class RE:
DONGLE_ID = r'(?P<dongle_id>[a-f0-9]{16})'
TIMESTAMP = r'(?P<timestamp>[0-9]{4}-[0-9]{2}-[0-9]{2}--[0-9]{2}-[0-9]{2}-[0-9]{2})'
LOG_ID_V2 = r'(?P<count>[a-f0-9]{8})--(?P<uid>[a-z0-9]{10})'
LOG_ID = fr'(?P<log_id>(?:{TIMESTAMP}|{LOG_ID_V2}))'
ROUTE_NAME = fr'(?P<route_name>{DONGLE_ID... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/openpilotci.py | tools/lib/openpilotci.py | from openpilot.tools.lib.openpilotcontainers import OpenpilotCIContainer
def get_url(*args, **kwargs):
return OpenpilotCIContainer.get_url(*args, **kwargs)
def upload_file(*args, **kwargs):
return OpenpilotCIContainer.upload_file(*args, **kwargs)
def upload_bytes(*args, **kwargs):
return OpenpilotCIContainer.u... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/live_logreader.py | tools/lib/live_logreader.py | import os
from cereal import log as capnp_log, messaging
from cereal.services import SERVICE_LIST
from openpilot.tools.lib.logreader import LogIterable, RawLogIterable
ALL_SERVICES = list(SERVICE_LIST.keys())
def raw_live_logreader(services: list[str] = ALL_SERVICES, addr: str = '127.0.0.1') -> RawLogIterable:
if... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/sanitizer.py | tools/lib/sanitizer.py | # Utilities for sanitizing routes of only essential data for testing car ports and doing validation.
from openpilot.tools.lib.logreader import LogIterable, LogMessage
def sanitize_vin(vin: str):
# (last 6 digits of vin are serial number https://en.wikipedia.org/wiki/Vehicle_identification_number)
VIN_SENSITIVE =... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/__init__.py | tools/lib/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/filereader.py | tools/lib/filereader.py | import os
import io
import posixpath
import socket
from functools import cache
from openpilot.common.utils import retry
from urllib.parse import urlparse
from openpilot.tools.lib.url_file import URLFile
DATA_ENDPOINT = os.getenv("DATA_ENDPOINT", "http://data-raw.comma.internal/")
@cache
@retry(delay=0.0)
def intern... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/azure_container.py | tools/lib/azure_container.py | import os
from datetime import datetime, timedelta, UTC
from functools import lru_cache
from pathlib import Path
from typing import IO
TOKEN_PATH = Path("/data/azure_token")
@lru_cache
def get_azure_credential():
if "AZURE_TOKEN" in os.environ:
return os.environ["AZURE_TOKEN"]
elif TOKEN_PATH.is_file():
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/cache.py | tools/lib/cache.py | import os
import urllib.parse
DEFAULT_CACHE_DIR = os.getenv("CACHE_ROOT", os.path.expanduser("~/.commacache"))
def cache_path_for_file_path(fn, cache_dir=DEFAULT_CACHE_DIR):
dir_ = os.path.join(cache_dir, "local")
os.makedirs(dir_, exist_ok=True)
fn_parsed = urllib.parse.urlparse(fn)
if fn_parsed.scheme == ''... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/auth_config.py | tools/lib/auth_config.py | import json
import os
from openpilot.system.hardware.hw import Paths
class MissingAuthConfigError(Exception):
pass
def get_token():
try:
with open(os.path.join(Paths.config_root(), 'auth.json')) as f:
auth = json.load(f)
return auth['access_token']
except Exception:
return None
def set_t... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/auth.py | tools/lib/auth.py | #!/usr/bin/env python3
"""
Usage::
usage: auth.py [-h] [{google,apple,github,jwt}] [jwt]
Login to your comma account
positional arguments:
{google,apple,github,jwt}
jwt
optional arguments:
-h, --help show this help message and exit
Examples::
./auth.py # Log in with google accou... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/log_time_series.py | tools/lib/log_time_series.py | import numpy as np
def flatten_type_dict(d, sep="/", prefix=None):
res = {}
if isinstance(d, dict):
for key, val in d.items():
if prefix is None:
res.update(flatten_type_dict(val, prefix=key))
else:
res.update(flatten_type_dict(val, prefix=prefix + sep + key))
return res
elif... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/tests/test_caching.py | tools/lib/tests/test_caching.py | import http.server
import os
import shutil
import socket
import tempfile
import pytest
from openpilot.selfdrive.test.helpers import http_server_context
from openpilot.system.hardware.hw import Paths
from openpilot.tools.lib.url_file import URLFile, prune_cache
import openpilot.tools.lib.url_file as url_file_module
c... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/tests/test_route_library.py | tools/lib/tests/test_route_library.py | from collections import namedtuple
from openpilot.tools.lib.route import SegmentName
class TestRouteLibrary:
def test_segment_name_formats(self):
Case = namedtuple('Case', ['input', 'expected_route', 'expected_segment_num', 'expected_data_dir'])
cases = [ Case("a2a0ccea32023010|2023-07-27--13-01-19", "a2a0... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/tests/test_logreader.py | tools/lib/tests/test_logreader.py | import capnp
import contextlib
import io
import shutil
import tempfile
import os
import pytest
import requests
from parameterized import parameterized
from cereal import log as capnp_log
from openpilot.tools.lib.logreader import LogsUnavailable, LogIterable, LogReader, parse_indirect, ReadMode
from openpilot.tools.li... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/tests/__init__.py | tools/lib/tests/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/lib/tests/test_comma_car_segments.py | tools/lib/tests/test_comma_car_segments.py | import pytest
import requests
from opendbc.car.fingerprints import MIGRATION
from openpilot.tools.lib.comma_car_segments import get_comma_car_segments_database, get_url
from openpilot.tools.lib.logreader import LogReader
from openpilot.tools.lib.route import SegmentRange
@pytest.mark.skip(reason="huggingface is flaky... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/bodyteleop/web.py | tools/bodyteleop/web.py | import asyncio
import dataclasses
import json
import logging
import os
import ssl
import subprocess
import pyaudio
import wave
from aiohttp import web
from aiohttp import ClientSession
from openpilot.common.basedir import BASEDIR
from openpilot.system.webrtc.webrtcd import StreamRequestBody
from openpilot.common.para... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/longitudinal_maneuvers/generate_report.py | tools/longitudinal_maneuvers/generate_report.py | #!/usr/bin/env python3
import argparse
import base64
import io
import os
import math
import pprint
import webbrowser
from collections import defaultdict
from pathlib import Path
import matplotlib.pyplot as plt
from tabulate import tabulate
from openpilot.tools.lib.logreader import LogReader
from openpilot.system.hardw... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/tools/longitudinal_maneuvers/maneuversd.py | tools/longitudinal_maneuvers/maneuversd.py | #!/usr/bin/env python3
import numpy as np
from dataclasses import dataclass
from cereal import messaging, car
from openpilot.common.constants import CV
from openpilot.common.realtime import DT_MDL
from openpilot.common.params import Params
from openpilot.common.swaglog import cloudlog
@dataclass
class Action:
acce... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/site_scons/site_tools/cython.py | site_scons/site_tools/cython.py | import re
import SCons
from SCons.Action import Action
from SCons.Scanner import Scanner
import numpy as np
pyx_from_import_re = re.compile(r'^from\s+(\S+)\s+cimport', re.M)
pyx_import_re = re.compile(r'^cimport\s+(\S+)', re.M)
cdef_import_re = re.compile(r'^cdef extern from\s+.(\S+).:', re.M)
np_version = SCons.Scri... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/params.py | common/params.py | from openpilot.common.params_pyx import Params, ParamKeyFlag, ParamKeyType, UnknownKeyName
assert Params
assert ParamKeyFlag
assert ParamKeyType
assert UnknownKeyName
if __name__ == "__main__":
import sys
params = Params()
key = sys.argv[1]
assert params.check_key(key), f"unknown param: {key}"
if len(sys.a... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/text_window.py | common/text_window.py | #!/usr/bin/env python3
import os
import time
import subprocess
from openpilot.common.basedir import BASEDIR
class TextWindow:
def __init__(self, text):
try:
self.text_proc = subprocess.Popen(["./text.py", text],
stdin=subprocess.PIPE,
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/simple_kalman.py | common/simple_kalman.py | import numpy as np
def get_kalman_gain(dt, A, C, Q, R, iterations=100):
P = np.zeros_like(Q)
for _ in range(iterations):
P = A.dot(P).dot(A.T) + dt * Q
S = C.dot(P).dot(C.T) + R
K = P.dot(C.T).dot(np.linalg.inv(S))
P = (np.eye(len(P)) - K.dot(C)).dot(P)
return K
class KF1D:
# this EKF assume... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/spinner.py | common/spinner.py | import os
import subprocess
from openpilot.common.basedir import BASEDIR
class Spinner:
def __init__(self):
try:
self.spinner_proc = subprocess.Popen(["./spinner.py"],
stdin=subprocess.PIPE,
cwd=os.path.join(BASEDIR, "sy... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/time_helpers.py | common/time_helpers.py | import datetime
from pathlib import Path
MIN_DATE = datetime.datetime(year=2025, month=2, day=21)
def min_date():
# on systemd systems, the default time is the systemd build time
systemd_path = Path("/lib/systemd/systemd")
if systemd_path.exists():
d = datetime.datetime.fromtimestamp(systemd_path.stat().st_... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/pid.py | common/pid.py | import numpy as np
from numbers import Number
class PIDController:
def __init__(self, k_p, k_i, k_d=0., pos_limit=1e308, neg_limit=-1e308, rate=100):
self._k_p = k_p
self._k_i = k_i
self._k_d = k_d
if isinstance(self._k_p, Number):
self._k_p = [[0], [self._k_p]]
if isinstance(self._k_i, Num... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/api.py | common/api.py | import jwt
import os
import requests
from datetime import datetime, timedelta, UTC
from openpilot.system.hardware.hw import Paths
from openpilot.system.version import get_version
API_HOST = os.getenv('API_HOST', 'https://api.commadotai.com')
# name: jwt signature algorithm
KEYS = {"id_rsa": "RS256",
"id_ecdsa... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/timeout.py | common/timeout.py | import signal
class TimeoutException(Exception):
pass
class Timeout:
"""
Timeout context manager.
For example this code will raise a TimeoutException:
with Timeout(seconds=5, error_msg="Sleep was too long"):
time.sleep(10)
"""
def __init__(self, seconds, error_msg=None):
if error_msg is None:
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/util.py | common/util.py | import os
import subprocess
def sudo_write(val: str, path: str) -> None:
try:
with open(path, 'w') as f:
f.write(str(val))
except PermissionError:
os.system(f"sudo chmod a+w {path}")
try:
with open(path, 'w') as f:
f.write(str(val))
except PermissionError:
# fallback for d... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/constants.py | common/constants.py | import numpy as np
# conversions
class CV:
# Speed
MPH_TO_KPH = 1.609344
KPH_TO_MPH = 1. / MPH_TO_KPH
MS_TO_KPH = 3.6
KPH_TO_MS = 1. / MS_TO_KPH
MS_TO_MPH = MS_TO_KPH * KPH_TO_MPH
MPH_TO_MS = MPH_TO_KPH * KPH_TO_MS
MS_TO_KNOTS = 1.9438
KNOTS_TO_MS = 1. / MS_TO_KNOTS
# Angle
DEG_TO_RAD = np.pi / ... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/git.py | common/git.py | from functools import cache
import subprocess
from openpilot.common.utils import run_cmd, run_cmd_default
@cache
def get_commit(cwd: str | None = None, branch: str = "HEAD") -> str:
return run_cmd_default(["git", "rev-parse", branch], cwd=cwd)
@cache
def get_commit_date(cwd: str | None = None, commit: str = "HEAD... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/markdown.py | common/markdown.py | HTML_REPLACEMENTS = [
(r'&', r'&'),
(r'"', r'"'),
]
def parse_markdown(text: str, tab_length: int = 2) -> str:
lines = text.split("\n")
output: list[str] = []
list_level = 0
def end_outstanding_lists(level: int, end_level: int) -> int:
while level > end_level:
level -= 1
output.ap... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/gpio.py | common/gpio.py | import os
import fcntl
import ctypes
from functools import cache
def gpio_init(pin: int, output: bool) -> None:
try:
with open(f"/sys/class/gpio/gpio{pin}/direction", 'wb') as f:
f.write(b"out" if output else b"in")
except Exception as e:
print(f"Failed to set gpio {pin} direction: {e}")
def gpio_se... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/basedir.py | common/basedir.py | import os
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))
| python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/utils.py | common/utils.py | import io
import os
import tempfile
import contextlib
import subprocess
import time
import functools
from subprocess import Popen, PIPE, TimeoutExpired
import zstandard as zstd
from openpilot.common.swaglog import cloudlog
LOG_COMPRESSION_LEVEL = 10 # little benefit up to level 15. level ~17 is a small step change
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/swaglog.py | common/swaglog.py | import logging
import os
import time
import warnings
from pathlib import Path
from logging.handlers import BaseRotatingHandler
import zmq
from openpilot.common.logging_extra import SwagLogger, SwagFormatter, SwagLogFileFormatter
from openpilot.system.hardware.hw import Paths
def get_file_handler():
Path(Paths.swa... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/stat_live.py | common/stat_live.py | import numpy as np
class RunningStat:
# tracks realtime mean and standard deviation without storing any data
def __init__(self, priors=None, max_trackable=-1):
self.max_trackable = max_trackable
if priors is not None:
# initialize from history
self.M = priors[0]
self.S = priors[1]
s... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/logging_extra.py | common/logging_extra.py | import io
import os
import sys
import copy
import json
import time
import uuid
import socket
import logging
import traceback
import numpy as np
from threading import local
from collections import OrderedDict
from contextlib import contextmanager
LOG_TIMESTAMPS = "LOG_TIMESTAMPS" in os.environ
def json_handler(obj):
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/prefix.py | common/prefix.py | import os
import platform
import shutil
import uuid
from openpilot.common.params import Params
from openpilot.system.hardware import PC
from openpilot.system.hardware.hw import Paths
from openpilot.system.hardware.hw import DEFAULT_DOWNLOAD_CACHE_ROOT
class OpenpilotPrefix:
def __init__(self, prefix: str | None = ... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/__init__.py | common/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/realtime.py | common/realtime.py | """Utilities for reading real time clocks and keeping soft real time constraints."""
import gc
import os
import sys
import time
from setproctitle import getproctitle
from openpilot.common.util import MovingAverage
from openpilot.system.hardware import PC
# time step for each process
DT_CTRL = 0.01 # controlsd
DT_M... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/filter_simple.py | common/filter_simple.py | class FirstOrderFilter:
def __init__(self, x0, rc, dt, initialized=True):
self.x = x0
self.dt = dt
self.update_alpha(rc)
self.initialized = initialized
def update_alpha(self, rc):
self.alpha = self.dt / (rc + self.dt)
def update(self, x):
if self.initialized:
self.x = (1. - self.al... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/gps.py | common/gps.py | from openpilot.common.params import Params
def get_gps_location_service(params: Params) -> str:
if params.get_bool("UbloxAvailable"):
return "gpsLocationExternal"
else:
return "gpsLocation"
| python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/mock/generators.py | common/mock/generators.py | from cereal import messaging
def generate_livePose():
msg = messaging.new_message('livePose')
meas = {'x': 0.0, 'y': 0.0, 'z': 0.0, 'xStd': 0.0, 'yStd': 0.0, 'zStd': 0.0, 'valid': True}
msg.livePose.orientationNED = meas
msg.livePose.velocityDevice = meas
msg.livePose.angularVelocityDevice = meas
msg.live... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/mock/__init__.py | common/mock/__init__.py | """
Utilities for generating mock messages for testing.
example in common/tests/test_mock.py
"""
import functools
import threading
from cereal.messaging import PubMaster
from cereal.services import SERVICE_LIST
from openpilot.common.mock.generators import generate_livePose
from openpilot.common.realtime import Rateke... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/tests/test_params.py | common/tests/test_params.py | import pytest
import datetime
import os
import threading
import time
import uuid
from openpilot.common.params import Params, ParamKeyFlag, UnknownKeyName
class TestParams:
def setup_method(self):
self.params = Params()
def test_params_put_and_get(self):
self.params.put("DongleId", "cb38263377b873ee")
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/tests/test_markdown.py | common/tests/test_markdown.py | import os
from openpilot.common.basedir import BASEDIR
from openpilot.common.markdown import parse_markdown
class TestMarkdown:
def test_all_release_notes(self):
with open(os.path.join(BASEDIR, "RELEASES.md")) as f:
release_notes = f.read().split("\n\n")
assert len(release_notes) > 10
for rn... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/tests/test_simple_kalman.py | common/tests/test_simple_kalman.py | from openpilot.common.simple_kalman import KF1D
class TestSimpleKalman:
def setup_method(self):
dt = 0.01
x0_0 = 0.0
x1_0 = 0.0
A0_0 = 1.0
A0_1 = dt
A1_0 = 0.0
A1_1 = 1.0
C0_0 = 1.0
C0_1 = 0.0
K0_0 = 0.12287673
K1_0 = 0.29666309
self.kf = KF1D(x0=[[x0_0], [x1_0]],
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/tests/__init__.py | common/tests/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/tests/test_file_helpers.py | common/tests/test_file_helpers.py | import os
from uuid import uuid4
from openpilot.common.utils import atomic_write
class TestFileHelpers:
def run_atomic_write_func(self, atomic_write_func):
path = f"/tmp/tmp{uuid4()}"
with atomic_write_func(path) as f:
f.write("test")
assert not os.path.exists(path)
with open(path) as f:
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/transformations/model.py | common/transformations/model.py | import numpy as np
from openpilot.common.transformations.orientation import rot_from_euler
from openpilot.common.transformations.camera import get_view_frame_from_calib_frame, view_frame_from_device_frame, _ar_ox_fisheye
# segnet
SEGNET_SIZE = (512, 384)
# MED model
MEDMODEL_INPUT_SIZE = (512, 256)
MEDMODEL_YUV_SIZE... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/transformations/coordinates.py | common/transformations/coordinates.py | from openpilot.common.transformations.orientation import numpy_wrap
from openpilot.common.transformations.transformations import (ecef2geodetic_single,
geodetic2ecef_single)
from openpilot.common.transformations.transformations import LocalCoord as LocalCoord_single
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/transformations/camera.py | common/transformations/camera.py | import itertools
import numpy as np
from dataclasses import dataclass
import openpilot.common.transformations.orientation as orient
## -- hardcoded hardware params --
@dataclass(frozen=True)
class CameraConfig:
width: int
height: int
focal_length: float
@property
def size(self):
return (self.width, sel... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/transformations/__init__.py | common/transformations/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/transformations/orientation.py | common/transformations/orientation.py | import numpy as np
from collections.abc import Callable
from openpilot.common.transformations.transformations import (ecef_euler_from_ned_single,
euler2quat_single,
euler2rot_single,
... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/transformations/tests/test_coordinates.py | common/transformations/tests/test_coordinates.py | import numpy as np
import openpilot.common.transformations.coordinates as coord
geodetic_positions = np.array([[37.7610403, -122.4778699, 115],
[27.4840915, -68.5867592, 2380],
[32.4916858, -113.652821, -6],
[15.1392514... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/transformations/tests/__init__.py | common/transformations/tests/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/common/transformations/tests/test_orientation.py | common/transformations/tests/test_orientation.py | import numpy as np
from openpilot.common.transformations.orientation import euler2quat, quat2euler, euler2rot, rot2euler, \
rot2quat, quat2rot, \
ned_euler_from_ecef
eulers = np.array([[ 1.46520501, 2.78688383, 2.92780854]... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/__init__.py | selfdrive/__init__.py | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false | |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/selfdrived/selfdrived.py | selfdrive/selfdrived/selfdrived.py | #!/usr/bin/env python3
import os
import time
import threading
import cereal.messaging as messaging
from cereal import car, log
from msgq.visionipc import VisionIpcClient, VisionStreamType
from openpilot.common.params import Params
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper, ... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/selfdrived/state.py | selfdrive/selfdrived/state.py | from cereal import log
from openpilot.selfdrive.selfdrived.events import Events, ET
from openpilot.common.realtime import DT_CTRL
State = log.SelfdriveState.OpenpilotState
SOFT_DISABLE_TIME = 3 # seconds
ACTIVE_STATES = (State.enabled, State.softDisabling, State.overriding)
ENABLED_STATES = (State.preEnabled, *ACTIV... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | false |
commaai/openpilot | https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/selfdrived/events.py | selfdrive/selfdrived/events.py | #!/usr/bin/env python3
import bisect
import math
import os
from enum import IntEnum
from collections.abc import Callable
from cereal import log, car
import cereal.messaging as messaging
from openpilot.common.constants import CV
from openpilot.common.git import get_short_branch
from openpilot.common.realtime import DT_... | python | MIT | adbf68f77120b4568de68c37b8bed4ed433e01fe | 2026-01-04T14:38:40.093933Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.