From 284206878d6184747b1e1af03f91ac9e718ff326 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 1 May 2024 11:32:04 -0700 Subject: [PATCH 01/10] deprecate unused gpsMalfunction --- car.capnp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/car.capnp b/car.capnp index 78ef79e..1a0defb 100644 --- a/car.capnp +++ b/car.capnp @@ -96,7 +96,6 @@ struct CarEvent @0x9b1657f34caf3ad3 { fanMalfunction @91; cameraMalfunction @92; cameraFrameRate @110; - gpsMalfunction @94; processNotRunning @95; dashcamMode @96; controlsInitializing @98; @@ -142,6 +141,7 @@ struct CarEvent @0x9b1657f34caf3ad3 { noTargetDEPRECATED @25; brakeUnavailableDEPRECATED @2; plannerErrorDEPRECATED @32; + gpsMalfunctionDEPRECATED @94; } } From 84af7ef6654b2e810a2871b8ddd27ad170696599 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 1 May 2024 15:04:09 -0700 Subject: [PATCH 02/10] no pyenv --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94f9768..d2e3ab5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,8 +35,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ zlib1g-dev \ && rm -rf /var/lib/apt/lists/* -RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash -ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}" RUN pip3 install --break-system-packages --no-cache-dir pyyaml Cython scons pycapnp pre-commit ruff parameterized coverage numpy WORKDIR /project/ From 181b550e301c21b8269756c4b5656240b895a808 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 8 May 2024 13:54:29 -0700 Subject: [PATCH 03/10] run pre-commit autoupdate monthly --- .github/workflows/repo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index 5c12fd9..4c4a7c4 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -2,7 +2,7 @@ name: repo on: schedule: - - cron: "0 15 * * 2" + - cron: "0 15 1 * *" workflow_dispatch: jobs: From 4e6d2225267a29ee733af8c9f32aa6a9bbc20fab Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 11 May 2024 12:02:53 -0700 Subject: [PATCH 04/10] this shouldn't be used directly --- services.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services.py b/services.py index ce35759..22c0352 100755 --- a/services.py +++ b/services.py @@ -18,7 +18,7 @@ class Service: self.decimation = decimation -services: dict[str, tuple] = { +_services: dict[str, tuple] = { # service: (should_log, frequency, qlog decimation (optional)) # note: the "EncodeIdx" packets will still be in the log "gyroscope": (True, 104., 104), @@ -98,7 +98,7 @@ services: dict[str, tuple] = { "customReservedRawData2": (True, 0.), } SERVICE_LIST = {name: Service(new_port(idx), *vals) for - idx, (name, vals) in enumerate(services.items())} + idx, (name, vals) in enumerate(_services.items())} def build_header(): From 16cc134f607c53aea9bcf89595fe0ab34abc833b Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 11 May 2024 13:10:41 -0700 Subject: [PATCH 05/10] pre-commit: autoupdate hooks (#605) Update pre-commit hook versions Co-authored-by: adeebshihadeh --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cebce11..03360e0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-ast - id: check-yaml @@ -11,7 +11,7 @@ repos: hooks: - id: mypy - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.3 + rev: v0.3.5 hooks: - id: ruff - repo: local From 591e389bf8e31f6f6ab921ec6598cafa53c19d36 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 12 May 2024 14:19:45 -0700 Subject: [PATCH 06/10] cleaup duplicated loop --- messaging/__init__.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/messaging/__init__.py b/messaging/__init__.py index ddc0866..cc138a0 100644 --- a/messaging/__init__.py +++ b/messaging/__init__.py @@ -93,20 +93,8 @@ def drain_sock_raw(sock: SubSocket, wait_for_one: bool = False) -> List[bytes]: def drain_sock(sock: SubSocket, wait_for_one: bool = False) -> List[capnp.lib.capnp._DynamicStructReader]: """Receive all message currently available on the queue""" - ret: List[capnp.lib.capnp._DynamicStructReader] = [] - while 1: - if wait_for_one and len(ret) == 0: - dat = sock.receive() - else: - dat = sock.receive(non_blocking=True) - - if dat is None: # Timeout hit - break - - dat = log_from_bytes(dat) - ret.append(dat) - - return ret + msgs = drain_sock_raw(sock, wait_for_one=wait_for_one) + return [log_from_bytes(m) for m in msgs] # TODO: print when we drop packets? From 0f84611bc72fac97f33cd6953f2f20110d162b3b Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Sun, 19 May 2024 01:34:21 +0100 Subject: [PATCH 07/10] add actuatorsApiUnavailable event (#611) --- car.capnp | 1 + 1 file changed, 1 insertion(+) diff --git a/car.capnp b/car.capnp index 1a0defb..a241680 100644 --- a/car.capnp +++ b/car.capnp @@ -115,6 +115,7 @@ struct CarEvent @0x9b1657f34caf3ad3 { locationdPermanentError @118; paramsdTemporaryError @50; paramsdPermanentError @119; + actuatorsApiUnavailable @120; radarCanErrorDEPRECATED @15; communityFeatureDisallowedDEPRECATED @62; From 0a9b426e55653daea6cc9d3c40c3f7600ec0db49 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 18 May 2024 17:35:23 -0700 Subject: [PATCH 08/10] add encoding type to thumbnail (#607) * encoding * fix * Update log.capnp --- log.capnp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/log.capnp b/log.capnp index 1b7c982..ff699c5 100644 --- a/log.capnp +++ b/log.capnp @@ -198,6 +198,13 @@ struct Thumbnail { frameId @0 :UInt32; timestampEof @1 :UInt64; thumbnail @2 :Data; + encoding @3 :Encoding; + + enum Encoding { + unknown @0; + jpeg @1; + keyframe @2; + } } struct GPSNMEAData { From 5812f2c075a5364cecafe4e8ed68a12b12a5631f Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 21 May 2024 02:12:17 -0500 Subject: [PATCH 09/10] card fields (#610) * deprecate carOutput, add some fields * Revert "deprecate carOutput, add some fields" This reverts commit 247a1c59732aa2b3918b860bc17520613fae5fe9. * add fields back * canRcvTimeout is bool * add vCruise * enableRequested * rm * rm init, deprecate --- car.capnp | 5 +++++ log.capnp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/car.capnp b/car.capnp index a241680..d7ec1b2 100644 --- a/car.capnp +++ b/car.capnp @@ -155,6 +155,8 @@ struct CarState { # CAN health canValid @26 :Bool; # invalid counter/checksums canTimeout @40 :Bool; # CAN bus dropped out + canErrorCounter @48 :UInt32; + canRcvTimeout @49 :Bool; # car speed vEgo @1 :Float32; # best estimate of speed @@ -220,6 +222,9 @@ struct CarState { fuelGauge @41 :Float32; # battery or fuel tank level from 0.0 to 1.0 charging @43 :Bool; + # process meta + cumLagMs @50 :Float32; + struct WheelSpeeds { # optional wheel speeds fl @0 :Float32; diff --git a/log.capnp b/log.capnp index ff699c5..269a224 100644 --- a/log.capnp +++ b/log.capnp @@ -720,7 +720,6 @@ struct ControlsState @0x97ff69c53601abf1 { engageable @41 :Bool; # can OP be engaged? cumLagMs @15 :Float32; - canErrorCounter @57 :UInt32; lateralControlState :union { indiState @52 :LateralINDIState; @@ -865,6 +864,7 @@ struct ControlsState @0x97ff69c53601abf1 { steeringAngleDesiredDegDEPRECATED @29 :Float32; canMonoTimesDEPRECATED @21 :List(UInt64); desiredCurvatureRateDEPRECATED @62 :Float32; + canErrorCounterDEPRECATED @57 :UInt32; } # All SI units and in device frame From 51cbf6294efb356347b2c18b3df9904d11a7ff43 Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Tue, 21 May 2024 23:00:43 -0700 Subject: [PATCH 10/10] Submaster (python): set alive when first seen for simulation=1 (#613) * now should be the same as cc * need updated * clear about redefine --- messaging/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/messaging/__init__.py b/messaging/__init__.py index cc138a0..a2695bd 100644 --- a/messaging/__init__.py +++ b/messaging/__init__.py @@ -168,9 +168,8 @@ class SubMaster: self.ignore_average_freq = [] if ignore_avg_freq is None else ignore_avg_freq self.ignore_alive = [] if ignore_alive is None else ignore_alive self.ignore_valid = [] if ignore_valid is None else ignore_valid - if bool(int(os.getenv("SIMULATION", "0"))): - self.ignore_alive = services - self.ignore_average_freq = services + + self.simulation = bool(int(os.getenv("SIMULATION", "0"))) # if freq and poll aren't specified, assume the max to be conservative assert frequency is None or poll is None, "Do not specify 'frequency' - frequency of the polled service will be used." @@ -241,7 +240,7 @@ class SubMaster: self.valid[s] = msg.valid for s in self.data: - if SERVICE_LIST[s].frequency > 1e-5: + if SERVICE_LIST[s].frequency > 1e-5 and not self.simulation: # alive if delay is within 10x the expected frequency self.alive[s] = (cur_time - self.recv_time[s]) < (10. / SERVICE_LIST[s].frequency) @@ -261,7 +260,10 @@ class SubMaster: self.freq_ok[s] = avg_freq_ok or recent_freq_ok else: self.freq_ok[s] = True - self.alive[s] = True + if self.simulation: + self.alive[s] = self.seen[s] # alive is defined as seen when simulation flag set + else: + self.alive[s] = True def all_alive(self, service_list: Optional[List[str]] = None) -> bool: if service_list is None: