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/selfdrive/selfdrived/helpers.py
selfdrive/selfdrived/helpers.py
import math from enum import StrEnum, auto from cereal import car, messaging from openpilot.common.realtime import DT_CTRL from openpilot.selfdrive.locationd.helpers import Pose from opendbc.car import ACCELERATION_DUE_TO_GRAVITY from opendbc.car.lateral import ISO_LATERAL_ACCEL from opendbc.car.interfaces import ACCE...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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.selfdrive.test.helpers import with_processes from openpilot.selfdrive.pandad.tests.test_pandad_loopback import setup_pandad, send_random_can_messages JUNGLE...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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 from openpilot.system.manager.process_config import managed_processes from openpilot.system.hardware import HARDWARE from openpilot.sys...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/pandad/tests/__init__.py
selfdrive/pandad/tests/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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.utils import retry from openpilot.common.params import Param...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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 'CPU' 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 pickl...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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 numpy as np from pathlib import Path from cereal import messaging from cereal.messaging import ...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/modeld/fill_model_msg.py
selfdrive/modeld/fill_model_msg.py
import os import capnp import numpy as np 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 = np.zeros(Mod...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/modeld/__init__.py
selfdrive/modeld/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/modeld/models/__init__.py
selfdrive/modeld/models/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/test/__init__.py
selfdrive/test/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/test/process_replay/regen.py
selfdrive/test/process_replay/regen.py
#!/usr/bin/env python3 import os import argparse import time import capnp 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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/test/process_replay/model_replay.py
selfdrive/test/process_replay/model_replay.py
#!/usr/bin/env python3 import os import pickle 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.hard...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/test/process_replay/migration.py
selfdrive/test/process_replay/migration.py
from collections import defaultdict from collections.abc import Callable from typing import cast 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....
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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 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 LogReader from openpil...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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 heapq import signal from collections import Counter from dataclasses import dataclass, field from itertools import islice from typing import Any from collections.abc import Callable, Iterable from tqdm import tqdm import capnp from openpilot.system.hardwar...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/test/longitudinal_maneuvers/__init__.py
selfdrive/test/longitudinal_maneuvers/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/assets/sounds/make_beeps.py
selfdrive/assets/sounds/make_beeps.py
import numpy as np from scipy.io import wavfile sr = 48000 max_int16 = 2**15 - 1 def harmonic_beep(freq, duration_seconds): n_total = int(sr * duration_seconds) signal = np.sin(2 * np.pi * freq * np.arange(n_total) / sr) x = np.arange(n_total) exp_scale = np.exp(-x/5.5e3) return max_int16 * sign...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/assets/fonts/process.py
selfdrive/assets/fonts/process.py
#!/usr/bin/env python3 from pathlib import Path import json import pyray as rl FONT_DIR = Path(__file__).resolve().parent SELFDRIVE_DIR = FONT_DIR.parents[1] TRANSLATIONS_DIR = SELFDRIVE_DIR / "ui" / "translations" LANGUAGES_FILE = TRANSLATIONS_DIR / "languages.json" GLYPH_PADDING = 6 EXTRA_CHARS = "–‑✓×°§•X⚙✕◀▶✔⌫⇧␣...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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 capnp from cereal import messaging, log, car from openpilot.common.filter_simple import FirstOrderFilter from openpilot.common.params import Params from openpilot.common.realtime import DT_MDL, Priority, c...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/controlsd.py
selfdrive/controls/controlsd.py
#!/usr/bin/env python3 import math from numbers import Number from cereal import car, log import cereal.messaging as messaging from openpilot.common.constants import CV from openpilot.common.params import Params from openpilot.common.realtime import config_realtime_process, DT_CTRL, Priority, Ratekeeper from openpilot...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/__init__.py
selfdrive/controls/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/tests/test_latcontrol.py
selfdrive/controls/tests/test_latcontrol.py
from parameterized import parameterized from cereal import car, log from opendbc.car.car_helpers import interfaces from opendbc.car.honda.values import CAR as HONDA from opendbc.car.toyota.values import CAR as TOYOTA from opendbc.car.nissan.values import CAR as NISSAN from opendbc.car.gm.values import CAR as GM from o...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/tests/__init__.py
selfdrive/controls/tests/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/tests/test_torqued_lat_accel_offset.py
selfdrive/controls/tests/test_torqued_lat_accel_offset.py
import numpy as np from cereal import car, messaging from opendbc.car import ACCELERATION_DUE_TO_GRAVITY from opendbc.car import structs from opendbc.car.lateral import get_friction, FRICTION_THRESHOLD from openpilot.common.realtime import DT_MDL from openpilot.selfdrive.locationd.torqued import TorqueEstimator, MIN_BU...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/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.constants import CV from openpilot.common.filter_simple import FirstOrderFilter from openpilot.common.realtime import DT_MDL from openpilot.selfdrive....
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/ldw.py
selfdrive/controls/lib/ldw.py
from cereal import log from openpilot.common.realtime import DT_CTRL from openpilot.common.constants import CV CAMERA_OFFSET = 0.04 LDW_MIN_SPEED = 31 * CV.MPH_TO_MS LANE_DEPARTURE_THRESHOLD = 0.1 class LaneDepartureWarning: def __init__(self): self.left = False self.right = False self.last_blinker_fra...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/latcontrol_pid.py
selfdrive/controls/lib/latcontrol_pid.py
import math from cereal import log from openpilot.selfdrive.controls.lib.latcontrol import LatControl from openpilot.common.pid import PIDController class LatControlPID(LatControl): def __init__(self, CP, CI, dt): super().__init__(CP, CI, dt) self.pid = PIDController((CP.lateralTuning.pid.kpBP, CP.lateralT...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/latcontrol_angle.py
selfdrive/controls/lib/latcontrol_angle.py
import math from cereal import log from openpilot.selfdrive.controls.lib.latcontrol import LatControl # TODO This is speed dependent STEER_ANGLE_SATURATION_THRESHOLD = 2.5 # Degrees class LatControlAngle(LatControl): def __init__(self, CP, CI, dt): super().__init__(CP, CI, dt) self.sat_check_min_speed = ...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/latcontrol_torque.py
selfdrive/controls/lib/latcontrol_torque.py
import math import numpy as np from collections import deque from cereal import log from opendbc.car.lateral import FRICTION_THRESHOLD, get_friction from openpilot.common.constants import ACCELERATION_DUE_TO_GRAVITY from openpilot.common.filter_simple import FirstOrderFilter from openpilot.selfdrive.controls.lib.latco...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/__init__.py
selfdrive/controls/lib/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/desire_helper.py
selfdrive/controls/lib/desire_helper.py
from cereal import log from openpilot.common.constants import CV from openpilot.common.realtime import DT_MDL LaneChangeState = log.LaneChangeState LaneChangeDirection = log.LaneChangeDirection LANE_CHANGE_SPEED_MIN = 20 * CV.MPH_TO_MS LANE_CHANGE_TIME_MAX = 10. DESIRES = { LaneChangeDirection.none: { LaneChan...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/latcontrol.py
selfdrive/controls/lib/latcontrol.py
import numpy as np from abc import abstractmethod, ABC class LatControl(ABC): def __init__(self, CP, CI, dt): self.dt = dt self.sat_limit = CP.steerLimitTimer self.sat_time = 0. self.sat_check_min_speed = 10. # we define the steer torque scale as [-1.0...1.0] self.steer_max = 1.0 @abstra...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/drive_helpers.py
selfdrive/controls/lib/drive_helpers.py
import numpy as np from openpilot.common.constants import ACCELERATION_DUE_TO_GRAVITY from openpilot.common.realtime import DT_CTRL, DT_MDL MIN_SPEED = 1.0 CONTROL_N = 17 CAR_ROTATION_RADIUS = 0.0 # This is a turn radius smaller than most cars can achieve MAX_CURVATURE = 0.2 MAX_VEL_ERR = 5.0 # m/s # EU guidelines M...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/longcontrol.py
selfdrive/controls/lib/longcontrol.py
import numpy as np from cereal import car from openpilot.common.realtime import DT_CTRL from openpilot.selfdrive.controls.lib.drive_helpers import CONTROL_N from openpilot.common.pid import PIDController from openpilot.selfdrive.modeld.constants import ModelConstants CONTROL_N_T_IDX = ModelConstants.T_IDXS[:CONTROL_N]...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/lateral_mpc_lib/lat_mpc.py
selfdrive/controls/lib/lateral_mpc_lib/lat_mpc.py
#!/usr/bin/env python3 import os import time import numpy as np from casadi import SX, vertcat, sin, cos # WARNING: imports outside of constants will not trigger a rebuild from openpilot.selfdrive.modeld.constants import ModelConstants if __name__ == '__main__': # generating code from openpilot.third_party.acados....
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/lateral_mpc_lib/__init__.py
selfdrive/controls/lib/lateral_mpc_lib/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py
selfdrive/controls/lib/longitudinal_mpc_lib/long_mpc.py
#!/usr/bin/env python3 import os import time import numpy as np from cereal import log from opendbc.car.interfaces import ACCEL_MIN, ACCEL_MAX from openpilot.common.realtime import DT_MDL from openpilot.common.swaglog import cloudlog # WARNING: imports outside of constants will not trigger a rebuild from openpilot.self...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/controls/lib/longitudinal_mpc_lib/__init__.py
selfdrive/controls/lib/longitudinal_mpc_lib/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/car_specific.py
selfdrive/car/car_specific.py
from cereal import car, log from opendbc.car import DT_CTRL, structs from opendbc.car.car_helpers import interfaces from opendbc.car.interfaces import MAX_CTRL_SPEED from openpilot.selfdrive.selfdrived.events import Events ButtonType = structs.CarState.ButtonEvent.Type GearShifter = structs.CarState.GearShifter Event...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/cruise.py
selfdrive/car/cruise.py
import math import numpy as np from cereal import car from openpilot.common.constants import CV # WARNING: this value was determined based on the model's training distribution, # model predictions above this speed can be unpredictable # V_CRUISE's are in kph V_CRUISE_MIN = 8 V_CRUISE_MAX = 145 V_CRUISE_UNSE...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/card.py
selfdrive/car/card.py
#!/usr/bin/env python3 import os import time import threading import cereal.messaging as messaging from cereal import car, log from openpilot.common.params import Params from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper from openpilot.common.swaglog import cloudlog, ForwardingHandle...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/__init__.py
selfdrive/car/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/docs.py
selfdrive/car/docs.py
#!/usr/bin/env python3 import argparse import os from openpilot.common.basedir import BASEDIR from opendbc.car.docs import get_all_car_docs, generate_cars_md CARS_MD_OUT = os.path.join(BASEDIR, "docs", "CARS.md") CARS_MD_TEMPLATE = os.path.join(BASEDIR, "selfdrive", "car", "CARS_template.md") if __name__ == "__main_...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/tests/test_car_interfaces.py
selfdrive/car/tests/test_car_interfaces.py
import os import hypothesis.strategies as st from hypothesis import Phase, given, settings from parameterized import parameterized from cereal import car from opendbc.car import DT_CTRL from opendbc.car.structs import CarParams from opendbc.car.tests.test_car_interfaces import get_fuzzy_car_interface from opendbc.car....
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/tests/test_docs.py
selfdrive/car/tests/test_docs.py
import os from openpilot.common.basedir import BASEDIR from opendbc.car.docs import generate_cars_md, get_all_car_docs from openpilot.selfdrive.debug.dump_car_docs import dump_car_docs from openpilot.selfdrive.debug.print_docs_diff import print_car_docs_diff from openpilot.selfdrive.car.docs import CARS_MD_TEMPLATE ...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/tests/test_models.py
selfdrive/car/tests/test_models.py
import time import os import pytest import random import unittest # noqa: TID251 from collections import defaultdict, Counter import hypothesis.strategies as st from hypothesis import Phase, given, settings from parameterized import parameterized_class from opendbc.car import DT_CTRL, gen_empty_fingerprint, structs fr...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/tests/__init__.py
selfdrive/car/tests/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/car/tests/test_cruise_speed.py
selfdrive/car/tests/test_cruise_speed.py
import pytest import itertools import numpy as np from parameterized import parameterized_class from cereal import log from openpilot.selfdrive.car.cruise import VCruiseHelper, V_CRUISE_MIN, V_CRUISE_MAX, V_CRUISE_INITIAL, IMPERIAL_INCREMENT from cereal import car from openpilot.common.constants import CV from openpil...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/monitoring/dmonitoringd.py
selfdrive/monitoring/dmonitoringd.py
#!/usr/bin/env python3 import cereal.messaging as messaging from openpilot.common.params import Params from openpilot.common.realtime import config_realtime_process from openpilot.selfdrive.monitoring.helpers import DriverMonitoring def dmonitoringd_thread(): config_realtime_process([0, 1, 2, 3], 5) params = Par...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/monitoring/helpers.py
selfdrive/monitoring/helpers.py
from math import atan2 import numpy as np from cereal import car, log import cereal.messaging as messaging from openpilot.selfdrive.selfdrived.events import Events from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert from openpilot.common.realtime import DT_DMON from openpilot.common.filter_simple...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/monitoring/test_monitoring.py
selfdrive/monitoring/test_monitoring.py
import numpy as np from cereal import log from openpilot.common.realtime import DT_DMON from openpilot.selfdrive.monitoring.helpers import DriverMonitoring, DRIVER_MONITOR_SETTINGS from openpilot.system.hardware import HARDWARE EventName = log.OnroadEvent.EventName dm_settings = DRIVER_MONITOR_SETTINGS(device_type=HA...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/calibrationd.py
selfdrive/locationd/calibrationd.py
#!/usr/bin/env python3 ''' This process finds calibration values. More info on what these calibration values are can be found here https://github.com/commaai/openpilot/tree/master/common/transformations While the roll calibration is a real value that can be estimated, here we assume it's zero, and the image input into ...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/locationd.py
selfdrive/locationd/locationd.py
#!/usr/bin/env python3 import os import time import capnp import numpy as np from enum import Enum from collections import defaultdict from cereal import log, messaging from cereal.services import SERVICE_LIST from openpilot.common.transformations.orientation import rot_from_euler from openpilot.common.realtime import...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/torqued.py
selfdrive/locationd/torqued.py
#!/usr/bin/env python3 import os import numpy as np from collections import deque, defaultdict import cereal.messaging as messaging from cereal import car, log from openpilot.common.constants import ACCELERATION_DUE_TO_GRAVITY from openpilot.common.params import Params from openpilot.common.realtime import config_real...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/lagd.py
selfdrive/locationd/lagd.py
#!/usr/bin/env python3 import os import numpy as np import capnp from collections import deque from functools import partial import cereal.messaging as messaging from cereal import car, log from cereal.services import SERVICE_LIST from openpilot.common.params import Params from openpilot.common.realtime import config_...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/helpers.py
selfdrive/locationd/helpers.py
import numpy as np from typing import Any from functools import cache from cereal import log from openpilot.common.transformations.orientation import rot_from_euler, euler_from_rot @cache def fft_next_good_size(n: int) -> int: """ smallest composite of 2, 3, 5, 7, 11 that is >= n inspired by pocketfft ...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/paramsd.py
selfdrive/locationd/paramsd.py
#!/usr/bin/env python3 import os import numpy as np import capnp import cereal.messaging as messaging from cereal import car, log from openpilot.common.params import Params from openpilot.common.realtime import config_realtime_process, DT_MDL from openpilot.selfdrive.locationd.models.car_kf import CarKalman, Observati...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/__init__.py
selfdrive/locationd/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/test/test_torqued.py
selfdrive/locationd/test/test_torqued.py
from cereal import car from openpilot.selfdrive.locationd.torqued import TorqueEstimator def test_cal_percent(): est = TorqueEstimator(car.CarParams()) msg = est.get_msg() assert msg.liveTorqueParameters.calPerc == 0 for (low, high), min_pts in zip(est.filtered_points.buckets.keys(), ...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/test/test_paramsd.py
selfdrive/locationd/test/test_paramsd.py
import random import numpy as np from cereal import messaging from openpilot.selfdrive.locationd.paramsd import retrieve_initial_vehicle_params, migrate_cached_vehicle_params_if_needed from openpilot.selfdrive.locationd.models.car_kf import CarKalman from openpilot.selfdrive.locationd.test.test_locationd_scenarios imp...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/test/test_calibrationd.py
selfdrive/locationd/test/test_calibrationd.py
import random import numpy as np import cereal.messaging as messaging from cereal import log from openpilot.common.params import Params from openpilot.selfdrive.locationd.calibrationd import Calibrator, INPUTS_NEEDED, INPUTS_WANTED, BLOCK_SIZE, MIN_SPEED_FILTER, \ ...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/test/test_locationd_scenarios.py
selfdrive/locationd/test/test_locationd_scenarios.py
import numpy as np from collections import defaultdict from enum import Enum from openpilot.tools.lib.logreader import LogReader from openpilot.selfdrive.test.process_replay.migration import migrate_all from openpilot.selfdrive.test.process_replay.process_replay import replay_process_with_name # TODO find a new segme...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/test/test_lagd.py
selfdrive/locationd/test/test_lagd.py
import random import numpy as np import time import pytest from cereal import messaging, log, car from openpilot.selfdrive.locationd.lagd import LateralLagEstimator, retrieve_initial_lag, masked_normalized_cross_correlation, \ BLOCK_NUM_NEEDED, BLOCK_SIZE, MIN_OKAY_WINDOW...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/test/__init__.py
selfdrive/locationd/test/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/models/constants.py
selfdrive/locationd/models/constants.py
import os GENERATED_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), 'generated')) class ObservationKind: UNKNOWN = 0 NO_OBSERVATION = 1 GPS_NED = 2 ODOMETRIC_SPEED = 3 PHONE_GYRO = 4 GPS_VEL = 5 PSEUDORANGE_GPS = 6 PSEUDORANGE_RATE_GPS = 7 SPEED = 8 NO_ROT = 9 PHONE_ACCEL = 10 OR...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/models/car_kf.py
selfdrive/locationd/models/car_kf.py
#!/usr/bin/env python3 import math import sys from typing import Any import numpy as np from openpilot.common.constants import ACCELERATION_DUE_TO_GRAVITY from openpilot.selfdrive.locationd.models.constants import ObservationKind from openpilot.common.swaglog import cloudlog from rednose.helpers.kalmanfilter import ...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/models/pose_kf.py
selfdrive/locationd/models/pose_kf.py
#!/usr/bin/env python3 import sys import numpy as np from openpilot.selfdrive.locationd.models.constants import ObservationKind from rednose.helpers.kalmanfilter import KalmanFilter if __name__=="__main__": import sympy as sp from rednose.helpers.ekf_sym import gen_code from rednose.helpers.sympy_helpers impo...
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false
commaai/openpilot
https://github.com/commaai/openpilot/blob/adbf68f77120b4568de68c37b8bed4ed433e01fe/selfdrive/locationd/models/__init__.py
selfdrive/locationd/models/__init__.py
python
MIT
adbf68f77120b4568de68c37b8bed4ed433e01fe
2026-01-04T14:38:40.093933Z
false