Skip to content

Commit

Permalink
rename selfdrive.car imports to opendbc.car
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Aug 16, 2024
1 parent 3bf77cb commit 562d109
Show file tree
Hide file tree
Showing 105 changed files with 380 additions and 380 deletions.
8 changes: 4 additions & 4 deletions opendbc/car/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from dataclasses import replace

from panda.python.uds import SERVICE_TYPE
from openpilot.selfdrive.car import structs
from openpilot.selfdrive.car.can_definitions import CanData
from openpilot.selfdrive.car.docs_definitions import CarDocs
from openpilot.selfdrive.car.common.numpy_fast import clip, interp
from opendbc.car import structs
from opendbc.car.can_definitions import CanData
from opendbc.car.docs_definitions import CarDocs
from opendbc.car.common.numpy_fast import clip, interp

# set up logging
carlog = logging.getLogger('carlog')
Expand Down
10 changes: 5 additions & 5 deletions opendbc/car/body/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from numbers import Number

from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import DT_CTRL
from openpilot.selfdrive.car.common.numpy_fast import clip, interp
from openpilot.selfdrive.car.body import bodycan
from openpilot.selfdrive.car.body.values import SPEED_FROM_RPM
from openpilot.selfdrive.car.interfaces import CarControllerBase
from opendbc.car import DT_CTRL
from opendbc.car.common.numpy_fast import clip, interp
from opendbc.car.body import bodycan
from opendbc.car.body.values import SPEED_FROM_RPM
from opendbc.car.interfaces import CarControllerBase


class PIController:
Expand Down
6 changes: 3 additions & 3 deletions opendbc/car/body/carstate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from opendbc.can.parser import CANParser
from openpilot.selfdrive.car import structs
from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.selfdrive.car.body.values import DBC
from opendbc.car import structs
from opendbc.car.interfaces import CarStateBase
from opendbc.car.body.values import DBC


class CarState(CarStateBase):
Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/body/fingerprints.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ruff: noqa: E501
from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.body.values import CAR
from opendbc.car.structs import CarParams
from opendbc.car.body.values import CAR

Ecu = CarParams.Ecu

Expand Down
6 changes: 3 additions & 3 deletions opendbc/car/body/interface.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import math
from openpilot.selfdrive.car import get_safety_config, structs
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.body.values import SPEED_FROM_RPM
from opendbc.car import get_safety_config, structs
from opendbc.car.interfaces import CarInterfaceBase
from opendbc.car.body.values import SPEED_FROM_RPM


class CarInterface(CarInterfaceBase):
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/body/radar_interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from openpilot.selfdrive.car.interfaces import RadarInterfaceBase
from opendbc.car.interfaces import RadarInterfaceBase

class RadarInterface(RadarInterfaceBase):
pass
8 changes: 4 additions & 4 deletions opendbc/car/body/values.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from openpilot.selfdrive.car import CarSpecs, PlatformConfig, Platforms, dbc_dict
from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.docs_definitions import CarDocs
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries
from opendbc.car import CarSpecs, PlatformConfig, Platforms, dbc_dict
from opendbc.car.structs import CarParams
from opendbc.car.docs_definitions import CarDocs
from opendbc.car.fw_query_definitions import FwQueryConfig, Request, StdQueries

Ecu = CarParams.Ecu

Expand Down
18 changes: 9 additions & 9 deletions opendbc/car/car_helpers.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import os
import time

from openpilot.selfdrive.car import carlog, gen_empty_fingerprint
from openpilot.selfdrive.car.can_definitions import CanRecvCallable, CanSendCallable
from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
from openpilot.selfdrive.car.fw_versions import ObdCallback, get_fw_versions_ordered, get_present_ecus, match_fw_to_car
from openpilot.selfdrive.car.interfaces import get_interface_attr
from openpilot.selfdrive.car.mock.values import CAR as MOCK
from openpilot.selfdrive.car.vin import get_vin, is_valid_vin, VIN_UNKNOWN
from opendbc.car import carlog, gen_empty_fingerprint
from opendbc.car.can_definitions import CanRecvCallable, CanSendCallable
from opendbc.car.structs import CarParams
from opendbc.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
from opendbc.car.fw_versions import ObdCallback, get_fw_versions_ordered, get_present_ecus, match_fw_to_car
from opendbc.car.interfaces import get_interface_attr
from opendbc.car.mock.values import CAR as MOCK
from opendbc.car.vin import get_vin, is_valid_vin, VIN_UNKNOWN

FRAME_FINGERPRINT = 100 # 1s


def load_interfaces(brand_names):
ret = {}
for brand_name in brand_names:
path = f'openpilot.selfdrive.car.{brand_name}'
path = f'opendbc.car.{brand_name}'
CarInterface = __import__(path + '.interface', fromlist=['CarInterface']).CarInterface
CarState = __import__(path + '.carstate', fromlist=['CarState']).CarState
CarController = __import__(path + '.carcontroller', fromlist=['CarController']).CarController
Expand Down
8 changes: 4 additions & 4 deletions opendbc/car/chrysler/carcontroller.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import copy
from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import DT_CTRL, apply_meas_steer_torque_limits
from openpilot.selfdrive.car.chrysler import chryslercan
from openpilot.selfdrive.car.chrysler.values import RAM_CARS, CarControllerParams, ChryslerFlags
from openpilot.selfdrive.car.interfaces import CarControllerBase
from opendbc.car import DT_CTRL, apply_meas_steer_torque_limits
from opendbc.car.chrysler import chryslercan
from opendbc.car.chrysler.values import RAM_CARS, CarControllerParams, ChryslerFlags
from opendbc.car.interfaces import CarControllerBase


class CarController(CarControllerBase):
Expand Down
8 changes: 4 additions & 4 deletions opendbc/car/chrysler/carstate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from openpilot.selfdrive.car import create_button_events, structs
from openpilot.selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD, RAM_CARS
from openpilot.selfdrive.car.common.conversions import Conversions as CV
from openpilot.selfdrive.car.interfaces import CarStateBase
from opendbc.car import create_button_events, structs
from opendbc.car.chrysler.values import DBC, STEER_THRESHOLD, RAM_CARS
from opendbc.car.common.conversions import Conversions as CV
from opendbc.car.interfaces import CarStateBase

ButtonType = structs.CarState.ButtonEvent.Type

Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/chrysler/chryslercan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from openpilot.selfdrive.car import structs
from openpilot.selfdrive.car.chrysler.values import RAM_CARS
from opendbc.car import structs
from opendbc.car.chrysler.values import RAM_CARS

GearShifter = structs.CarState.GearShifter
VisualAlert = structs.CarControl.HUDControl.VisualAlert
Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/chrysler/fingerprints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.chrysler.values import CAR
from opendbc.car.structs import CarParams
from opendbc.car.chrysler.values import CAR

Ecu = CarParams.Ecu

Expand Down
6 changes: 3 additions & 3 deletions opendbc/car/chrysler/interface.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
from panda import Panda
from openpilot.selfdrive.car import get_safety_config, structs
from openpilot.selfdrive.car.chrysler.values import CAR, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from opendbc.car import get_safety_config, structs
from opendbc.car.chrysler.values import CAR, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags
from opendbc.car.interfaces import CarInterfaceBase


class CarInterface(CarInterfaceBase):
Expand Down
6 changes: 3 additions & 3 deletions opendbc/car/chrysler/radar_interface.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
from opendbc.can.parser import CANParser
from openpilot.selfdrive.car import structs
from openpilot.selfdrive.car.interfaces import RadarInterfaceBase
from openpilot.selfdrive.car.chrysler.values import DBC
from opendbc.car import structs
from opendbc.car.interfaces import RadarInterfaceBase
from opendbc.car.chrysler.values import DBC

RADAR_MSGS_C = list(range(0x2c2, 0x2d4+2, 2)) # c_ messages 706,...,724
RADAR_MSGS_D = list(range(0x2a2, 0x2b4+2, 2)) # d_ messages
Expand Down
8 changes: 4 additions & 4 deletions opendbc/car/chrysler/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from dataclasses import dataclass, field

from panda.python import uds
from openpilot.selfdrive.car import CarSpecs, DbcDict, PlatformConfig, Platforms, dbc_dict
from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.docs_definitions import CarHarness, CarDocs, CarParts
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, p16
from opendbc.car import CarSpecs, DbcDict, PlatformConfig, Platforms, dbc_dict
from opendbc.car.structs import CarParams
from opendbc.car.docs_definitions import CarHarness, CarDocs, CarParts
from opendbc.car.fw_query_definitions import FwQueryConfig, Request, p16

Ecu = CarParams.Ecu

Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/disable_ecu.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from openpilot.selfdrive.car import carlog
from openpilot.selfdrive.car.isotp_parallel_query import IsoTpParallelQuery
from opendbc.car import carlog
from opendbc.car.isotp_parallel_query import IsoTpParallelQuery

EXT_DIAG_REQUEST = b'\x10\x03'
EXT_DIAG_RESPONSE = b'\x50\x03'
Expand Down
10 changes: 5 additions & 5 deletions opendbc/car/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from enum import Enum
from natsort import natsorted

