From 0c9f1d8118081d90d9f867448ccf1c2fcaa794eb Mon Sep 17 00:00:00 2001 From: pantew869 Date: Wed, 26 Jun 2024 20:47:25 +0300 Subject: [PATCH 1/9] Bring back macOS CI (#32819) * Attempt to enable macos CI * add SKIP_PROMPT * test * add python warnings env variable * pull from lfs * use v4 checkout * Update selfdrive_tests.yaml --------- Co-authored-by: Maxime Desroches --- .github/workflows/selfdrive_tests.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index ea591cbf47a267..b042ae04350c25 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -86,6 +86,23 @@ jobs: docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }} - uses: ./.github/workflows/compile-openpilot timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 15 || 30) }} # allow more time when we missed the scons cache + + build_mac: + name: build macos + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - run: git lfs pull + - name: Install dependencies + run: ./tools/mac_setup.sh + env: + SKIP_PROMPT: 1 + # package install has DeprecationWarnings + PYTHONWARNINGS: default + - name: Test openpilot environment + run: poetry run scons -h static_analysis: name: static analysis From a256898510e5592b08db14e27e0abbe9fe802c8e Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Thu, 27 Jun 2024 02:40:24 +0800 Subject: [PATCH 2/9] cereal: remove messaging/.gitignore (#32839) cleanup gitignore --- .gitignore | 1 + cereal/messaging/.gitignore | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 cereal/messaging/.gitignore diff --git a/.gitignore b/.gitignore index f067893c77ed9c..ac61591bfd49c9 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ persist selfdrive/pandad/pandad cereal/services.h cereal/gen +cereal/messaging/bridge selfdrive/logcatd/logcatd selfdrive/mapd/default_speeds_by_region.json system/proclogd/proclogd diff --git a/cereal/messaging/.gitignore b/cereal/messaging/.gitignore deleted file mode 100644 index dbbe8e22aee488..00000000000000 --- a/cereal/messaging/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -demo -bridge -test_runner -*.o -*.os -*.d -*.a -*.so -messaging_pyx.cpp -build/ From 4c04ae9a59a8e9e4dadec9933b99182982125206 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Thu, 27 Jun 2024 02:52:11 +0800 Subject: [PATCH 3/9] ui/installer: hardcode SSH Keys in installer.cc (#32838) hardcode keys --- selfdrive/ui/SConscript | 4 ---- selfdrive/ui/installer/installer.cc | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index 8b268b9e84878b..9046ecc2280470 100644 --- a/selfdrive/ui/SConscript +++ b/selfdrive/ui/SConscript @@ -106,10 +106,6 @@ if GetOption('extras') and arch != "Darwin": if "internal" in name: d['INTERNAL'] = "1" - import requests - r = requests.get("https://github.com/commaci2.keys") - r.raise_for_status() - d['SSH_KEYS'] = f'\\"{r.text.strip()}\\"' obj = senv.Object(f"installer/installers/installer_{name}.o", ["installer/installer.cc"], CPPDEFINES=d) f = senv.Program(f"installer/installers/installer_{name}", [obj, cont], LIBS=qt_libs) # keep installers small diff --git a/selfdrive/ui/installer/installer.cc b/selfdrive/ui/installer/installer.cc index d43ed37ae8aa92..17f6ba19abd08f 100644 --- a/selfdrive/ui/installer/installer.cc +++ b/selfdrive/ui/installer/installer.cc @@ -180,10 +180,12 @@ void Installer::cloneFinished(int exitCode, QProcess::ExitStatus exitStatus) { #ifdef INTERNAL run("mkdir -p /data/params/d/"); + // https://github.com/commaci2.keys + const std::string ssh_keys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMX2kU8eBZyEWmbq0tjMPxksWWVuIV/5l64GabcYbdpI"; std::map params = { {"SshEnabled", "1"}, {"RecordFrontLock", "1"}, - {"GithubSshKeys", SSH_KEYS}, + {"GithubSshKeys", ssh_keys}, }; for (const auto& [key, value] : params) { std::ofstream param; From fccba867a97a0150b572550e44f62ae22f8079c1 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Thu, 27 Jun 2024 02:52:36 +0800 Subject: [PATCH 4/9] cereal: use nanos_since_boot() from common/timing.h (#32840) Use nanos_since_boot() from common/timing.h --- cereal/messaging/messaging.h | 14 ++------------ cereal/messaging/socketmaster.cc | 8 -------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/cereal/messaging/messaging.h b/cereal/messaging/messaging.h index f3850130e655e2..fb9c261f2b57ea 100644 --- a/cereal/messaging/messaging.h +++ b/cereal/messaging/messaging.h @@ -5,20 +5,13 @@ #include #include #include -#include #include #include "cereal/gen/cpp/log.capnp.h" +#include "common/timing.h" #include "msgq/ipc.h" -#ifdef __APPLE__ -#define CLOCK_BOOTTIME CLOCK_MONOTONIC -#endif - -#define MSG_MULTIPLE_PUBLISHERS 100 - - class SubMaster { public: SubMaster(const std::vector &service_list, const std::vector &poll = {}, @@ -53,10 +46,7 @@ class MessageBuilder : public capnp::MallocMessageBuilder { cereal::Event::Builder initEvent(bool valid = true) { cereal::Event::Builder event = initRoot(); - struct timespec t; - clock_gettime(CLOCK_BOOTTIME, &t); - uint64_t current_time = t.tv_sec * 1000000000ULL + t.tv_nsec; - event.setLogMonoTime(current_time); + event.setLogMonoTime(nanos_since_boot()); event.setValid(valid); return event; } diff --git a/cereal/messaging/socketmaster.cc b/cereal/messaging/socketmaster.cc index cd697b1f51ed20..38b9842414ebb1 100644 --- a/cereal/messaging/socketmaster.cc +++ b/cereal/messaging/socketmaster.cc @@ -1,4 +1,3 @@ -#include #include #include #include @@ -7,15 +6,8 @@ #include "cereal/services.h" #include "cereal/messaging/messaging.h" - const bool SIMULATION = (getenv("SIMULATION") != nullptr) && (std::string(getenv("SIMULATION")) == "1"); -static inline uint64_t nanos_since_boot() { - struct timespec t; - clock_gettime(CLOCK_BOOTTIME, &t); - return t.tv_sec * 1000000000ULL + t.tv_nsec; -} - static inline bool inList(const std::vector &list, const char *value) { for (auto &v : list) { if (strcmp(value, v) == 0) return true; From 046ed7e9f8c69423c25e15f97bfd5783734dc551 Mon Sep 17 00:00:00 2001 From: James <91348155+FrogAi@users.noreply.github.com> Date: Wed, 26 Jun 2024 14:51:27 -0700 Subject: [PATCH 5/9] Cleanup "longitudinalPlan" fields (#32845) --- selfdrive/controls/lib/longitudinal_planner.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/selfdrive/controls/lib/longitudinal_planner.py b/selfdrive/controls/lib/longitudinal_planner.py index 00b4e243b4b9ef..c59955d551ed97 100755 --- a/selfdrive/controls/lib/longitudinal_planner.py +++ b/selfdrive/controls/lib/longitudinal_planner.py @@ -159,15 +159,11 @@ def publish(self, sm, pm): plan_send.valid = sm.all_checks(service_list=['carState', 'controlsState']) - longitudinalPlan = plan_send.longitudinalPlan longitudinalPlan.modelMonoTime = sm.logMonoTime['modelV2'] longitudinalPlan.processingDelay = (plan_send.logMonoTime / 1e9) - sm.logMonoTime['modelV2'] longitudinalPlan.solverExecutionTime = self.mpc.solve_time - longitudinalPlan.allowBrake = True - longitudinalPlan.allowThrottle = True - longitudinalPlan.speeds = self.v_desired_trajectory.tolist() longitudinalPlan.accels = self.a_desired_trajectory.tolist() longitudinalPlan.jerks = self.j_desired_trajectory.tolist() From 84725738c8fd429263474da424e96134bdeef367 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 26 Jun 2024 17:13:55 -0800 Subject: [PATCH 6/9] Hyundai: Add FW Versions for EU Ioniq 5 2023 (#32833) --- selfdrive/car/hyundai/fingerprints.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/hyundai/fingerprints.py b/selfdrive/car/hyundai/fingerprints.py index 8db0849cb2e751..e33f3e415ec2cf 100644 --- a/selfdrive/car/hyundai/fingerprints.py +++ b/selfdrive/car/hyundai/fingerprints.py @@ -1001,6 +1001,7 @@ b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.03 99211-GI010 220401', b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.05 99211-GI010 220614', b'\xf1\x00NE1 MFC AT USA LHD 1.00 1.06 99211-GI010 230110', + b'\xf1\x00NE1 MFC AT EUR LHD 1.00 1.01 99211-GI100 240110', ], }, CAR.HYUNDAI_IONIQ_6: { From fb6d44797a48f730eac1a380644f338f7249510c Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Wed, 26 Jun 2024 18:33:07 -0700 Subject: [PATCH 7/9] bump panda --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 7287ff0cbf3ab4..376408bb4f6706 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 7287ff0cbf3ab405a670405f2faca419d524387d +Subproject commit 376408bb4f6706b682eb6d607bedd14958665084 From b7695c00e87819dd6aac49cfec78e438dfc15d16 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 26 Jun 2024 21:27:10 -0700 Subject: [PATCH 8/9] GM torque control: robust sig function (#32847) tricky --- selfdrive/car/gm/interface.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 5ea2b198916d2b..d088050482a351 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -53,7 +53,12 @@ def torque_from_lateral_accel_siglin(self, latcontrol_inputs: LatControlInputs, friction = get_friction(lateral_accel_error, lateral_accel_deadzone, FRICTION_THRESHOLD, torque_params, friction_compensation) def sig(val): - return 1 / (1 + exp(-val)) - 0.5 + # https://timvieira.github.io/blog/post/2014/02/11/exp-normalize-trick + if val >= 0: + return 1 / (1 + exp(-val)) - 0.5 + else: + z = exp(val) + return z / (1 + z) - 0.5 # The "lat_accel vs torque" relationship is assumed to be the sum of "sigmoid + linear" curves # An important thing to consider is that the slope at 0 should be > 0 (ideally >1) From 504dd4543dd7fd6c466817faa82cda42b6b55542 Mon Sep 17 00:00:00 2001 From: StefanLekanic-SYRMIA <156184842+StefanLekanic-SYRMIA@users.noreply.github.com> Date: Thu, 27 Jun 2024 06:15:13 +0100 Subject: [PATCH 9/9] LogReader: print number of missing rlogs (#32830) * count rlogs * minimization changes * cache to avoid duplicate checks * no real point in checking qlogs to just show the warning --------- Co-authored-by: Shane Smiskol --- tools/lib/logreader.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/lib/logreader.py b/tools/lib/logreader.py index 98c10941bb96a1..f6932c029aeb43 100755 --- a/tools/lib/logreader.py +++ b/tools/lib/logreader.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import bz2 -from functools import partial +from functools import cache, partial import multiprocessing import capnp import enum @@ -87,18 +87,21 @@ class ReadMode(enum.StrEnum): InternalUnavailableException = Exception("Internal source not available") + +@cache def default_valid_file(fn: LogPath) -> bool: return fn is not None and file_exists(fn) def auto_strategy(rlog_paths: LogPaths, qlog_paths: LogPaths, interactive: bool, valid_file: ValidFileCallable) -> LogPaths: # auto select logs based on availability - if any(rlog is None or not valid_file(rlog) for rlog in rlog_paths) and all(qlog is not None and valid_file(qlog) for qlog in qlog_paths): + missing_rlogs = [rlog is None or not valid_file(rlog) for rlog in rlog_paths].count(True) + if missing_rlogs != 0: if interactive: - if input("Some rlogs were not found, would you like to fallback to qlogs for those segments? (y/n) ").lower() != "y": + if input(f"{missing_rlogs} rlogs were not found, would you like to fallback to qlogs for those segments? (y/n) ").lower() != "y": return rlog_paths else: - cloudlog.warning("Some rlogs were not found, falling back to qlogs for those segments...") + cloudlog.warning(f"{missing_rlogs} rlogs were not found, falling back to qlogs for those segments...") return [rlog if valid_file(rlog) else (qlog if valid_file(qlog) else None) for (rlog, qlog) in zip(rlog_paths, qlog_paths, strict=True)]