the one true car.capnp (#38221)

* the one true car.capnp

* fix jotpluggler capnp import path

* bump to master
This commit is contained in:
Adeeb Shihadeh
2026-06-21 17:32:19 -07:00
committed by GitHub
parent bc168bb33a
commit df1663c58d
62 changed files with 108 additions and 68 deletions
+1
View File
@@ -114,6 +114,7 @@ env = Environment(
CPPPATH=[
"#",
"#msgq",
"#cereal/gen/cpp",
acados_include_dirs,
[x.INCLUDE_DIR for x in pkgs],
],
+7 -5
View File
@@ -4,12 +4,14 @@ cereal_dir = Dir('.')
gen_dir = Dir('gen')
# Build cereal
schema_files = ['log.capnp', 'car.capnp', 'deprecated.capnp', 'custom.capnp']
env.Command([f'gen/cpp/{s}.c++' for s in schema_files] + [f'gen/cpp/{s}.h' for s in schema_files],
schema_files,
f"capnpc --src-prefix={cereal_dir.path} $SOURCES -o c++:{gen_dir.path}/cpp/")
schema_files = ['log.capnp', 'deprecated.capnp', 'custom.capnp']
car_capnp = '#opendbc_repo/opendbc/car/car.capnp'
all_output = schema_files + ['car.capnp']
env.Command([f'gen/cpp/{s}.c++' for s in all_output] + [f'gen/cpp/{s}.h' for s in all_output],
schema_files + [car_capnp],
f"capnpc --src-prefix={cereal_dir.path} --src-prefix=opendbc_repo/opendbc/car --import-path=opendbc_repo/opendbc/car $SOURCES -o c++:{gen_dir.path}/cpp/")
cereal = env.Library('cereal', [f'gen/cpp/{s}.c++' for s in schema_files])
cereal = env.Library('cereal', [f'gen/cpp/{s}.c++' for s in all_output])
# Build messaging
services_h = env.Command(['services.h'], ['services.py'], 'python3 ' + cereal_dir.path + '/services.py > $TARGET')
+4 -4
View File
@@ -4,8 +4,8 @@ from importlib.resources import as_file, files
capnp.remove_import_hook()
with as_file(files("cereal")) as fspath:
with as_file(files("cereal")) as fspath, as_file(files("opendbc")) as opendbc_path:
CEREAL_PATH = fspath.as_posix()
log = capnp.load(os.path.join(CEREAL_PATH, "log.capnp"))
car = capnp.load(os.path.join(CEREAL_PATH, "car.capnp"))
custom = capnp.load(os.path.join(CEREAL_PATH, "custom.capnp"))
opendbc_import_path = os.path.join(os.path.realpath(opendbc_path.as_posix()), 'car')
log = capnp.load(os.path.join(CEREAL_PATH, "log.capnp"), imports=[opendbc_import_path])
custom = capnp.load(os.path.join(CEREAL_PATH, "custom.capnp"), imports=[opendbc_import_path])
-1
View File
@@ -1 +0,0 @@
../opendbc_repo/opendbc/car/car.capnp
+1 -1
View File
@@ -1,4 +1,4 @@
using Cxx = import "./include/c++.capnp";
using Cxx = import "/include/c++.capnp";
$Cxx.namespace("cereal");
@0xb526ba661d550a59;
+1 -1
View File
@@ -1,4 +1,4 @@
using Cxx = import "./include/c++.capnp";
using Cxx = import "/include/c++.capnp";
$Cxx.namespace("cereal");
@0x80ef1ec4889c2a63;
+2 -2
View File
@@ -1,7 +1,7 @@
using Cxx = import "./include/c++.capnp";
using Cxx = import "/include/c++.capnp";
$Cxx.namespace("cereal");
using Car = import "car.capnp";
using Car = import "/car.capnp";
using Deprecated = import "deprecated.capnp";
using Custom = import "custom.capnp";
+2 -1
View File
@@ -8,7 +8,8 @@ import time
from openpilot.common.parameterized import parameterized
import pytest
from cereal import log, car
from cereal import log
from opendbc.car.structs import car
import cereal.messaging as messaging
from cereal.services import SERVICE_LIST
+2 -1
View File
@@ -1,4 +1,5 @@
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from opendbc.car import DT_CTRL, structs
from opendbc.car.car_helpers import interfaces
from opendbc.car.interfaces import MAX_CTRL_SPEED
+2 -1
View File
@@ -5,7 +5,8 @@ import threading
import cereal.messaging as messaging
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from openpilot.common.params import Params
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper
+1 -1
View File
@@ -1,7 +1,7 @@
import math
import numpy as np
from cereal import car
from opendbc.car.structs import car
from openpilot.common.constants import CV
+1 -1
View File
@@ -3,7 +3,7 @@ import hypothesis.strategies as st
from hypothesis import Phase, given, settings
from openpilot.common.parameterized import parameterized
from cereal import car
from opendbc.car.structs 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
+1 -1
View File
@@ -5,7 +5,7 @@ import numpy as np
from openpilot.common.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 opendbc.car.structs import car
from openpilot.common.constants import CV
from openpilot.selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver
+2 -1
View File
@@ -2,7 +2,8 @@
import math
from numbers import Number
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
import cereal.messaging as messaging
from openpilot.common.constants import CV
from openpilot.common.params import Params
+1 -1
View File
@@ -1,5 +1,5 @@
import numpy as np
from cereal import car
from opendbc.car.structs 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
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
from cereal import car
from opendbc.car.structs import car
from openpilot.common.params import Params
from openpilot.common.realtime import Priority, config_realtime_process
from openpilot.common.swaglog import cloudlog
+2 -1
View File
@@ -5,7 +5,8 @@ from collections import deque
from typing import Any
import capnp
from cereal import messaging, log, car
from cereal import messaging, log
from opendbc.car.structs import car
from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.common.params import Params
from openpilot.common.realtime import DT_MDL, Priority, config_realtime_process
+2 -1
View File
@@ -1,6 +1,7 @@
from openpilot.common.parameterized import parameterized
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
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
@@ -1,6 +1,7 @@
from openpilot.common.parameterized import parameterized
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from opendbc.car.car_helpers import interfaces
from opendbc.car.toyota.values import CAR as TOYOTA
from opendbc.car.vehicle_model import VehicleModel
+1 -1
View File
@@ -1,4 +1,4 @@
from cereal import car
from opendbc.car.structs import car
from openpilot.selfdrive.controls.lib.longcontrol import LongCtrlState, long_control_state_trans
@@ -1,5 +1,6 @@
import numpy as np
from cereal import car, messaging
from cereal import messaging
from opendbc.car.structs import car
from opendbc.car import ACCELERATION_DUE_TO_GRAVITY
from opendbc.car import structs
from opendbc.car.lateral import get_friction, FRICTION_THRESHOLD
+2 -1
View File
@@ -11,7 +11,8 @@ import capnp
import numpy as np
from typing import NoReturn
from cereal import log, car
from cereal import log
from opendbc.car.structs import car
import cereal.messaging as messaging
from openpilot.common.hardware import HARDWARE
from openpilot.common.constants import CV
+2 -1
View File
@@ -6,7 +6,8 @@ from collections import deque
from functools import partial
import cereal.messaging as messaging
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from cereal.services import SERVICE_LIST
from openpilot.common.constants import CV
from openpilot.common.params import Params
+2 -1
View File
@@ -4,7 +4,8 @@ import numpy as np
import capnp
import cereal.messaging as messaging
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
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, ObservationKind, States
+2 -1
View File
@@ -3,7 +3,8 @@ import numpy as np
import time
import pytest
from cereal import messaging, log, car
from cereal import messaging, log
from opendbc.car.structs import car
from openpilot.selfdrive.locationd.lagd import LateralLagEstimator, retrieve_initial_lag, masked_normalized_cross_correlation, \
BLOCK_NUM_NEEDED, BLOCK_SIZE, MIN_OKAY_WINDOW_SEC, VERSION
from openpilot.selfdrive.test.process_replay.migration import migrate, migrate_carParams
+1 -1
View File
@@ -1,4 +1,4 @@
from cereal import car
from opendbc.car.structs import car
from openpilot.selfdrive.locationd.torqued import TorqueEstimator
+2 -1
View File
@@ -4,7 +4,8 @@ import numpy as np
from collections import deque, defaultdict
import cereal.messaging as messaging
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from openpilot.common.constants import ACCELERATION_DUE_TO_GRAVITY
from openpilot.common.params import Params
from openpilot.common.realtime import config_realtime_process, DT_MDL
+2 -1
View File
@@ -6,7 +6,8 @@ import time
import pickle
import numpy as np
import cereal.messaging as messaging
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from cereal.messaging import PubMaster, SubMaster
from msgq.visionipc import VisionIpcClient, VisionStreamType, VisionBuf
from opendbc.car.car_helpers import get_demo_car_params
+2 -1
View File
@@ -2,7 +2,8 @@ from collections import defaultdict
from math import atan2, radians
import numpy as np
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
import cereal.messaging as messaging
from openpilot.common.realtime import DT_DMON
from openpilot.common.filter_simple import FirstOrderFilter
@@ -7,7 +7,8 @@ from collections import defaultdict
from pprint import pprint
import cereal.messaging as messaging
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from opendbc.car.can_definitions import CanData
from openpilot.common.utils import retry
from openpilot.common.params import Params
+2 -1
View File
@@ -5,7 +5,8 @@ import os
from enum import IntEnum
from collections.abc import Callable
from cereal import log, car
from cereal import log
from opendbc.car.structs import car
import cereal.messaging as messaging
from openpilot.common.constants import CV
from openpilot.common.git import get_short_branch
+2 -1
View File
@@ -1,7 +1,8 @@
import math
from enum import StrEnum, auto
from cereal import car, messaging
from cereal import messaging
from opendbc.car.structs import car
from openpilot.common.realtime import DT_CTRL
from openpilot.selfdrive.locationd.helpers import Pose
from opendbc.car import ACCELERATION_DUE_TO_GRAVITY
+2 -1
View File
@@ -5,7 +5,8 @@ import threading
import cereal.messaging as messaging
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from msgq.visionipc import VisionIpcClient, VisionStreamType
+2 -1
View File
@@ -4,7 +4,8 @@ import os
import random
from PIL import Image, ImageDraw, ImageFont
from cereal import log, car
from cereal import log
from opendbc.car.structs import car
from cereal.messaging import SubMaster
from openpilot.common.basedir import BASEDIR
from openpilot.common.params import Params
+2 -1
View File
@@ -5,7 +5,8 @@ import capnp
import functools
import traceback
from cereal import messaging, car, log
from cereal import messaging, log
from opendbc.car.structs import car
from opendbc.car.fingerprints import MIGRATION
from opendbc.car.toyota.values import EPS_SCALE, ToyotaSafetyFlags
from opendbc.car.ford.values import CAR as FORD, FordFlags, FordSafetyFlags
@@ -15,7 +15,7 @@ import capnp
from openpilot.common.hardware.hw import Paths
import cereal.messaging as messaging
from cereal import car
from opendbc.car.structs import car
from cereal.services import SERVICE_LIST
from msgq.visionipc import VisionIpcServer, get_endpoint_name as vipc_get_endpoint_name
from opendbc.car.can_definitions import CanData
+1 -1
View File
@@ -2,7 +2,7 @@
import cereal.messaging as messaging
from openpilot.common.params import Params
from openpilot.common.swaglog import cloudlog
from cereal import car
from opendbc.car.structs import car
from openpilot.system.micd import SAMPLE_RATE, SAMPLE_BUFFER
FEEDBACK_MAX_DURATION = 10.0
+2 -1
View File
@@ -5,7 +5,8 @@ import pyray as rl
import random
import string
from dataclasses import dataclass
from cereal import messaging, log, car
from 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
@@ -1,6 +1,7 @@
import numpy as np
import pyray as rl
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from msgq.visionipc import VisionStreamType
from openpilot.selfdrive.ui.ui_state import ui_state, UIStatus
from openpilot.selfdrive.ui.mici.onroad import SIDE_PANEL_WIDTH
@@ -1,5 +1,6 @@
import pyray as rl
from cereal import car, log, messaging
from cereal import log, messaging
from opendbc.car.structs import car
from msgq.visionipc import VisionStreamType
from openpilot.selfdrive.ui.mici.onroad.cameraview import CameraView
from openpilot.selfdrive.ui.mici.onroad.driver_state import DriverStateRenderer
+2 -1
View File
@@ -1,7 +1,8 @@
import colorsys
import numpy as np
import pyray as rl
from cereal import messaging, car
from cereal import messaging
from opendbc.car.structs import car
from dataclasses import dataclass, field
from openpilot.common.params import Params
from openpilot.common.filter_simple import FirstOrderFilter
+2 -1
View File
@@ -1,7 +1,8 @@
import colorsys
import numpy as np
import pyray as rl
from cereal import messaging, car
from cereal import messaging
from opendbc.car.structs import car
from dataclasses import dataclass, field
from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.common.params import Params
+2 -1
View File
@@ -4,7 +4,8 @@ import time
import wave
from cereal import car, messaging
from cereal import messaging
from opendbc.car.structs import car
from openpilot.common.basedir import BASEDIR
from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.common.realtime import Ratekeeper
+2 -1
View File
@@ -5,7 +5,8 @@ from dataclasses import dataclass
import math
from cereal import car, log, messaging
from cereal import log, messaging
from opendbc.car.structs import car
from cereal.messaging import PubMaster
from openpilot.common.basedir import BASEDIR
from openpilot.common.params import Params
+1 -1
View File
@@ -1,6 +1,6 @@
import pytest
import cereal.messaging as messaging
from cereal import car
from opendbc.car.structs import car
from openpilot.common.params import Params
from openpilot.system.manager.process_config import managed_processes
+1 -1
View File
@@ -1,4 +1,4 @@
from cereal import car
from opendbc.car.structs import car
from cereal import messaging
from cereal.messaging import SubMaster, PubMaster
from openpilot.selfdrive.ui.soundd import SELFDRIVE_STATE_TIMEOUT, check_selfdrive_timeout_alert
+2 -1
View File
@@ -3,7 +3,8 @@ import time
import threading
from collections.abc import Callable
from enum import Enum
from cereal import messaging, car, log
from cereal import messaging, log
from opendbc.car.structs import car
from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.common.params import Params
from openpilot.common.realtime import drop_realtime
+2 -1
View File
@@ -28,7 +28,8 @@ from websocket import (ABNF, WebSocket, WebSocketException, WebSocketTimeoutExce
create_connection)
import cereal.messaging as messaging
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
from cereal.services import SERVICE_LIST
from openpilot.common.api import Api, get_key_pair
from openpilot.common.utils import CallbackReader, get_upload_stream
+2 -1
View File
@@ -9,7 +9,8 @@ from multiprocessing import Process
from setproctitle import setproctitle
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
import cereal.messaging as messaging
import openpilot.system.sentry as sentry
from openpilot.common.basedir import BASEDIR
+1 -1
View File
@@ -2,7 +2,7 @@ import os
import operator
import platform
from cereal import car
from opendbc.car.structs import car
from openpilot.common.params import Params
from openpilot.common.hardware import PC, TICI
from openpilot.system.manager.process import PythonProcess, NativeProcess, DaemonProcess
+1 -1
View File
@@ -3,7 +3,7 @@ import pytest
import signal
import time
from cereal import car
from opendbc.car.structs import car
from openpilot.common.params import Params
import openpilot.system.manager.manager as manager
from openpilot.system.manager.process import ensure_running
+2
View File
@@ -95,6 +95,8 @@ event_extractors = jot_env.Command("generated_event_extractors.h", [
"generate_event_extractors.py",
jot_env.Glob("#cereal/*.capnp"),
jot_env.Glob("#cereal/include/*.capnp"),
"#opendbc_repo/opendbc/car/car.capnp",
"#opendbc_repo/opendbc/car/include/c++.capnp",
],
generate_event_extractors,
)
@@ -321,7 +321,7 @@ if __name__ == "__main__":
repo_root = Path(sys.argv[1]).resolve()
output = Path(sys.argv[2])
capnp.remove_import_hook()
log = capnp.load(str(repo_root / "cereal" / "log.capnp"))
log = capnp.load(str(repo_root / "cereal" / "log.capnp"), imports=[str(repo_root / "opendbc_repo" / "opendbc" / "car")])
generated = Generator(log.Event.schema).generate()
output.parent.mkdir(parents=True, exist_ok=True)
output.write_text(generated)
+2 -1
View File
@@ -3,7 +3,8 @@
import math
import numpy as np
from cereal import messaging, car
from cereal import messaging
from opendbc.car.structs import car
from opendbc.car.vehicle_model import VehicleModel
from openpilot.common.realtime import DT_CTRL, Ratekeeper
from openpilot.common.params import Params
+1 -1
View File
@@ -11,7 +11,7 @@ from pathlib import Path
import matplotlib.pyplot as plt
from openpilot.common.utils import tabulate
from cereal import car
from opendbc.car.structs import car
from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.selfdrive.controls.lib.latcontrol_torque import LP_FILTER_CUTOFF_HZ
from openpilot.tools.lib.logreader import LogReader
@@ -2,7 +2,8 @@
import numpy as np
from dataclasses import dataclass
from cereal import messaging, car
from cereal import messaging
from opendbc.car.structs import car
from openpilot.common.constants import CV
from openpilot.common.realtime import DT_MDL
from openpilot.common.params import Params
+2 -1
View File
@@ -2,7 +2,8 @@
import numpy as np
from dataclasses import dataclass
from cereal import messaging, car
from cereal import messaging
from opendbc.car.structs import car
from openpilot.common.constants import CV
from openpilot.common.realtime import DT_MDL
from openpilot.common.params import Params
+1 -1
View File
@@ -2,7 +2,7 @@
import time
import argparse
import cereal.messaging as messaging
from cereal import car
from opendbc.car.structs import car
from opendbc.car.carlog import carlog
from opendbc.car.fw_versions import get_fw_versions, match_fw_to_car
from opendbc.car.vin import get_vin
+2 -1
View File
@@ -2,7 +2,8 @@
import time
import random
from cereal import car, log
from cereal import log
from opendbc.car.structs import car
import cereal.messaging as messaging
from opendbc.car.honda.interface import CarInterface
from openpilot.common.realtime import DT_CTRL
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
import sys
from cereal import car
from opendbc.car.structs import car
from openpilot.common.params import Params
from openpilot.tools.lib.route import Route
from openpilot.tools.lib.logreader import LogReader
+2 -1
View File
@@ -1,7 +1,8 @@
#!/usr/bin/env python3
import time
from cereal import car, log, messaging
from cereal import log, messaging
from opendbc.car.structs import car
from openpilot.common.params import Params
from openpilot.system.manager.process_config import managed_processes
from openpilot.common.hardware import HARDWARE