from openpilot.selfdrive.car import gen_empty_fingerprint
from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.docs_definitions import CarDocs, Column, CommonFootnote, PartType
from openpilot.selfdrive.car.car_helpers import interfaces, get_interface_attr
from openpilot.selfdrive.car.values import PLATFORMS
from opendbc.car import gen_empty_fingerprint
from opendbc.car.structs import CarParams
from opendbc.car.docs_definitions import CarDocs, Column, CommonFootnote, PartType
from opendbc.car.car_helpers import interfaces, get_interface_attr
from opendbc.car.values import PLATFORMS


def get_all_footnotes() -> dict[Enum, int]:
Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/docs_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from dataclasses import dataclass, field
from enum import Enum

from openpilot.selfdrive.car.common.conversions import Conversions as CV
from openpilot.selfdrive.car.structs import CarParams
from opendbc.car.common.conversions import Conversions as CV
from opendbc.car.structs import CarParams

GOOD_TORQUE_THRESHOLD = 1.0 # m/s^2
MODEL_YEARS_RE = r"(?<= )((\d{4}-\d{2})|(\d{4}))(,|$)"
Expand Down
6 changes: 3 additions & 3 deletions opendbc/car/ecu_addrs.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import time

from panda.python.uds import SERVICE_TYPE
from openpilot.selfdrive.car import make_tester_present_msg, carlog
from openpilot.selfdrive.car.can_definitions import CanData, CanRecvCallable, CanSendCallable
from openpilot.selfdrive.car.fw_query_definitions import EcuAddrBusType
from opendbc.car import make_tester_present_msg, carlog
from opendbc.car.can_definitions import CanData, CanRecvCallable, CanSendCallable
from opendbc.car.fw_query_definitions import EcuAddrBusType


def _is_tester_present_response(msg: CanData, subaddr: int = None) -> bool:
Expand Down
26 changes: 13 additions & 13 deletions opendbc/car/fingerprints.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from openpilot.selfdrive.car.interfaces import get_interface_attr
from openpilot.selfdrive.car.body.values import CAR as BODY
from openpilot.selfdrive.car.chrysler.values import CAR as CHRYSLER
from openpilot.selfdrive.car.ford.values import CAR as FORD
from openpilot.selfdrive.car.gm.values import CAR as GM
from openpilot.selfdrive.car.honda.values import CAR as HONDA
from openpilot.selfdrive.car.hyundai.values import CAR as HYUNDAI
from openpilot.selfdrive.car.mazda.values import CAR as MAZDA
from openpilot.selfdrive.car.mock.values import CAR as MOCK
from openpilot.selfdrive.car.nissan.values import CAR as NISSAN
from openpilot.selfdrive.car.subaru.values import CAR as SUBARU
from openpilot.selfdrive.car.toyota.values import CAR as TOYOTA
from openpilot.selfdrive.car.volkswagen.values import CAR as VW
from opendbc.car.interfaces import get_interface_attr
from opendbc.car.body.values import CAR as BODY
from opendbc.car.chrysler.values import CAR as CHRYSLER
from opendbc.car.ford.values import CAR as FORD
from opendbc.car.gm.values import CAR as GM
from opendbc.car.honda.values import CAR as HONDA
from opendbc.car.hyundai.values import CAR as HYUNDAI
from opendbc.car.mazda.values import CAR as MAZDA
from opendbc.car.mock.values import CAR as MOCK
from opendbc.car.nissan.values import CAR as NISSAN
from opendbc.car.subaru.values import CAR as SUBARU
from opendbc.car.toyota.values import CAR as TOYOTA
from opendbc.car.volkswagen.values import CAR as VW

FW_VERSIONS = get_interface_attr('FW_VERSIONS', combine_brands=True, ignore_none=True)
_FINGERPRINTS = get_interface_attr('FINGERPRINTS', combine_brands=True, ignore_none=True)
Expand Down
10 changes: 5 additions & 5 deletions opendbc/car/ford/carcontroller.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import copy
from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import apply_std_steer_angle_limits, structs
from openpilot.selfdrive.car.ford import fordcan
from openpilot.selfdrive.car.ford.values import CarControllerParams, FordFlags
from openpilot.selfdrive.car.common.numpy_fast import clip
from openpilot.selfdrive.car.interfaces import CarControllerBase, V_CRUISE_MAX
from opendbc.car import apply_std_steer_angle_limits, structs
from opendbc.car.ford import fordcan
from opendbc.car.ford.values import CarControllerParams, FordFlags
from opendbc.car.common.numpy_fast import clip
from opendbc.car.interfaces import CarControllerBase, V_CRUISE_MAX

LongCtrlState = structs.CarControl.Actuators.LongControlState
VisualAlert = structs.CarControl.HUDControl.VisualAlert
Expand Down
10 changes: 5 additions & 5 deletions opendbc/car/ford/carstate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser
from openpilot.selfdrive.car import create_button_events, structs
from openpilot.selfdrive.car.common.conversions import Conversions as CV
from openpilot.selfdrive.car.ford.fordcan import CanBus
from openpilot.selfdrive.car.ford.values import DBC, CarControllerParams, FordFlags
from openpilot.selfdrive.car.interfaces import CarStateBase
from opendbc.car import create_button_events, structs
from opendbc.car.common.conversions import Conversions as CV
from opendbc.car.ford.fordcan import CanBus
from opendbc.car.ford.values import DBC, CarControllerParams, FordFlags
from opendbc.car.interfaces import CarStateBase

ButtonType = structs.CarState.ButtonEvent.Type
GearShifter = structs.CarState.GearShifter
Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/ford/fingerprints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.ford.values import CAR
from opendbc.car.structs import CarParams
from opendbc.car.ford.values import CAR

Ecu = CarParams.Ecu

Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/ford/fordcan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from openpilot.selfdrive.car import CanBusBase, structs
from opendbc.car import CanBusBase, structs

HUDControl = structs.CarControl.HUDControl

Expand Down
10 changes: 5 additions & 5 deletions opendbc/car/ford/interface.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from panda import Panda
from openpilot.selfdrive.car import get_safety_config, structs
from openpilot.selfdrive.car.common.conversions import Conversions as CV
from openpilot.selfdrive.car.ford.fordcan import CanBus
from openpilot.selfdrive.car.ford.values import Ecu, FordFlags
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from opendbc.car import get_safety_config, structs
from opendbc.car.common.conversions import Conversions as CV
from opendbc.car.ford.fordcan import CanBus
from opendbc.car.ford.values import Ecu, FordFlags
from opendbc.car.interfaces import CarInterfaceBase

TransmissionType = structs.CarParams.TransmissionType

Expand Down
10 changes: 5 additions & 5 deletions opendbc/car/ford/radar_interface.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from math import cos, sin
from opendbc.can.parser import CANParser
from openpilot.selfdrive.car import structs
from openpilot.selfdrive.car.common.conversions import Conversions as CV
from openpilot.selfdrive.car.ford.fordcan import CanBus
from openpilot.selfdrive.car.ford.values import DBC, RADAR
from openpilot.selfdrive.car.interfaces import RadarInterfaceBase
from opendbc.car import structs
from opendbc.car.common.conversions import Conversions as CV
from opendbc.car.ford.fordcan import CanBus
from opendbc.car.ford.values import DBC, RADAR
from opendbc.car.interfaces import RadarInterfaceBase

DELPHI_ESR_RADAR_MSGS = list(range(0x500, 0x540))

Expand Down
6 changes: 3 additions & 3 deletions opendbc/car/ford/tests/print_platform_codes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
from collections import defaultdict

from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.ford.values import get_platform_codes
from openpilot.selfdrive.car.ford.fingerprints import FW_VERSIONS
from opendbc.car.structs import CarParams
from opendbc.car.ford.values import get_platform_codes
from opendbc.car.ford.fingerprints import FW_VERSIONS

Ecu = CarParams.Ecu

Expand Down
8 changes: 4 additions & 4 deletions opendbc/car/ford/tests/test_ford.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from hypothesis import settings, given, strategies as st
from parameterized import parameterized

from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.fw_versions import build_fw_dict
from openpilot.selfdrive.car.ford.values import CAR, FW_QUERY_CONFIG, FW_PATTERN, get_platform_codes
from openpilot.selfdrive.car.ford.fingerprints import FW_VERSIONS
from opendbc.car.structs import CarParams
from opendbc.car.fw_versions import build_fw_dict
from opendbc.car.ford.values import CAR, FW_QUERY_CONFIG, FW_PATTERN, get_platform_codes
from opendbc.car.ford.fingerprints import FW_VERSIONS

Ecu = CarParams.Ecu

Expand Down
8 changes: 4 additions & 4 deletions opendbc/car/ford/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from enum import Enum, IntFlag

import panda.python.uds as uds
from openpilot.selfdrive.car import AngleRateLimit, CarSpecs, dbc_dict, DbcDict, PlatformConfig, Platforms
from openpilot.selfdrive.car.structs import CarParams
from openpilot.selfdrive.car.docs_definitions import CarFootnote, CarHarness, CarDocs, CarParts, Column, \
from opendbc.car import AngleRateLimit, CarSpecs, dbc_dict, DbcDict, PlatformConfig, Platforms
from opendbc.car.structs import CarParams
from opendbc.car.docs_definitions import CarFootnote, CarHarness, CarDocs, CarParts, Column, \
Device
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, LiveFwVersions, OfflineFwVersions, Request, StdQueries, p16
from opendbc.car.fw_query_definitions import FwQueryConfig, LiveFwVersions, OfflineFwVersions, Request, StdQueries, p16

Ecu = CarParams.Ecu

Expand Down
Loading

0 comments on commit 562d109

Please sign in to comment.