Merge remote-tracking branch 'upstream/master' into car-remove-import-exceptions

pull/33215/head
Shane Smiskol 10 months ago
commit c212974873
  1. 6
      .github/workflows/ci_weekly_report.yaml
  2. 2
      opendbc_repo
  3. 2
      pyproject.toml
  4. 4
      selfdrive/car/__init__.py
  5. 2
      selfdrive/car/card.py
  6. 10
      selfdrive/car/interfaces.py
  7. 4
      selfdrive/car/isotp_parallel_query.py
  8. 4
      selfdrive/pandad/pandad_api_impl.pyx

@ -58,14 +58,14 @@ jobs:
const jobName = job.name.split(" / ")[2]; const jobName = job.name.split(" / ")[2];
const runRegex = /\((.*?)\)/; const runRegex = /\((.*?)\)/;
const run = job.name.match(runRegex)[1]; const run = job.name.match(runRegex)[1];
report[jobName] = report[jobName] || { successes: [], failures: [], cancelled: [] }; report[jobName] = report[jobName] || { successes: [], failures: [], canceled: [] };
switch (job.conclusion) { switch (job.conclusion) {
case "success": case "success":
report[jobName].successes.push({ "run_number": run, "link": job.html_url}); break; report[jobName].successes.push({ "run_number": run, "link": job.html_url}); break;
case "failure": case "failure":
report[jobName].failures.push({ "run_number": run, "link": job.html_url }); break; report[jobName].failures.push({ "run_number": run, "link": job.html_url }); break;
case "cancelled": case "canceled":
report[jobName].cancelled.push({ "run_number": run, "link": job.html_url }); break; report[jobName].canceled.push({ "run_number": run, "link": job.html_url }); break;
} }
}); });
return JSON.stringify({"jobs": report}); return JSON.stringify({"jobs": report});

@ -1 +1 @@
Subproject commit 1e9f8536151818f08af2ddd478f577f8461af31d Subproject commit f4d077b832d46ac149c2b07dc37d777dc21237ea

@ -167,7 +167,7 @@ testpaths = [
[tool.codespell] [tool.codespell]
quiet-level = 3 quiet-level = 3
# if you've got a short variable name that's getting flagged, add it here # if you've got a short variable name that's getting flagged, add it here
ignore-words-list = "bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn,ws,uint,grey,deque,stdio,amin,BA,LITE,atEnd,UIs,errorString,arange,FocusIn,od,tim,relA,hist,copyable" ignore-words-list = "bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn,ws,uint,grey,deque,stdio,amin,BA,LITE,atEnd,UIs,errorString,arange,FocusIn,od,tim,relA,hist,copyable,jupyter,thead"
builtin = "clear,rare,informal,code,names,en-GB_to_en-US" builtin = "clear,rare,informal,code,names,en-GB_to_en-US"
skip = "./third_party/*, ./tinygrad/*, ./tinygrad_repo/*, ./msgq/*, ./panda/*, ./opendbc/*, ./opendbc_repo/*, ./rednose/*, ./rednose_repo/*, ./teleoprtc/*, ./teleoprtc_repo/*, ./selfdrive/ui/translations/*.ts, uv.lock, *.onnx, ./cereal/gen/*, */c_generated_code/*" skip = "./third_party/*, ./tinygrad/*, ./tinygrad_repo/*, ./msgq/*, ./panda/*, ./opendbc/*, ./opendbc_repo/*, ./rednose/*, ./rednose_repo/*, ./teleoprtc/*, ./teleoprtc_repo/*, ./selfdrive/ui/translations/*.ts, uv.lock, *.onnx, ./cereal/gen/*, */c_generated_code/*"

@ -12,6 +12,8 @@ from panda.python.uds import SERVICE_TYPE
from openpilot.selfdrive.car.docs_definitions import CarDocs from openpilot.selfdrive.car.docs_definitions import CarDocs
from openpilot.selfdrive.car.helpers import clip, interp from openpilot.selfdrive.car.helpers import clip, interp
CanMsgType = tuple[int, bytes, int]
# set up logging # set up logging
carlog = logging.getLogger('carlog') carlog = logging.getLogger('carlog')
carlog.setLevel(logging.INFO) carlog.setLevel(logging.INFO)
@ -193,7 +195,7 @@ def get_friction(lateral_accel_error: float, lateral_accel_deadzone: float, fric
return friction return friction
def make_can_msg(addr: int, dat: bytes, bus: int) -> tuple[int, bytes, int]: def make_can_msg(addr: int, dat: bytes, bus: int) -> CanMsgType:
return addr, dat, bus return addr, dat, bus

@ -13,7 +13,7 @@ from openpilot.common.params import Params
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper
from openpilot.common.swaglog import cloudlog, ForwardingHandler from openpilot.common.swaglog import cloudlog, ForwardingHandler
from openpilot.selfdrive.pandad import can_list_to_can_capnp, can_capnp_to_list from openpilot.selfdrive.pandad import can_capnp_to_list, can_list_to_can_capnp
from openpilot.selfdrive.car import DT_CTRL, carlog from openpilot.selfdrive.car import DT_CTRL, carlog
from openpilot.selfdrive.car.can_definitions import CanData, CanSendCallable from openpilot.selfdrive.car.can_definitions import CanData, CanSendCallable
from openpilot.selfdrive.car.fw_versions import ObdCallback from openpilot.selfdrive.car.fw_versions import ObdCallback

@ -12,7 +12,8 @@ from functools import cache
from cereal import car from cereal import car
from openpilot.common.basedir import BASEDIR from openpilot.common.basedir import BASEDIR
from openpilot.common.simple_kalman import KF1D, get_kalman_gain from openpilot.common.simple_kalman import KF1D, get_kalman_gain
from openpilot.selfdrive.car import DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, get_friction, STD_CARGO_KG from openpilot.selfdrive.car import CanMsgType, DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, get_friction, \
STD_CARGO_KG
from openpilot.selfdrive.car.can_definitions import CanSendCallable from openpilot.selfdrive.car.can_definitions import CanSendCallable
from openpilot.selfdrive.car.conversions import Conversions as CV from openpilot.selfdrive.car.conversions import Conversions as CV
from openpilot.selfdrive.car.helpers import clip from openpilot.selfdrive.car.helpers import clip
@ -53,7 +54,6 @@ class LatControlInputs(NamedTuple):
aego: float aego: float
SendCan = tuple[int, bytes, int]
TorqueFromLateralAccelCallbackType = Callable[[LatControlInputs, car.CarParams.LateralTorqueTuning, float, float, bool, bool], float] TorqueFromLateralAccelCallbackType = Callable[[LatControlInputs, car.CarParams.LateralTorqueTuning, float, float, bool, bool], float]
@ -110,7 +110,7 @@ class CarInterfaceBase(ABC):
dbc_name = "" if self.cp is None else self.cp.dbc_name dbc_name = "" if self.cp is None else self.cp.dbc_name
self.CC: CarControllerBase = CarController(dbc_name, CP) self.CC: CarControllerBase = CarController(dbc_name, CP)
def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[SendCan]]: def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsgType]]:
return self.CC.update(c, self.CS, now_nanos) return self.CC.update(c, self.CS, now_nanos)
@staticmethod @staticmethod
@ -230,7 +230,7 @@ class CarInterfaceBase(ABC):
def _update(self, c: car.CarControl) -> car.CarState: def _update(self, c: car.CarControl) -> car.CarState:
pass pass
def update(self, c: car.CarControl, can_packets: list[int, list[int, bytes, int]]) -> car.CarState: def update(self, c: car.CarControl, can_packets: list[tuple[int, list[CanMsgType]]]) -> car.CarState:
# parse can # parse can
for cp in self.can_parsers: for cp in self.can_parsers:
if cp is not None: if cp is not None:
@ -469,7 +469,7 @@ class CarControllerBase(ABC):
self.frame = 0 self.frame = 0
@abstractmethod @abstractmethod
def update(self, CC: car.CarControl.Actuators, CS: car.CarState, now_nanos: int) -> tuple[car.CarControl.Actuators, list[SendCan]]: def update(self, CC: car.CarControl.Actuators, CS: car.CarState, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsgType]]:
pass pass

@ -3,7 +3,7 @@ from collections import defaultdict
from functools import partial from functools import partial
from types import SimpleNamespace from types import SimpleNamespace
from openpilot.selfdrive.car import carlog from openpilot.selfdrive.car import carlog, CanMsgType
from openpilot.selfdrive.car.can_definitions import CanSendCallable from openpilot.selfdrive.car.can_definitions import CanSendCallable
from openpilot.selfdrive.car.fw_query_definitions import AddrType from openpilot.selfdrive.car.fw_query_definitions import AddrType
from panda.python.uds import CanClient, IsoTpMessage, FUNCTIONAL_ADDRS, get_rx_addr_for_tx_addr from panda.python.uds import CanClient, IsoTpMessage, FUNCTIONAL_ADDRS, get_rx_addr_for_tx_addr
@ -27,7 +27,7 @@ class IsoTpParallelQuery:
assert tx_addr not in FUNCTIONAL_ADDRS, f"Functional address should be defined in functional_addrs: {hex(tx_addr)}" assert tx_addr not in FUNCTIONAL_ADDRS, f"Functional address should be defined in functional_addrs: {hex(tx_addr)}"
self.msg_addrs = {tx_addr: get_rx_addr_for_tx_addr(tx_addr[0], rx_offset=response_offset) for tx_addr in real_addrs} self.msg_addrs = {tx_addr: get_rx_addr_for_tx_addr(tx_addr[0], rx_offset=response_offset) for tx_addr in real_addrs}
self.msg_buffer: dict[int, list[tuple[int, bytes, int]]] = defaultdict(list) self.msg_buffer: dict[int, list[CanMsgType]] = defaultdict(list)
def rx(self): def rx(self):
"""Drain can socket and sort messages into buffers based on address""" """Drain can socket and sort messages into buffers based on address"""

@ -50,7 +50,7 @@ def can_capnp_to_list(strings, msgtype='can'):
cdef vector[CanData].iterator it = data.begin() cdef vector[CanData].iterator it = data.begin()
while it != data.end(): while it != data.end():
d = &deref(it) d = &deref(it)
frames = [[f.address, (<char *>&f.dat[0])[:f.dat.size()], f.src] for f in d.frames] frames = [(f.address, (<char *>&f.dat[0])[:f.dat.size()], f.src) for f in d.frames]
result.append([d.nanos, frames]) result.append((d.nanos, frames))
preinc(it) preinc(it)
return result return result

Loading…
Cancel
Save