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
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/dict_helpers.py
common/dict_helpers.py
# remove all keys that end in DEPRECATED def strip_deprecated_keys(d): for k in list(d.keys()): if isinstance(k, str): if k.endswith('DEPRECATED'): d.pop(k) elif isinstance(d[k], dict): strip_deprecated_keys(d[k]) return d
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/basedir.py
common/basedir.py
import os BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/prefix.py
common/prefix.py
import os 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, clean_dirs_on_exi...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/retry.py
common/retry.py
import time import functools from openpilot.common.swaglog import cloudlog def retry(attempts=3, delay=1.0, ignore_failure=False): def decorator(func): @functools.wraps(func) def wrapper(*args, **kwargs): for _ in range(attempts): try: return func(*args, **kwargs) except Exc...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/__init__.py
common/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/conversions.py
common/conversions.py
import numpy as np class Conversions: # 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 / 180. ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/ffi_wrapper.py
common/ffi_wrapper.py
import platform def suffix(): if platform.system() == "Darwin": return ".dylib" else: return ".so"
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/filter_simple.py
common/filter_simple.py
import numpy as np from collections import deque class FirstOrderFilter: # first order filter 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) d...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/mock/generators.py
common/mock/generators.py
from cereal import messaging LOCATION1 = (32.7174, -117.16277) LOCATION2 = (32.7558, -117.2037) LLK_DECIMATION = 10 RENDER_FRAMES = 15 DEFAULT_ITERATIONS = RENDER_FRAMES * LLK_DECIMATION def generate_liveLocationKalman(location=LOCATION1): msg = messaging.new_message('liveLocationKalman') msg.liveLocationKalma...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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, generate_liveLocationKalman from openpilot....
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/tests/test_params.py
common/tests/test_params.py
import pytest import os import threading import time import uuid from openpilot.common.params import Params, ParamKeyType, UnknownKeyName class TestParams: def setup_method(self): self.params = Params() def test_params_put_and_get(self): self.params.put("DongleId", "cb38263377b873ee") assert self.par...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/tests/__init__.py
common/tests/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/tests/test_file_helpers.py
common/tests/test_file_helpers.py
import os from uuid import uuid4 from openpilot.common.file_helpers import atomic_write_in_dir 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...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/transformations/__init__.py
common/transformations/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/common/transformations/tests/__init__.py
common/transformations/tests/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/carrot_set.py
selfdrive/carrot_set.py
#!/usr/bin/env python3 import sys from openpilot.common.params import Params def set_params(): key = sys.argv[1] value = sys.argv[2] print(f"Setting {key} to {value}") print(f"Current value: {Params().get(key)}") Params().put(key, value) print(f"New value: {Params().get(key)}") if __name__ == "__main__": ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/apilot.py
selfdrive/apilot.py
#!/usr/bin/env python3 import os import json folder_path = "/data/params/d" output_file = "/data/backup_params.json" result = [] for filename in os.listdir(folder_path): file_path = os.path.join(folder_path, filename) if os.path.isfile(file_path) and os.path.getsize(file_path) < 16: with open(file_pa...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/__init__.py
selfdrive/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/carrot_setting.py
selfdrive/carrot_setting.py
#!/usr/bin/env python3 import os import json from openpilot.common.params import Params folder_path = Params().get_param_path() #"/data/params/d" #output_file = "/data/backup_params.json" output_file = os.path.join(folder_path, "backup_params.json") result = [] for filename in os.listdir(folder_path): file_path ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/frogpilot/fleetmanager/helpers.py
selfdrive/frogpilot/fleetmanager/helpers.py
# otisserv - Copyright (c) 2019-, Rick Lan, dragonpilot community, and a number of other of contributors. # Fleet Manager - [actuallylemoncurd](https://github.com/actuallylemoncurd), [AlexandreSato](https://github.com/alexandreSato), # [ntegan1](https://github.com/ntegan1), [royjr](https://github.com/royjr), and [sunny...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/frogpilot/fleetmanager/fleet_manager.py
selfdrive/frogpilot/fleetmanager/fleet_manager.py
#!/usr/bin/env python3 # otisserv - Copyright (c) 2019-, Rick Lan, dragonpilot community, and a number of other of contributors. # Fleet Manager - [actuallylemoncurd](https://github.com/actuallylemoncurd), [AlexandreSato](https://github.com/alexandreSato), # [ntegan1](https://github.com/ntegan1), [royjr](https://github...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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 opendbc.safety import ALTERNATIVE_EXPERIENCE from openpilot.common.params import Params from openpilot.common.realtime impo...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/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.conversions import Conversions as CV from openpilot.common.git import get_short_branch from openpilot.common.pa...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
true
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/selfdrived/alertmanager.py
selfdrive/selfdrived/alertmanager.py
import copy import os import json from collections import defaultdict from dataclasses import dataclass from openpilot.common.basedir import BASEDIR from openpilot.common.params import Params from openpilot.selfdrive.selfdrived.events import Alert, EmptyAlert with open(os.path.join(BASEDIR, "selfdrive/selfdrived/ale...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/selfdrived/tests/test_alertmanager.py
selfdrive/selfdrived/tests/test_alertmanager.py
import random from openpilot.selfdrive.selfdrived.events import Alert, EmptyAlert, EVENTS from openpilot.selfdrive.selfdrived.alertmanager import AlertManager class TestAlertManager: def test_duration(self): """ Enforce that an alert lasts for max(alert duration, duration the alert is added) """ ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/selfdrived/tests/test_state_machine.py
selfdrive/selfdrived/tests/test_state_machine.py
from cereal import log from openpilot.common.realtime import DT_CTRL from openpilot.selfdrive.selfdrived.state import StateMachine, SOFT_DISABLE_TIME from openpilot.selfdrive.selfdrived.events import Events, ET, EVENTS, NormalPermanentAlert State = log.SelfdriveState.OpenpilotState # The event types that maintain the...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/selfdrived/tests/test_alerts.py
selfdrive/selfdrived/tests/test_alerts.py
import copy import json import os import random from PIL import Image, ImageDraw, ImageFont from cereal import log, car from cereal.messaging import SubMaster from openpilot.common.basedir import BASEDIR from openpilot.common.params import Params from openpilot.selfdrive.selfdrived.events import Alert, EVENTS, ET from...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/pandad/pandad.py
selfdrive/pandad/pandad.py
#!/usr/bin/env python3 # simple pandad wrapper that updates the panda first import os import usb1 import time import signal import subprocess from panda import Panda, PandaDFU, PandaProtocolMismatch, FW_PATH from openpilot.common.basedir import BASEDIR from openpilot.common.params import Params from openpilot.system.h...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/pandad/__init__.py
selfdrive/pandad/__init__.py
# Cython, now uses scons to build from openpilot.selfdrive.pandad.pandad_api_impl import can_list_to_can_capnp, can_capnp_to_list assert can_list_to_can_capnp assert can_capnp_to_list
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/pandad/tests/test_pandad_spi.py
selfdrive/pandad/tests/test_pandad_spi.py
import os import time import numpy as np import pytest import random import cereal.messaging as messaging from cereal.services import SERVICE_LIST from openpilot.system.hardware import HARDWARE from openpilot.selfdrive.test.helpers import with_processes from openpilot.selfdrive.pandad.tests.test_pandad_loopback import...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/pandad/tests/test_pandad.py
selfdrive/pandad/tests/test_pandad.py
import os import pytest import time import cereal.messaging as messaging from cereal import log from openpilot.common.gpio import gpio_set, gpio_init from panda import Panda, PandaDFU, PandaProtocolMismatch from openpilot.common.retry import retry from openpilot.system.manager.process_config import managed_processes f...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/pandad/tests/__init__.py
selfdrive/pandad/tests/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/pandad/tests/test_pandad_loopback.py
selfdrive/pandad/tests/test_pandad_loopback.py
import os import copy import random import time import pytest from collections import defaultdict from pprint import pprint import cereal.messaging as messaging from cereal import car, log from opendbc.car.can_definitions import CanData from openpilot.common.retry import retry from openpilot.common.params import Param...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/constants.py
selfdrive/modeld/constants.py
import numpy as np def index_function(idx, max_val=192, max_idx=32): return (max_val) * ((idx/max_idx)**2) class ModelConstants: # time and distance indices IDX_N = 33 T_IDXS = [index_function(idx, max_val=10.0) for idx in range(IDX_N)] X_IDXS = [index_function(idx, max_val=192.0) for idx in range(IDX_N)] ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/modeld.py
selfdrive/modeld/modeld.py
#!/usr/bin/env python3 import os from openpilot.system.hardware import TICI os.environ['DEV'] = 'QCOM' if TICI else 'LLVM' USBGPU = "USBGPU" in os.environ if USBGPU: os.environ['DEV'] = 'AMD' os.environ['AMD_IFACE'] = 'USB' from tinygrad.tensor import Tensor from tinygrad.dtype import dtypes import time import pick...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/parse_model_outputs.py
selfdrive/modeld/parse_model_outputs.py
import numpy as np from openpilot.selfdrive.modeld.constants import ModelConstants def safe_exp(x, out=None): # -11 is around 10**14, more causes float16 overflow return np.exp(np.clip(x, -np.inf, 11), out=out) def sigmoid(x): return 1. / (1. + safe_exp(-x)) def softmax(x, axis=-1): x -= np.max(x, axis=axis,...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/dmonitoringmodeld.py
selfdrive/modeld/dmonitoringmodeld.py
#!/usr/bin/env python3 import os from openpilot.system.hardware import TICI os.environ['DEV'] = 'QCOM' if TICI else 'CPU' from tinygrad.tensor import Tensor from tinygrad.dtype import dtypes import time import pickle import ctypes import numpy as np from pathlib import Path from setproctitle import setproctitle from c...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/fill_model_msg.py
selfdrive/modeld/fill_model_msg.py
import os import capnp import numpy as np import math from cereal import log from openpilot.selfdrive.modeld.constants import ModelConstants, Plan, Meta SEND_RAW_PRED = os.getenv('SEND_RAW_PRED') ConfidenceClass = log.ModelDataV2.ConfidenceClass class PublishState: def __init__(self): self.disengage_buffer = ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/get_model_metadata.py
selfdrive/modeld/get_model_metadata.py
#!/usr/bin/env python3 import sys import pathlib import onnx import codecs import pickle from typing import Any def get_name_and_shape(value_info:onnx.ValueInfoProto) -> tuple[str, tuple[int,...]]: shape = tuple([int(dim.dim_value) for dim in value_info.type.tensor_type.shape.dim]) name = value_info.name return ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/__init__.py
selfdrive/modeld/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/tests/test_modeld.py
selfdrive/modeld/tests/test_modeld.py
import numpy as np import random import cereal.messaging as messaging from msgq.visionipc import VisionIpcServer, VisionStreamType from opendbc.car.car_helpers import get_demo_car_params from openpilot.common.params import Params from openpilot.common.transformations.camera import DEVICE_CAMERAS from openpilot.common....
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/tests/__init__.py
selfdrive/modeld/tests/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/models/__init__.py
selfdrive/modeld/models/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/modeld/runners/tinygrad_helpers.py
selfdrive/modeld/runners/tinygrad_helpers.py
from tinygrad.tensor import Tensor from tinygrad.helpers import to_mv def qcom_tensor_from_opencl_address(opencl_address, shape, dtype): cl_buf_desc_ptr = to_mv(opencl_address, 8).cast('Q')[0] rawbuf_ptr = to_mv(cl_buf_desc_ptr, 0x100).cast('Q')[20] # offset 0xA0 is a raw gpu pointer. return Tensor.from_blob(ra...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/fuzzy_generation.py
selfdrive/test/fuzzy_generation.py
import capnp import hypothesis.strategies as st from typing import Any from collections.abc import Callable from functools import cache from cereal import log DrawType = Callable[[st.SearchStrategy], Any] class FuzzyGenerator: def __init__(self, draw: DrawType, real_floats: bool): self.draw = draw self.na...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/update_ci_routes.py
selfdrive/test/update_ci_routes.py
#!/usr/bin/env python3 import os import re import subprocess import sys from collections.abc import Iterable from tqdm import tqdm from opendbc.car.tests.routes import routes as test_car_models_routes from openpilot.selfdrive.test.process_replay.test_processes import source_segments as replay_segments from openpilot....
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/test_updated.py
selfdrive/test/test_updated.py
import datetime import os import pytest import time import tempfile import shutil import signal import subprocess import random from openpilot.common.basedir import BASEDIR from openpilot.common.params import Params @pytest.mark.tici class TestUpdated: def setup_method(self): self.updated_proc = None sel...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/helpers.py
selfdrive/test/helpers.py
import contextlib import http.server import os import threading import time import pytest from functools import wraps import cereal.messaging as messaging from openpilot.common.params import Params from openpilot.system.manager.process_config import managed_processes from openpilot.system.version import training_vers...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/test_onroad.py
selfdrive/test/test_onroad.py
import math import json import os import pytest import shutil import subprocess import time import numpy as np from collections import Counter, defaultdict from pathlib import Path from tabulate import tabulate from cereal import log import cereal.messaging as messaging from cereal.services import SERVICE_LIST from op...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/cpp_harness.py
selfdrive/test/cpp_harness.py
#!/usr/bin/env python3 import subprocess import sys from openpilot.common.prefix import OpenpilotPrefix with OpenpilotPrefix(): ret = subprocess.call(sys.argv[1:]) sys.exit(ret)
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/__init__.py
selfdrive/test/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/capture.py
selfdrive/test/process_replay/capture.py
import os import sys from typing import no_type_check class FdRedirect: def __init__(self, file_prefix: str, fd: int): fname = os.path.join("/tmp", f"{file_prefix}.{fd}") if os.path.exists(fname): os.unlink(fname) self.dest_fd = os.open(fname, os.O_WRONLY | os.O_CREAT) self.dest_fname = fname ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/regen_all.py
selfdrive/test/process_replay/regen_all.py
#!/usr/bin/env python3 import argparse import concurrent.futures import os import random import traceback from tqdm import tqdm from openpilot.common.prefix import OpenpilotPrefix from openpilot.selfdrive.test.process_replay.regen import regen_and_save from openpilot.selfdrive.test.process_replay.test_processes import...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/test_processes.py
selfdrive/test/process_replay/test_processes.py
#!/usr/bin/env python3 import argparse import concurrent.futures import os import sys from collections import defaultdict from tqdm import tqdm from typing import Any from opendbc.car.car_helpers import interface_names from openpilot.common.git import get_commit from openpilot.tools.lib.openpilotci import get_url, upl...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/regen.py
selfdrive/test/process_replay/regen.py
#!/usr/bin/env python3 import os import argparse import time import capnp import numpy as np from typing import Any from collections.abc import Iterable from openpilot.selfdrive.test.process_replay.process_replay import CONFIGS, FAKEDATA, ProcessConfig, replay_process, get_process_config, \ ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/model_replay.py
selfdrive/test/process_replay/model_replay.py
#!/usr/bin/env python3 import os import sys from collections import defaultdict from typing import Any import tempfile from itertools import zip_longest import matplotlib.pyplot as plt import numpy as np from tabulate import tabulate from openpilot.common.git import get_commit from openpilot.system.hardware import PC...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/migration.py
selfdrive/test/process_replay/migration.py
from collections import defaultdict from collections.abc import Callable import capnp import functools import traceback from cereal import messaging, car, log from opendbc.car.fingerprints import MIGRATION from opendbc.car.toyota.values import EPS_SCALE, ToyotaSafetyFlags from opendbc.car.ford.values import CAR as FOR...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/vision_meta.py
selfdrive/test/process_replay/vision_meta.py
from collections import namedtuple from msgq.visionipc import VisionStreamType from openpilot.common.realtime import DT_MDL, DT_DMON from openpilot.common.transformations.camera import DEVICE_CAMERAS VideoStreamMeta = namedtuple("VideoStreamMeta", ["camera_state", "encode_index", "stream", "dt", "frame_sizes"]) ROAD_C...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/test_regen.py
selfdrive/test/process_replay/test_regen.py
from parameterized import parameterized from openpilot.selfdrive.test.process_replay.regen import regen_segment, DummyFrameReader from openpilot.selfdrive.test.process_replay.process_replay import check_openpilot_enabled from openpilot.tools.lib.openpilotci import get_url from openpilot.tools.lib.logreader import LogR...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/test_fuzzy.py
selfdrive/test/process_replay/test_fuzzy.py
import copy import os from hypothesis import given, HealthCheck, Phase, settings import hypothesis.strategies as st from parameterized import parameterized from cereal import log from opendbc.car.toyota.values import CAR as TOYOTA from openpilot.selfdrive.test.fuzzy_generation import FuzzyGenerator import openpilot.se...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/__init__.py
selfdrive/test/process_replay/__init__.py
from openpilot.selfdrive.test.process_replay.process_replay import CONFIGS, get_process_config, get_custom_params_from_lr, \ replay_process, replay_process_with_name # noqa: F401
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/process_replay.py
selfdrive/test/process_replay/process_replay.py
#!/usr/bin/env python3 import os import time import copy import json import heapq import signal from collections import Counter, OrderedDict from dataclasses import dataclass, field from typing import Any from collections.abc import Callable, Iterable from tqdm import tqdm import capnp from openpilot.system.hardware.hw...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/process_replay/compare_logs.py
selfdrive/test/process_replay/compare_logs.py
#!/usr/bin/env python3 import sys import math import capnp import numbers import dictdiffer from collections import Counter from openpilot.tools.lib.logreader import LogReader EPSILON = sys.float_info.epsilon def remove_ignored_fields(msg, ignore): msg = msg.as_builder() for key in ignore: attr = msg ke...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/longitudinal_maneuvers/test_longitudinal.py
selfdrive/test/longitudinal_maneuvers/test_longitudinal.py
import itertools from parameterized import parameterized_class from openpilot.selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import STOP_DISTANCE from openpilot.selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver # TODO: make new FCW tests def create_maneuvers(kwargs): maneuvers = [ Maneuver( ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/longitudinal_maneuvers/maneuver.py
selfdrive/test/longitudinal_maneuvers/maneuver.py
import numpy as np from openpilot.selfdrive.test.longitudinal_maneuvers.plant import Plant class Maneuver: def __init__(self, title, duration, **kwargs): # Was tempted to make a builder class self.distance_lead = kwargs.get("initial_distance_lead", 200.0) self.speed = kwargs.get("initial_speed", 0.0) ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/longitudinal_maneuvers/__init__.py
selfdrive/test/longitudinal_maneuvers/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/test/longitudinal_maneuvers/plant.py
selfdrive/test/longitudinal_maneuvers/plant.py
#!/usr/bin/env python3 import time import numpy as np from cereal import log import cereal.messaging as messaging from openpilot.common.realtime import Ratekeeper, DT_MDL from openpilot.selfdrive.controls.lib.longcontrol import LongCtrlState from openpilot.selfdrive.modeld.constants import ModelConstants from openpilo...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/navd/set_destination.py
selfdrive/navd/set_destination.py
#!/usr/bin/env python3 import json import sys from openpilot.common.params import Params if __name__ == "__main__": params = Params() # set from google maps url if len(sys.argv) > 1: coords = sys.argv[1].split("/@")[-1].split("/")[0].split(",") dest = { "latitude": float(coords[0]), "longit...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/navd/map_renderer.py
selfdrive/navd/map_renderer.py
#!/usr/bin/env python3 # You might need to uninstall the PyQt5 pip package to avoid conflicts import os import time import numpy as np import polyline from cffi import FFI from openpilot.common.ffi_wrapper import suffix from openpilot.common.basedir import BASEDIR HEIGHT = WIDTH = SIZE = 256 METERS_PER_PIXEL = 2 d...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/navd/helpers.py
selfdrive/navd/helpers.py
from __future__ import annotations import json import math from typing import Any, Dict, List, Optional, Tuple, Union, cast from openpilot.common.conversions import Conversions import numpy as np from openpilot.common.params import Params DIRECTIONS = ('left', 'right', 'straight') MODIFIABLE_DIRECTIONS = ('left', 'r...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/navd/navd.py
selfdrive/navd/navd.py
#!/usr/bin/env python3 import json import math import os import threading import importlib import requests import numpy as np import cereal.messaging as messaging from cereal import log from openpilot.common.api import Api from openpilot.common.params import Params from openpilot.common.realtime import Ratekeeper fr...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/navd/__init__.py
selfdrive/navd/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/radard.py
selfdrive/controls/radard.py
#!/usr/bin/env python3 import math import numpy as np from collections import deque from typing import Any import heapq import copy import capnp from cereal import messaging, log, car from openpilot.common.filter_simple import FirstOrderFilter from openpilot.common.params import Params from openpilot.common.realtime i...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/controlsd.py
selfdrive/controls/controlsd.py
#!/usr/bin/env python3 import math from typing import SupportsFloat from cereal import car, log import cereal.messaging as messaging from openpilot.common.conversions import Conversions as CV from openpilot.common.params import Params from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper ...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/__init__.py
selfdrive/controls/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/plannerd.py
selfdrive/controls/plannerd.py
#!/usr/bin/env python3 from cereal import car from openpilot.common.params import Params from openpilot.common.realtime import Priority, config_realtime_process from openpilot.common.swaglog import cloudlog from openpilot.selfdrive.controls.lib.ldw import LaneDepartureWarning from openpilot.selfdrive.controls.lib.longi...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/beep.py
selfdrive/controls/beep.py
#!/usr/bin/env python3 import subprocess import time from cereal import car, messaging from openpilot.common.realtime import Ratekeeper import threading AudibleAlert = car.CarControl.HUDControl.AudibleAlert class Beepd: def __init__(self): self.current_alert = AudibleAlert.none self.enable_gpio() self.s...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/tests/test_following_distance.py
selfdrive/controls/tests/test_following_distance.py
import pytest import itertools from parameterized import parameterized_class from cereal import log from openpilot.selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import desired_follow_distance, get_T_FOLLOW from openpilot.selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver def run_following_distanc...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/tests/test_longcontrol.py
selfdrive/controls/tests/test_longcontrol.py
from cereal import car from openpilot.selfdrive.controls.lib.longcontrol import LongCtrlState, long_control_state_trans class TestLongControlStateTransition: def test_stay_stopped(self): CP = car.CarParams.new_message() active = True current_state = LongCtrlState.stopping next_state = long_contro...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/tests/__init__.py
selfdrive/controls/tests/__init__.py
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/tests/test_lateral_mpc.py
selfdrive/controls/tests/test_lateral_mpc.py
import pytest import numpy as np from openpilot.selfdrive.controls.lib.lateral_mpc_lib.lat_mpc import LateralMpc from openpilot.selfdrive.controls.lib.drive_helpers import CAR_ROTATION_RADIUS from openpilot.selfdrive.controls.lib.lateral_mpc_lib.lat_mpc import N as LAT_MPC_N def run_mpc(lat_mpc=None, v_ref=30., x_ini...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/tests/test_leads.py
selfdrive/controls/tests/test_leads.py
import cereal.messaging as messaging from opendbc.car.toyota.values import CAR as TOYOTA from openpilot.selfdrive.test.process_replay import replay_process_with_name class TestLeads: def test_radar_fault(self): # if there's no radar-related can traffic, radard should either not respond or respond with an error...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false
ajouatom/openpilot
https://github.com/ajouatom/openpilot/blob/b0eab6e8de2d57522b657426fbb794f2d736c75c/selfdrive/controls/lib/longitudinal_planner.py
selfdrive/controls/lib/longitudinal_planner.py
#!/usr/bin/env python3 import math import numpy as np import cereal.messaging as messaging from opendbc.car.interfaces import ACCEL_MIN, ACCEL_MAX from openpilot.common.conversions import Conversions as CV from openpilot.common.filter_simple import FirstOrderFilter from openpilot.common.realtime import DT_MDL from ope...
python
MIT
b0eab6e8de2d57522b657426fbb794f2d736c75c
2026-01-05T07:04:53.428285Z
false