diff --git a/.gitignore b/.gitignore index e1897e0ed..54f9f176b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ a.out .cache/ bin/ -# created at launch for TICI PYTHONPATH (PC uses editable installs via pyproject.toml) +# created at launch for comma hardware PYTHONPATH (PC uses editable installs via pyproject.toml) /msgq /opendbc /rednose diff --git a/Jenkinsfile b/Jenkinsfile index 341df8a8d..db18d13dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,14 +30,14 @@ export GIT_COMMIT=${env.GIT_COMMIT} export CI_ARTIFACTS_TOKEN=${env.CI_ARTIFACTS_TOKEN} export GITHUB_COMMENTS_TOKEN=${env.GITHUB_COMMENTS_TOKEN} export AZURE_TOKEN='${env.AZURE_TOKEN}' -# only use 1 thread for tici tests since most require HIL +# only use 1 thread since most require real hardware that can't be shared export PYTEST_ADDOPTS="-n0 -s" export GIT_SSH_COMMAND="ssh -i /data/gitkey" source ~/.bash_profile -if [ -f /TICI ]; then +if [ -f /AGNOS ]; then source /etc/profile rm -rf /tmp/tmp* diff --git a/SConstruct b/SConstruct index 18efb9f8a..bb5c35feb 100644 --- a/SConstruct +++ b/SConstruct @@ -10,7 +10,7 @@ import numpy as np import SCons.Errors from SCons.Defaults import _stripixes -TICI = os.path.isfile('/TICI') +COMMA_HARDWARE = os.path.isfile('/AGNOS') SCons.Warnings.warningAsException(True) @@ -24,7 +24,7 @@ release = not os.path.exists(File('#.gitattributes').abspath) # file absent on r AddOption('--minimal', action='store_false', dest='extras', - default=(not TICI and not release), + default=(not COMMA_HARDWARE and not release), help='the minimum build to run openpilot. no tests, tools, etc.') submodule_python_paths = [ @@ -46,13 +46,13 @@ if external_pythonpath := os.environ.get("PYTHONPATH"): arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() if platform.system() == "Darwin": arch = "Darwin" -elif arch == "aarch64" and TICI: - arch = "larch64" +elif arch == "aarch64" and COMMA_HARDWARE: + arch = "comma_arm64" assert arch in [ - "larch64", # linux tici arm64 - "aarch64", # linux pc arm64 - "x86_64", # linux pc x64 - "Darwin", # macOS arm64 (x86 not supported) + "comma_arm64", # linux comma hardware (AGNOS) arm64 + "aarch64", # linux pc arm64 + "x86_64", # linux pc x64 + "Darwin", # macOS arm64 (x86 not supported) ] pkg_names = ['acados', 'capnproto', 'ffmpeg', 'json11', 'ncurses', 'zeromq', 'zstd'] @@ -61,7 +61,7 @@ acados = pkgs[pkg_names.index('acados')] ffmpeg = pkgs[pkg_names.index('ffmpeg')] # Shared package ships .so/.dylib; older device venvs still have static .a only. # Keep static link deps (x264/z/va/drm) when the installed package is static so -# TICI CI works without upgrading the device venv yet. +# COMMA_HARDWARE CI works without upgrading the device venv yet. # TODO: drop the static fallback once device venvs have comma-deps-ffmpeg>=7.1.0.post94 _ffmpeg_lib_names = os.listdir(ffmpeg.LIB_DIR) if os.path.isdir(ffmpeg.LIB_DIR) else [] ffmpeg_shared = any( @@ -133,7 +133,7 @@ env = Environment( "-O2", "-Wunused", "-Werror", - "-Wshadow" if arch in ("Darwin", "larch64") else "-Wshadow=local", + "-Wshadow" if arch in ("Darwin", "comma_arm64") else "-Wshadow=local", "-Wno-unknown-warning-option", "-Wno-inconsistent-missing-override", "-Wno-c99-designator", @@ -172,17 +172,17 @@ if arch == "Darwin": env["RPATHPREFIX"] = "-Wl,-rpath," env["RPATHSUFFIX"] = "" env["_RPATH"] = "${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}" -if arch != "larch64": +if arch != "comma_arm64": env['_LIBFLAGS'] = _libflags # Arch-specific flags and paths -if arch == "larch64": +if arch == "comma_arm64": env["CC"] = "clang" env["CXX"] = "clang++" env.Append(LIBPATH=[ "/usr/lib/aarch64-linux-gnu", ]) - arch_flags = ["-D__TICI__", "-mcpu=cortex-a57"] + arch_flags = ["-D__COMMA_HARDWARE__", "-mcpu=cortex-a57"] env.Append(CCFLAGS=arch_flags) env.Append(CXXFLAGS=arch_flags) elif arch == "Darwin": @@ -234,7 +234,7 @@ Export('envCython', 'np_version') Export('env', 'arch', 'acados', 'ffmpeg_libs') # Setup cache dir -cache_dir = '/data/scons_cache' if arch == "larch64" else '/tmp/scons_cache' +cache_dir = '/data/scons_cache' if arch == "comma_arm64" else '/tmp/scons_cache' cache_size_limit = 4e9 if "CI" in os.environ else 2e9 CacheDir(cache_dir) Clean(["."], cache_dir) @@ -280,7 +280,7 @@ SConscript([ 'openpilot/system/loggerd/SConscript', ]) -if arch == "larch64": +if arch == "comma_arm64": SConscript(['openpilot/system/camerad/SConscript']) # Build selfdrive @@ -293,7 +293,7 @@ SConscript([ ]) # Build desktop-only tools -if GetOption('extras') and arch != "larch64": +if GetOption('extras') and arch != "comma_arm64": SConscript([ 'openpilot/tools/replay/SConscript', 'openpilot/tools/cabana/SConscript', diff --git a/openpilot/cereal/log.capnp b/openpilot/cereal/log.capnp index fdb025d83..da700b58a 100644 --- a/openpilot/cereal/log.capnp +++ b/openpilot/cereal/log.capnp @@ -180,13 +180,13 @@ struct InitData { enum DeviceType { unknown @0; - neo @1; + neo @1; # NEO, EON, & comma two chffrAndroid @2; chffrIos @3; - tici @4; + tici @4; # comma three pc @5; - tizi @6; - mici @7; + tizi @6; # comma 3X + mici @7; # comma four } struct PandaInfo { diff --git a/openpilot/common/esim/lpa.py b/openpilot/common/esim/lpa.py index 545f5306d..fb128c32e 100644 --- a/openpilot/common/esim/lpa.py +++ b/openpilot/common/esim/lpa.py @@ -682,7 +682,7 @@ def download_profile(client: AtClient, activation_code: str) -> str: session.close() -class TiciLPA(LPABase): +class LPA(LPABase): def __init__(self): if hasattr(self, '_client'): return diff --git a/openpilot/common/hardware/__init__.py b/openpilot/common/hardware/__init__.py index 99e619b33..58e18736f 100644 --- a/openpilot/common/hardware/__init__.py +++ b/openpilot/common/hardware/__init__.py @@ -2,15 +2,15 @@ import os from typing import cast from openpilot.common.hardware.base import HardwareBase -from openpilot.common.hardware.comma.hardware import Tici -from openpilot.common.hardware.pc.hardware import Pc +from openpilot.common.hardware.comma.hardware import HardwareComma +from openpilot.common.hardware.pc.hardware import HardwarePc -TICI = os.path.isfile('/TICI') AGNOS = os.path.isfile('/AGNOS') -PC = not TICI +COMMA_HARDWARE = AGNOS +PC = not COMMA_HARDWARE -if TICI: - HARDWARE = cast(HardwareBase, Tici()) +if COMMA_HARDWARE: + HARDWARE = cast(HardwareBase, HardwareComma()) else: - HARDWARE = cast(HardwareBase, Pc()) + HARDWARE = cast(HardwareBase, HardwarePc()) diff --git a/openpilot/common/hardware/comma/hardware.h b/openpilot/common/hardware/comma/hardware.h index a1a8090c3..6292183d9 100644 --- a/openpilot/common/hardware/comma/hardware.h +++ b/openpilot/common/hardware/comma/hardware.h @@ -9,7 +9,7 @@ #include "common/util.h" #include "common/hardware/base.h" -class HardwareTici : public HardwareNone { +class HardwareComma : public HardwareNone { public: static std::string get_name() { static const std::string name = []() { diff --git a/openpilot/common/hardware/comma/hardware.py b/openpilot/common/hardware/comma/hardware.py index 3bd1538a3..dfbf1e3f1 100644 --- a/openpilot/common/hardware/comma/hardware.py +++ b/openpilot/common/hardware/comma/hardware.py @@ -12,7 +12,7 @@ from openpilot.common.utils import sudo_read, sudo_write from openpilot.common.gpio import gpio_set, gpio_init, get_irqs_for_action from openpilot.common.esim.base import LPABase from openpilot.common.hardware.base import HardwareBase, ThermalConfig, ThermalZone -from openpilot.common.esim.lpa import TiciLPA +from openpilot.common.esim.lpa import LPA from openpilot.common.hardware.comma.pins import GPIO from openpilot.common.hardware.comma.amplifier import Amplifier @@ -58,7 +58,17 @@ def get_default_route_iface(): routes = [(int(route[6]), route[0]) for line in f.readlines()[1:] if (route := line.split())[1] == "00000000" and int(route[3], 16) & 0x1] return min(routes)[1] if routes else None -class Tici(HardwareBase): +class HardwareComma(HardwareBase): + """ + This platform covers the Snapdragon 845-based comma devices: + - tici = comma three + - tizi = comma 3X + - mici = comma four + + We strictly use only the device codenames in this codebase for + consistency, though all user-facing UI should use the product names. + """ + @cached_property def amplifier(self): if self.get_device_type() == "mici": @@ -145,7 +155,7 @@ class Tici(HardwareBase): } def get_sim_lpa(self) -> LPABase: - return TiciLPA() + return LPA() def get_imei(self): return self.get_modem_state().get('imei', '') @@ -413,7 +423,7 @@ class Tici(HardwareBase): return True if __name__ == "__main__": - t = Tici() + t = HardwareComma() t.initialize_hardware() t.set_power_save(False) print(t.get_sim_info()) diff --git a/openpilot/common/hardware/comma/tests/test_amplifier.py b/openpilot/common/hardware/comma/tests/test_amplifier.py index d26e2e051..1752bf6e5 100755 --- a/openpilot/common/hardware/comma/tests/test_amplifier.py +++ b/openpilot/common/hardware/comma/tests/test_amplifier.py @@ -11,7 +11,7 @@ from openpilot.common.hardware.comma.amplifier import Amplifier class TestAmplifier(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True def setup_method(self): # clear dmesg diff --git a/openpilot/common/hardware/hw.h b/openpilot/common/hardware/hw.h index d5711de24..83dc452da 100644 --- a/openpilot/common/hardware/hw.h +++ b/openpilot/common/hardware/hw.h @@ -5,9 +5,9 @@ #include "common/hardware/base.h" #include "common/util.h" -#if __TICI__ +#if __COMMA_HARDWARE__ #include "common/hardware/comma/hardware.h" -#define Hardware HardwareTici +#define Hardware HardwareComma #else #include "common/hardware/pc/hardware.h" #define Hardware HardwarePC diff --git a/openpilot/common/hardware/pc/hardware.py b/openpilot/common/hardware/pc/hardware.py index b4aa56c90..417d2db37 100644 --- a/openpilot/common/hardware/pc/hardware.py +++ b/openpilot/common/hardware/pc/hardware.py @@ -1,7 +1,7 @@ from openpilot.cereal import log from openpilot.common.hardware.base import HardwareBase -class Pc(HardwareBase): +class HardwarePc(HardwareBase): def get_device_type(self): return "pc" diff --git a/openpilot/common/test.py b/openpilot/common/test.py index 6ccc76c5e..23b934bfd 100644 --- a/openpilot/common/test.py +++ b/openpilot/common/test.py @@ -6,7 +6,7 @@ import subprocess import unittest from unittest import mock -from openpilot.common.hardware import HARDWARE, TICI +from openpilot.common.hardware import HARDWARE, COMMA_HARDWARE from openpilot.common.prefix import OpenpilotPrefix from openpilot.system.manager import manager @@ -24,7 +24,7 @@ def clean_env(): class OpenpilotTestCase(unittest.TestCase): """TestCase with openpilot's per-test isolation.""" - TICI_TEST = False + COMMA_HARDWARE_TEST = False SHARED_DOWNLOAD_CACHE = False def __init_subclass__(cls, **kwargs): @@ -61,7 +61,7 @@ class OpenpilotTestCase(unittest.TestCase): def run(self, result=None): # This boundary cannot live in setUp/tearDown: existing unittest classes # are allowed to override those hooks without calling super(). - if (self.TICI_TEST and not TICI) or getattr(type(self), "__unittest_skip__", False): + if (self.COMMA_HARDWARE_TEST and not COMMA_HARDWARE) or getattr(type(self), "__unittest_skip__", False): return super().run(result) test_env = clean_env() test_env.__enter__() @@ -80,8 +80,8 @@ class OpenpilotTestCase(unittest.TestCase): @classmethod def setUpClass(cls): super().setUpClass() - if cls.TICI_TEST and not TICI: - raise unittest.SkipTest("Skipping tici test on PC") + if cls.COMMA_HARDWARE_TEST and not COMMA_HARDWARE: + raise unittest.SkipTest("Skipping comma hardware test on PC") cls._class_env = clean_env() cls._class_env.__enter__() setup_class = getattr(cls, "setup_class", None) @@ -100,10 +100,10 @@ class OpenpilotTestCase(unittest.TestCase): def setUp(self): super().setUp() - if self.TICI_TEST and not TICI: - self.skipTest("Skipping tici test on PC") + if self.COMMA_HARDWARE_TEST and not COMMA_HARDWARE: + self.skipTest("Skipping comma hardware test on PC") - if self.TICI_TEST: + if self.COMMA_HARDWARE_TEST: HARDWARE.initialize_hardware() HARDWARE.set_power_save(False) subprocess.run(["pkill", "-9", "-f", "athena"], check=False) diff --git a/openpilot/selfdrive/modeld/SConscript b/openpilot/selfdrive/modeld/SConscript index 02d79ef7b..2085d6583 100644 --- a/openpilot/selfdrive/modeld/SConscript +++ b/openpilot/selfdrive/modeld/SConscript @@ -27,7 +27,7 @@ tinygrad_files = ["#"+x for x in glob.glob(env.Dir("#tinygrad_repo").relpath + " def estimate_pickle_max_size(onnx_size): return 1.2 * onnx_size + 10 * 1024 * 1024 # 20% + 10MB is plenty -if arch == 'larch64': +if arch == 'comma_arm64': tg_backend = 'QCOM' tg_flags = f'DEV={tg_backend} IMAGE=1 FLOAT16=1 NOLOCALS=1 JIT_BATCH_SIZE=0 OPENPILOT_HACKS=1' else: diff --git a/openpilot/selfdrive/pandad/tests/test_pandad.py b/openpilot/selfdrive/pandad/tests/test_pandad.py index bead2ffa8..891508f2d 100755 --- a/openpilot/selfdrive/pandad/tests/test_pandad.py +++ b/openpilot/selfdrive/pandad/tests/test_pandad.py @@ -17,7 +17,7 @@ HERE = os.path.dirname(os.path.realpath(__file__)) class TestPandad(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True def setUp(self): super().setUp() diff --git a/openpilot/selfdrive/pandad/tests/test_pandad_loopback.py b/openpilot/selfdrive/pandad/tests/test_pandad_loopback.py index 5895a3206..ad35018f5 100755 --- a/openpilot/selfdrive/pandad/tests/test_pandad_loopback.py +++ b/openpilot/selfdrive/pandad/tests/test_pandad_loopback.py @@ -73,7 +73,7 @@ def send_random_can_messages(sendcan, count): class TestBoarddLoopback(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True @classmethod def setup_class(cls): os.environ['STARTED'] = '1' diff --git a/openpilot/selfdrive/pandad/tests/test_pandad_spi.py b/openpilot/selfdrive/pandad/tests/test_pandad_spi.py index 9cb0ac30c..ba2e31ce8 100755 --- a/openpilot/selfdrive/pandad/tests/test_pandad_spi.py +++ b/openpilot/selfdrive/pandad/tests/test_pandad_spi.py @@ -16,7 +16,7 @@ from openpilot.selfdrive.pandad.tests.test_pandad_loopback import setup_pandad, JUNGLE_SPAM = "JUNGLE_SPAM" in os.environ class TestBoarddSpi(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True @classmethod def setup_class(cls): os.environ['STARTED'] = '1' diff --git a/openpilot/selfdrive/test/test_onroad.py b/openpilot/selfdrive/test/test_onroad.py index 9a514139c..2ee876a6e 100755 --- a/openpilot/selfdrive/test/test_onroad.py +++ b/openpilot/selfdrive/test/test_onroad.py @@ -105,7 +105,7 @@ def cputime_total(ct): class TestOnroad(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True @classmethod def setup_class(cls): diff --git a/openpilot/selfdrive/test/test_power_draw.py b/openpilot/selfdrive/test/test_power_draw.py index 01856f81e..4fba2e8c9 100755 --- a/openpilot/selfdrive/test/test_power_draw.py +++ b/openpilot/selfdrive/test/test_power_draw.py @@ -42,7 +42,7 @@ PROCS = [ class TestPowerDraw(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True def setup_method(self): Params().put("CarParams", get_demo_car_params().to_bytes(), block=True) diff --git a/openpilot/selfdrive/ui/SConscript b/openpilot/selfdrive/ui/SConscript index 2b0275968..b5c81a900 100644 --- a/openpilot/selfdrive/ui/SConscript +++ b/openpilot/selfdrive/ui/SConscript @@ -3,7 +3,7 @@ from pathlib import Path Import('env', 'arch', 'common') -if GetOption('extras') and arch == "larch64": +if GetOption('extras') and arch == "comma_arm64": # build installers raylib_dir = Path(importlib.util.find_spec("raylib").submodule_search_locations[0]) / "install" raylib_env = env.Clone() diff --git a/openpilot/selfdrive/ui/mici/onroad/alert_renderer.py b/openpilot/selfdrive/ui/mici/onroad/alert_renderer.py index 12b62924c..fe96bbd03 100644 --- a/openpilot/selfdrive/ui/mici/onroad/alert_renderer.py +++ b/openpilot/selfdrive/ui/mici/onroad/alert_renderer.py @@ -9,7 +9,7 @@ from openpilot.cereal import messaging, log from opendbc.car.structs import car from openpilot.selfdrive.ui.ui_state import ui_state from openpilot.common.filter_simple import BounceFilter, FirstOrderFilter -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from openpilot.system.ui.lib.application import gui_app, FontWeight from openpilot.system.ui.widgets import Widget from openpilot.system.ui.widgets.label import UnifiedLabel @@ -132,7 +132,7 @@ class AlertRenderer(Widget): return ALERT_STARTUP_PENDING # 2. Lost communication with selfdriveState after receiving it - if TICI and not waiting_for_startup: + if COMMA_HARDWARE and not waiting_for_startup: ss_missing = time.monotonic() - sm.recv_time['selfdriveState'] if ss_missing > SELFDRIVE_STATE_TIMEOUT: if ss.enabled and (ss_missing - SELFDRIVE_STATE_TIMEOUT) < SELFDRIVE_UNRESPONSIVE_TIMEOUT: diff --git a/openpilot/selfdrive/ui/mici/onroad/cameraview.py b/openpilot/selfdrive/ui/mici/onroad/cameraview.py index 4a31a9e04..4ccfb0468 100644 --- a/openpilot/selfdrive/ui/mici/onroad/cameraview.py +++ b/openpilot/selfdrive/ui/mici/onroad/cameraview.py @@ -4,7 +4,7 @@ import pyray as rl from msgq.visionipc import VisionIpcClient, VisionStreamType, VisionBuf from openpilot.common.swaglog import cloudlog -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from openpilot.system.ui.lib.application import gui_app from openpilot.system.ui.lib.egl import init_egl, create_egl_image, destroy_egl_image, bind_egl_image_to_texture, EGLImage from openpilot.system.ui.widgets import Widget @@ -38,7 +38,7 @@ void main() { """ # Choose fragment shader based on platform capabilities -if TICI: +if COMMA_HARDWARE: FRAME_FRAGMENT_SHADER = """ #version 300 es #extension GL_OES_EGL_image_external_essl3 : enable @@ -121,7 +121,7 @@ class CameraView(Widget): self._texture_needs_update = True self.last_connection_attempt: float = 0.0 self.shader = rl.load_shader_from_memory(VERTEX_SHADER, FRAME_FRAGMENT_SHADER) - self._texture1_loc: int = rl.get_shader_location(self.shader, "texture1") if not TICI else -1 + self._texture1_loc: int = rl.get_shader_location(self.shader, "texture1") if not COMMA_HARDWARE else -1 self._engaged_loc = rl.get_shader_location(self.shader, "engaged") self._engaged_val = rl.ffi.new("int[1]", [1]) self._enhance_driver_loc = rl.get_shader_location(self.shader, "enhance_driver") @@ -137,8 +137,8 @@ class CameraView(Widget): self._placeholder_color: rl.Color | None = None - # Initialize EGL for zero-copy rendering on TICI - if TICI: + # Initialize EGL for zero-copy rendering on COMMA_HARDWARE + if COMMA_HARDWARE: if not init_egl(): raise RuntimeError("Failed to initialize EGL") @@ -185,7 +185,7 @@ class CameraView(Widget): self._clear_textures() # Clean up EGL texture - if TICI and self.egl_texture: + if COMMA_HARDWARE and self.egl_texture: rl.unload_texture(self.egl_texture) self.egl_texture = None @@ -260,7 +260,7 @@ class CameraView(Widget): dst_rect = rl.Rectangle(x_offset, y_offset, scale_x, scale_y) # Render with appropriate method - if TICI: + if COMMA_HARDWARE: self._render_egl(src_rect, dst_rect) else: self._render_textures(src_rect, dst_rect) @@ -384,7 +384,7 @@ class CameraView(Widget): def _initialize_textures(self): self._clear_textures() - if not TICI: + if not COMMA_HARDWARE: self.texture_y = rl.load_texture_from_image(rl.Image(None, int(self.client.stride), int(self.client.height), 1, rl.PixelFormat.PIXELFORMAT_UNCOMPRESSED_GRAYSCALE)) self.texture_uv = rl.load_texture_from_image(rl.Image(None, int(self.client.stride // 2), @@ -400,7 +400,7 @@ class CameraView(Widget): self.texture_uv = None # Clean up EGL resources - if TICI: + if COMMA_HARDWARE: for data in self.egl_images.values(): destroy_egl_image(data) self.egl_images = {} diff --git a/openpilot/selfdrive/ui/onroad/alert_renderer.py b/openpilot/selfdrive/ui/onroad/alert_renderer.py index 0ce404bec..29ace6628 100644 --- a/openpilot/selfdrive/ui/onroad/alert_renderer.py +++ b/openpilot/selfdrive/ui/onroad/alert_renderer.py @@ -3,7 +3,7 @@ import pyray as rl from dataclasses import dataclass from openpilot.cereal import messaging, log from openpilot.selfdrive.ui.ui_state import ui_state -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from openpilot.system.ui.lib.application import gui_app, FontWeight from openpilot.system.ui.lib.multilang import tr from openpilot.system.ui.lib.text_measure import measure_text_cached @@ -96,7 +96,7 @@ class AlertRenderer(Widget): return ALERT_STARTUP_PENDING # 2. Lost communication with selfdriveState after receiving it - if TICI and not waiting_for_startup: + if COMMA_HARDWARE and not waiting_for_startup: ss_missing = time.monotonic() - sm.recv_time['selfdriveState'] if ss_missing > SELFDRIVE_STATE_TIMEOUT: if ss.enabled and (ss_missing - SELFDRIVE_STATE_TIMEOUT) < SELFDRIVE_UNRESPONSIVE_TIMEOUT: diff --git a/openpilot/selfdrive/ui/onroad/cameraview.py b/openpilot/selfdrive/ui/onroad/cameraview.py index 846bf20bb..1fed2dd68 100644 --- a/openpilot/selfdrive/ui/onroad/cameraview.py +++ b/openpilot/selfdrive/ui/onroad/cameraview.py @@ -4,7 +4,7 @@ import pyray as rl from msgq.visionipc import VisionIpcClient, VisionStreamType, VisionBuf from openpilot.common.swaglog import cloudlog -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from openpilot.system.ui.lib.application import gui_app from openpilot.system.ui.lib.egl import init_egl, create_egl_image, destroy_egl_image, bind_egl_image_to_texture, EGLImage from openpilot.system.ui.widgets import Widget @@ -38,7 +38,7 @@ void main() { """ # Choose fragment shader based on platform capabilities -if TICI: +if COMMA_HARDWARE: FRAME_FRAGMENT_SHADER = """ #version 300 es #extension GL_OES_EGL_image_external_essl3 : enable @@ -82,7 +82,7 @@ class CameraView(Widget): self._texture_needs_update = True self.last_connection_attempt: float = 0.0 self.shader = rl.load_shader_from_memory(VERTEX_SHADER, FRAME_FRAGMENT_SHADER) - self._texture1_loc: int = rl.get_shader_location(self.shader, "texture1") if not TICI else -1 + self._texture1_loc: int = rl.get_shader_location(self.shader, "texture1") if not COMMA_HARDWARE else -1 self.frame: VisionBuf | None = None self.texture_y: rl.Texture | None = None @@ -94,8 +94,8 @@ class CameraView(Widget): self._placeholder_color: rl.Color | None = None - # Initialize EGL for zero-copy rendering on TICI - if TICI: + # Initialize EGL for zero-copy rendering on COMMA_HARDWARE + if COMMA_HARDWARE: if not init_egl(): raise RuntimeError("Failed to initialize EGL") @@ -146,7 +146,7 @@ class CameraView(Widget): self._clear_textures() # Clean up EGL texture - if TICI and self.egl_texture: + if COMMA_HARDWARE and self.egl_texture: rl.unload_texture(self.egl_texture) self.egl_texture = None @@ -220,7 +220,7 @@ class CameraView(Widget): dst_rect = rl.Rectangle(x_offset, y_offset, scale_x, scale_y) # Render with appropriate method - if TICI: + if COMMA_HARDWARE: self._render_egl(src_rect, dst_rect) else: self._render_textures(src_rect, dst_rect) @@ -337,7 +337,7 @@ class CameraView(Widget): def _initialize_textures(self): self._clear_textures() - if not TICI: + if not COMMA_HARDWARE: self.texture_y = rl.load_texture_from_image(rl.Image(None, int(self.client.stride), int(self.client.height), 1, rl.PixelFormat.PIXELFORMAT_UNCOMPRESSED_GRAYSCALE)) self.texture_uv = rl.load_texture_from_image(rl.Image(None, int(self.client.stride // 2), @@ -353,7 +353,7 @@ class CameraView(Widget): self.texture_uv = None # Clean up EGL resources - if TICI: + if COMMA_HARDWARE: for data in self.egl_images.values(): destroy_egl_image(data) self.egl_images = {} diff --git a/openpilot/selfdrive/ui/ui.py b/openpilot/selfdrive/ui/ui.py index ff2bc7d3c..30bba681c 100755 --- a/openpilot/selfdrive/ui/ui.py +++ b/openpilot/selfdrive/ui/ui.py @@ -3,7 +3,7 @@ import os import time from openpilot.cereal import messaging -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from openpilot.common.realtime import Priority, config_realtime_process, set_core_affinity from openpilot.system.ui.lib.application import gui_app from openpilot.selfdrive.ui.layouts.main import MainLayout @@ -31,7 +31,7 @@ def main(): if should_render: # reaffine after power save offlines our core - if TICI and os.sched_getaffinity(0) != cores: + if COMMA_HARDWARE and os.sched_getaffinity(0) != cores: try: set_core_affinity(list(cores)) except OSError: diff --git a/openpilot/system/athena/tests/test_athenad_ping.py b/openpilot/system/athena/tests/test_athenad_ping.py index d5592c40f..33876a623 100644 --- a/openpilot/system/athena/tests/test_athenad_ping.py +++ b/openpilot/system/athena/tests/test_athenad_ping.py @@ -8,13 +8,13 @@ from openpilot.common.test import OpenpilotTestCase from openpilot.common.params import Params from openpilot.common.timeout import Timeout from openpilot.system.athena import athenad -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE TIMEOUT_TOLERANCE = 20 # seconds def wifi_radio(on: bool) -> None: - if not TICI: + if not COMMA_HARDWARE: return print(f"wifi {'on' if on else 'off'}") subprocess.run(["nmcli", "radio", "wifi", "on" if on else "off"], check=True) @@ -91,12 +91,12 @@ class TestAthenadPing(OpenpilotTestCase): time.sleep(0.1) print("ping received") - @unittest.skipIf(not TICI, "only run on desk") + @unittest.skipIf(not COMMA_HARDWARE, "only run on desk") def test_offroad(self, subtests, mocker) -> None: self.params.put_bool("IsOffroad", True, block=True) self.assertTimeout(60 + TIMEOUT_TOLERANCE, subtests, mocker) # based using TCP keepalive settings - @unittest.skipIf(not TICI, "only run on desk") + @unittest.skipIf(not COMMA_HARDWARE, "only run on desk") def test_onroad(self, subtests, mocker) -> None: self.params.put_bool("IsOffroad", False, block=True) self.assertTimeout(21 + TIMEOUT_TOLERANCE, subtests, mocker) diff --git a/openpilot/system/camerad/test/test_camerad.py b/openpilot/system/camerad/test/test_camerad.py index 0d66f0e16..580a30683 100755 --- a/openpilot/system/camerad/test/test_camerad.py +++ b/openpilot/system/camerad/test/test_camerad.py @@ -73,7 +73,7 @@ def _camera_session(): return ts, exposure class TestCamerad(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True @classmethod def setUpClass(cls): diff --git a/openpilot/system/hardware/hardwared.py b/openpilot/system/hardware/hardwared.py index 10ee0aee3..270a75ade 100755 --- a/openpilot/system/hardware/hardwared.py +++ b/openpilot/system/hardware/hardwared.py @@ -17,7 +17,7 @@ from openpilot.common.filter_simple import FirstOrderFilter from openpilot.common.params import Params from openpilot.common.realtime import DT_HW from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert -from openpilot.common.hardware import HARDWARE, TICI, PC +from openpilot.common.hardware import HARDWARE, COMMA_HARDWARE, PC from openpilot.common.basedir import BASEDIR from openpilot.common.hardware.usb import CHESTNUT_FW_VERSION, CHESTNUT_ROM_USB_IDS, CHESTNUT_USB_IDS, get_usb_state, get_usb_topology, set_usb_state from openpilot.common.linux import LinuxSystemStats @@ -478,7 +478,7 @@ def main(): threading.Thread(target=hardware_thread, args=(end_event, hw_queue)), ] - if TICI: + if COMMA_HARDWARE: threads.append(threading.Thread(target=touch_thread, args=(end_event,))) for t in threads: diff --git a/openpilot/system/loggerd/SConscript b/openpilot/system/loggerd/SConscript index 3f5455269..6890c2965 100644 --- a/openpilot/system/loggerd/SConscript +++ b/openpilot/system/loggerd/SConscript @@ -4,7 +4,7 @@ libs = [common, messaging, visionipc] + ffmpeg_libs + ['pthread', 'm', 'zstd'] frameworks = [] src = ['logger.cc', 'zstd_writer.cc', 'video_writer.cc', 'encoder/encoder.cc', 'encoder/jpeg_encoder.cc'] -if arch == "larch64": +if arch == "comma_arm64": src += ['clip_encoder.cc', 'encoder/v4l_encoder.cc', 'encoder/v4l_decoder.cc'] else: src += ['encoder/ffmpeg_encoder.cc'] diff --git a/openpilot/system/loggerd/encoderd.cc b/openpilot/system/loggerd/encoderd.cc index f5b69b3c4..55f0777fb 100644 --- a/openpilot/system/loggerd/encoderd.cc +++ b/openpilot/system/loggerd/encoderd.cc @@ -1,16 +1,16 @@ #include -#ifdef __TICI__ +#ifdef __COMMA_HARDWARE__ #include #include #endif -#ifdef __TICI__ +#ifdef __COMMA_HARDWARE__ #include "system/loggerd/clip_encoder.h" #endif #include "system/loggerd/loggerd.h" #include "system/loggerd/encoder/jpeg_encoder.h" -#ifdef __TICI__ +#ifdef __COMMA_HARDWARE__ #include "system/loggerd/encoder/v4l_encoder.h" #define Encoder V4LEncoder #else @@ -178,7 +178,7 @@ void encoderd_thread(const LogCameraInfo (&cameras)[N]) { } int main(int argc, char* argv[]) { -#ifdef __TICI__ +#ifdef __COMMA_HARDWARE__ if (argc > 1 && std::string(argv[1]) == "--clip") { if (argc < 6) { fprintf(stderr, "usage: encoderd --clip OUTPUT START DURATION [--bitrate BPS] [--speedup N] " diff --git a/openpilot/system/loggerd/tests/test_encoder.py b/openpilot/system/loggerd/tests/test_encoder.py index 62c040cc1..307a89ba9 100755 --- a/openpilot/system/loggerd/tests/test_encoder.py +++ b/openpilot/system/loggerd/tests/test_encoder.py @@ -13,7 +13,7 @@ from tqdm import trange from openpilot.common.test import OpenpilotTestCase from openpilot.common.params import Params from openpilot.common.timeout import Timeout -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from openpilot.system.manager.process_config import managed_processes from openpilot.tools.lib.logreader import LogReader from openpilot.common.hardware.hw import Paths @@ -33,7 +33,7 @@ FILE_SIZE_TOLERANCE = 0.7 class TestEncoder(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True def setup_method(self): self._clear_logs() @@ -86,7 +86,7 @@ class TestEncoder(OpenpilotTestCase): # TODO: this ffprobe call is really slow # get width and check frame count cmd = f"ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets,width -of csv=p=0 {file_path}" - if TICI: + if COMMA_HARDWARE: cmd = "LD_LIBRARY_PATH=/usr/local/lib " + cmd expected_frames = fps * SEGMENT_LENGTH @@ -130,7 +130,7 @@ class TestEncoder(OpenpilotTestCase): assert 1 == len(set(first_frames)) - if TICI: + if COMMA_HARDWARE: expected_frames = fps * SEGMENT_LENGTH assert min(counts) == expected_frames shutil.rmtree(f"{route_prefix_path}--{i}") diff --git a/openpilot/system/loggerd/tests/test_loggerd.py b/openpilot/system/loggerd/tests/test_loggerd.py index 618e3d001..039bb1706 100644 --- a/openpilot/system/loggerd/tests/test_loggerd.py +++ b/openpilot/system/loggerd/tests/test_loggerd.py @@ -18,7 +18,7 @@ from openpilot.common.basedir import BASEDIR from openpilot.common.params import Params from openpilot.common.timeout import Timeout from openpilot.common.hardware.hw import Paths -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from openpilot.system.loggerd.xattr_cache import getxattr from openpilot.system.loggerd.deleter import PRESERVE_ATTR_NAME, PRESERVE_ATTR_VALUE from openpilot.system.manager.process_config import managed_processes @@ -234,7 +234,7 @@ class TestLoggerd(OpenpilotTestCase): assert abs(boot.wallTimeNanos - time.time_ns()) < 5*1e9 # within 5s assert boot.launchLog == launch_log - if TICI: + if COMMA_HARDWARE: for fn in ["console-ramoops", "pmsg-ramoops-0"]: path = Path(os.path.join("/sys/fs/pstore/", fn)) if path.is_file(): diff --git a/openpilot/system/manager/process_config.py b/openpilot/system/manager/process_config.py index a4326b410..32d850869 100644 --- a/openpilot/system/manager/process_config.py +++ b/openpilot/system/manager/process_config.py @@ -4,7 +4,7 @@ import platform from opendbc.car.structs import car from openpilot.common.params import Params -from openpilot.common.hardware import PC, TICI +from openpilot.common.hardware import PC, COMMA_HARDWARE from openpilot.system.manager.process import PythonProcess, NativeProcess, DaemonProcess WEBCAM = os.getenv("USE_WEBCAM") is not None @@ -101,18 +101,18 @@ procs = [ PythonProcess("card", "openpilot.selfdrive.car.card", only_onroad), PythonProcess("deleter", "openpilot.system.loggerd.deleter", always_run), PythonProcess("dmonitoringd", "openpilot.selfdrive.monitoring.dmonitoringd", driverview, enabled=(WEBCAM or not PC)), - PythonProcess("qcomgpsd", "openpilot.system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI), + PythonProcess("qcomgpsd", "openpilot.system.qcomgpsd.qcomgpsd", qcomgps, enabled=COMMA_HARDWARE), PythonProcess("pandad", "openpilot.selfdrive.pandad.pandad", always_run), PythonProcess("paramsd", "openpilot.selfdrive.locationd.paramsd", only_onroad), PythonProcess("lagd", "openpilot.selfdrive.locationd.lagd", only_onroad), - PythonProcess("ubloxd", "openpilot.system.ubloxd.ubloxd", ublox, enabled=TICI), - PythonProcess("pigeond", "openpilot.system.ubloxd.pigeond", ublox, enabled=TICI), + PythonProcess("ubloxd", "openpilot.system.ubloxd.ubloxd", ublox, enabled=COMMA_HARDWARE), + PythonProcess("pigeond", "openpilot.system.ubloxd.pigeond", ublox, enabled=COMMA_HARDWARE), PythonProcess("plannerd", "openpilot.selfdrive.controls.plannerd", not_long_maneuver), PythonProcess("maneuversd", "openpilot.tools.longitudinal_maneuvers.maneuversd", long_maneuver), PythonProcess("lateral_maneuversd", "openpilot.tools.lateral_maneuvers.lateral_maneuversd", lat_maneuver), PythonProcess("radard", "openpilot.selfdrive.controls.radard", only_onroad), PythonProcess("hardwared", "openpilot.system.hardware.hardwared", always_run), - PythonProcess("modem", "openpilot.common.hardware.comma.modem", always_run, enabled=TICI), + PythonProcess("modem", "openpilot.common.hardware.comma.modem", always_run, enabled=COMMA_HARDWARE), PythonProcess("tombstoned", "openpilot.system.tombstoned", always_run, enabled=not PC), PythonProcess("updated", "openpilot.system.updated.updated", only_offroad, enabled=not PC), PythonProcess("uploader", "openpilot.system.loggerd.uploader", always_run), diff --git a/openpilot/system/sensord/tests/test_sensord.py b/openpilot/system/sensord/tests/test_sensord.py index e1580af9b..ddbef7895 100755 --- a/openpilot/system/sensord/tests/test_sensord.py +++ b/openpilot/system/sensord/tests/test_sensord.py @@ -58,7 +58,7 @@ def iter_measurements(events): yield measurement, getattr(measurement, measurement.which()) class TestSensord(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True @classmethod def setup_class(cls): # enable LSM self test diff --git a/openpilot/system/ubloxd/pigeond.py b/openpilot/system/ubloxd/pigeond.py index f704761e3..58fba4d4e 100755 --- a/openpilot/system/ubloxd/pigeond.py +++ b/openpilot/system/ubloxd/pigeond.py @@ -12,7 +12,7 @@ from openpilot.common.time_helpers import system_time_valid from openpilot.common.params import Params from openpilot.common.serial import Serial from openpilot.common.swaglog import cloudlog -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from openpilot.common.gpio import gpio_init, gpio_set from openpilot.common.hardware.comma.pins import GPIO @@ -302,7 +302,7 @@ def run_receiving(duration: int = 0): def main(): - assert TICI, "unsupported hardware for pigeond" + assert COMMA_HARDWARE, "unsupported hardware for pigeond" run_receiving() if __name__ == "__main__": diff --git a/openpilot/system/ubloxd/tests/test_pigeond.py b/openpilot/system/ubloxd/tests/test_pigeond.py index 87e3f1852..0d2f5b00e 100644 --- a/openpilot/system/ubloxd/tests/test_pigeond.py +++ b/openpilot/system/ubloxd/tests/test_pigeond.py @@ -11,7 +11,7 @@ from openpilot.common.hardware.comma.pins import GPIO # TODO: test TTFF when we have good A-GNSS class TestPigeond(OpenpilotTestCase): - TICI_TEST = True + COMMA_HARDWARE_TEST = True def teardown_method(self): managed_processes['pigeond'].stop() diff --git a/openpilot/system/ui/lib/scroll_panel2.py b/openpilot/system/ui/lib/scroll_panel2.py index b6193672c..19faaa542 100644 --- a/openpilot/system/ui/lib/scroll_panel2.py +++ b/openpilot/system/ui/lib/scroll_panel2.py @@ -5,7 +5,7 @@ from collections.abc import Callable from enum import Enum from typing import cast from openpilot.system.ui.lib.application import gui_app, MouseEvent -from openpilot.common.hardware import TICI +from openpilot.common.hardware import COMMA_HARDWARE from collections import deque MIN_VELOCITY = 10 # px/s, changes from auto scroll to steady state @@ -52,7 +52,7 @@ class GuiScrollPanel2: self._initial_click_event: MouseEvent | None = None self._previous_mouse_event: MouseEvent | None = None self._velocity = 0.0 # pixels per second - self._velocity_buffer: deque[float] = deque(maxlen=12 if TICI else 6) + self._velocity_buffer: deque[float] = deque(maxlen=12 if COMMA_HARDWARE else 6) self._enabled: bool | Callable[[], bool] = True def set_enabled(self, enabled: bool | Callable[[], bool]) -> None: diff --git a/openpilot/system/ui/mici_setup.py b/openpilot/system/ui/mici_setup.py index 465cadda0..e4977ffdf 100755 --- a/openpilot/system/ui/mici_setup.py +++ b/openpilot/system/ui/mici_setup.py @@ -13,7 +13,7 @@ import pyray as rl from openpilot.cereal import log from openpilot.common.filter_simple import BounceFilter -from openpilot.common.hardware import HARDWARE, TICI +from openpilot.common.hardware import HARDWARE, COMMA_HARDWARE from openpilot.common.realtime import config_realtime_process, set_core_affinity from openpilot.common.swaglog import cloudlog from openpilot.common.time_helpers import system_time_valid @@ -570,7 +570,7 @@ class Setup(Widget): def main(): config_realtime_process(0, 51) # attempt to affine. AGNOS will start setup with all cores, should only fail when manually launching with screen off - if TICI: + if COMMA_HARDWARE: try: set_core_affinity([5]) except OSError: diff --git a/openpilot/system/ui/mici_updater.py b/openpilot/system/ui/mici_updater.py index a072354cf..d9009b825 100755 --- a/openpilot/system/ui/mici_updater.py +++ b/openpilot/system/ui/mici_updater.py @@ -5,7 +5,7 @@ import threading import pyray as rl from openpilot.common.realtime import config_realtime_process, set_core_affinity -from openpilot.common.hardware import HARDWARE, TICI +from openpilot.common.hardware import HARDWARE, COMMA_HARDWARE from openpilot.common.swaglog import cloudlog from openpilot.system.ui.lib.application import gui_app, FontWeight from openpilot.system.ui.widgets.nav_widget import NavWidget @@ -152,7 +152,7 @@ class Updater(Scroller): def main(): config_realtime_process(0, 51) # attempt to affine. AGNOS will start setup with all cores, should only fail when manually launching with screen off - if TICI: + if COMMA_HARDWARE: try: set_core_affinity([5]) except OSError: