From 5d668701cb69c1e3d170109a8e788a2acbacebd3 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 14 Dec 2023 16:59:28 -0800 Subject: [PATCH 01/17] CI: move test_maprenderer to GH actions (#30610) maprenderer to ci --- .github/workflows/badges.yaml | 2 +- .github/workflows/docs.yaml | 2 +- .github/workflows/selfdrive_tests.yaml | 8 +++--- .github/workflows/tools_tests.yaml | 4 +-- Jenkinsfile | 1 - pyproject.toml | 1 + selfdrive/navd/tests/test_map_renderer.py | 31 +++++++++++++---------- selfdrive/test/setup_xvfb.sh | 15 +++++++++++ 8 files changed, 43 insertions(+), 21 deletions(-) create mode 100755 selfdrive/test/setup_xvfb.sh diff --git a/.github/workflows/badges.yaml b/.github/workflows/badges.yaml index c19be4c563..923e249849 100644 --- a/.github/workflows/badges.yaml +++ b/.github/workflows/badges.yaml @@ -7,7 +7,7 @@ on: env: BASE_IMAGE: openpilot-base DOCKER_REGISTRY: ghcr.io/commaai - RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $DOCKER_REGISTRY/$BASE_IMAGE:latest /bin/sh -c + RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $DOCKER_REGISTRY/$BASE_IMAGE:latest /bin/bash -c jobs: badges: diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index c1d4eae52f..6ad273a14d 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -15,7 +15,7 @@ env: BUILD: selfdrive/test/docker_build.sh base - RUN: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/sh -c + RUN: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c jobs: docs: diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index c47947f90d..708f16368f 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -20,11 +20,11 @@ env: DOCKER_LOGIN: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} BUILD: selfdrive/test/docker_build.sh base - RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/sh -c + RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c BUILD_CL: selfdrive/test/docker_build.sh cl - RUN_CL: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/sh -c + RUN_CL: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/bash -c PYTEST: pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append --durations=0 --durations-min=5 --hypothesis-seed 0 @@ -175,7 +175,9 @@ jobs: - name: Run unit tests timeout-minutes: 15 run: | - ${{ env.RUN }} "$PYTEST --timeout 30 -m 'not slow' && \ + ${{ env.RUN }} "source selfdrive/test/setup_xvfb.sh && \ + export MAPBOX_TOKEN='pk.eyJ1Ijoiam5ld2IiLCJhIjoiY2xxNW8zZXprMGw1ZzJwbzZneHd2NHljbSJ9.gV7VPRfbXFetD-1OVF0XZg' && \ + $PYTEST --timeout 30 -m 'not slow' && \ ./selfdrive/ui/tests/create_test_translations.sh && \ QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \ ./selfdrive/ui/tests/test_translations.py && \ diff --git a/.github/workflows/tools_tests.yaml b/.github/workflows/tools_tests.yaml index 75a34b3c55..d564606c3e 100644 --- a/.github/workflows/tools_tests.yaml +++ b/.github/workflows/tools_tests.yaml @@ -17,11 +17,11 @@ env: BUILD: selfdrive/test/docker_build.sh base - RUN: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/sh -c + RUN: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c BUILD_CL: selfdrive/test/docker_build.sh cl - RUN_CL: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/sh -c + RUN_CL: docker run --shm-size 1G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/bash -c jobs: diff --git a/Jenkinsfile b/Jenkinsfile index 2118c4c4ed..926a9bbfc8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -187,7 +187,6 @@ node { ["test encoder", "LD_LIBRARY_PATH=/usr/local/lib pytest system/loggerd/tests/test_encoder.py"], ["test pigeond", "pytest system/sensord/tests/test_pigeond.py"], ["test manager", "pytest selfdrive/manager/test/test_manager.py"], - ["test nav", "pytest selfdrive/navd/tests/"], ]) }, 'loopback': { diff --git a/pyproject.toml b/pyproject.toml index 58c506e378..07cf9a2233 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ testpaths = [ "selfdrive/controls", "selfdrive/locationd", "selfdrive/monitoring", + "selfdrive/navd/tests", "selfdrive/thermald", "selfdrive/test/longitudinal_maneuvers", "system/hardware/tici", diff --git a/selfdrive/navd/tests/test_map_renderer.py b/selfdrive/navd/tests/test_map_renderer.py index dbd6add995..d336ffb651 100755 --- a/selfdrive/navd/tests/test_map_renderer.py +++ b/selfdrive/navd/tests/test_map_renderer.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import time import numpy as np import os import pytest @@ -10,7 +11,7 @@ import cereal.messaging as messaging from typing import Any from cereal.visionipc import VisionIpcClient, VisionStreamType -from openpilot.selfdrive.manager.process_config import managed_processes +from openpilot.selfdrive.test.helpers import with_processes LLK_DECIMATION = 10 CACHE_PATH = "/data/mbgl-cache-navd.db" @@ -18,7 +19,8 @@ CACHE_PATH = "/data/mbgl-cache-navd.db" LOCATION1 = (32.7174, -117.16277) LOCATION2 = (32.7558, -117.2037) -DEFAULT_ITERATIONS = 30 * LLK_DECIMATION +RENDER_FRAMES = 15 +DEFAULT_ITERATIONS = RENDER_FRAMES * LLK_DECIMATION LOCATION1_REPEATED = [LOCATION1] * DEFAULT_ITERATIONS LOCATION2_REPEATED = [LOCATION2] * DEFAULT_ITERATIONS @@ -60,7 +62,8 @@ class MapBoxInternetDisabledRequestHandler(http.server.BaseHTTPRequestHandler): class MapBoxInternetDisabledServer(threading.Thread): def run(self): - self.server = http.server.HTTPServer(("127.0.0.1", 5000), MapBoxInternetDisabledRequestHandler) + self.server = http.server.HTTPServer(("127.0.0.1", 0), MapBoxInternetDisabledRequestHandler) + self.port = self.server.server_port self.server.serve_forever() def stop(self): @@ -74,13 +77,15 @@ class MapBoxInternetDisabledServer(threading.Thread): class TestMapRenderer(unittest.TestCase): - server = MapBoxInternetDisabledServer() + server: MapBoxInternetDisabledServer @classmethod def setUpClass(cls): assert "MAPBOX_TOKEN" in os.environ cls.original_token = os.environ["MAPBOX_TOKEN"] + cls.server = MapBoxInternetDisabledServer() cls.server.start() + time.sleep(0.5) # wait for server to startup @classmethod def tearDownClass(cls) -> None: @@ -88,7 +93,7 @@ class TestMapRenderer(unittest.TestCase): def setUp(self): self.server.enable_internet() - os.environ['MAPS_HOST'] = 'http://localhost:5000' + os.environ['MAPS_HOST'] = f'http://localhost:{self.server.port}' self.sm = messaging.SubMaster(['mapRenderState']) self.pm = messaging.PubMaster(['liveLocationKalman']) @@ -97,15 +102,11 @@ class TestMapRenderer(unittest.TestCase): if os.path.exists(CACHE_PATH): os.remove(CACHE_PATH) - def tearDown(self): - managed_processes['mapsd'].stop() - def _setup_test(self): - # start + sync up - managed_processes['mapsd'].start() - assert self.pm.wait_for_readers_to_update("liveLocationKalman", 10) + time.sleep(0.5) + assert VisionIpcClient.available_streams("navd", False) == {VisionStreamType.VISION_STREAM_MAP, } assert self.vipc.connect(False) self.vipc.recv() @@ -164,17 +165,22 @@ class TestMapRenderer(unittest.TestCase): assert self.vipc.timestamp_sof == llk.logMonoTime assert self.vipc.frame_id == self.sm['mapRenderState'].frameId + assert frames_since_test_start >= RENDER_FRAMES + return render_times + @with_processes(["mapsd"]) def test_with_internet(self): self._setup_test() self._run_test(True) + @with_processes(["mapsd"]) def test_with_no_internet(self): self.server.disable_internet() self._setup_test() self._run_test(False) + @with_processes(["mapsd"]) def test_recover_from_no_internet(self): self._setup_test() self._run_test(True) @@ -187,8 +193,7 @@ class TestMapRenderer(unittest.TestCase): self.server.enable_internet() self._run_test(True, LOCATION2_REPEATED) - self._run_test(True, LOCATION2_REPEATED) - + @with_processes(["mapsd"]) @pytest.mark.tici def test_render_time_distribution(self): self._setup_test() diff --git a/selfdrive/test/setup_xvfb.sh b/selfdrive/test/setup_xvfb.sh new file mode 100755 index 0000000000..2c79adec4a --- /dev/null +++ b/selfdrive/test/setup_xvfb.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Sets up a virtual display for running map renderer and simulator without an X11 display + +DISP_ID=99 +export DISPLAY=:$DISP_ID + +sudo Xvfb $DISPLAY -screen 0 2160x1080x24 & + +# check for x11 socket for the specified display ID +while [ ! -S /tmp/.X11-unix/X$DISP_ID ] +do + echo "Waiting for Xvfb..." + sleep 1 +done \ No newline at end of file From 23c20bce8f90aabec31fece84f4f8f6a3770d61b Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 14 Dec 2023 17:24:47 -0800 Subject: [PATCH 02/17] test_athena: remove slow memory leak test (#30734) way too long --- selfdrive/athena/tests/test_athenad.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/selfdrive/athena/tests/test_athenad.py b/selfdrive/athena/tests/test_athenad.py index beffa0d232..a562ae8582 100755 --- a/selfdrive/athena/tests/test_athenad.py +++ b/selfdrive/athena/tests/test_athenad.py @@ -13,7 +13,6 @@ from datetime import datetime, timedelta from parameterized import parameterized from typing import Optional -from pympler.tracker import SummaryTracker from unittest import mock from websocket import ABNF from websocket._exceptions import WebSocketConnectionClosedException @@ -144,11 +143,6 @@ class TestAthenadMethods(unittest.TestCase): # random bytes to ensure rather large object post-compression fn = self._create_file('qlog', data=os.urandom(10000 * 1024)) - # warm up object tracker - tracker = SummaryTracker() - for _ in range(5): - tracker.diff() - upload_fn = fn + ('.bz2' if compress else '') item = athenad.UploadItem(path=upload_fn, url="http://localhost:1238", headers={}, created_at=int(time.time()*1000), id='') with self.assertRaises(requests.exceptions.ConnectionError): @@ -158,11 +152,6 @@ class TestAthenadMethods(unittest.TestCase): resp = athenad._do_upload(item) self.assertEqual(resp.status_code, 201) - # assert memory cleaned up - for _type, num_objects, total_size in tracker.diff(): - with self.subTest(_type=_type): - self.assertLess(total_size / 1024, 10, f'Object {_type} ({num_objects=}) grew larger than 10 kB while uploading file') - @with_http_server def test_uploadFileToUrl(self, host): fn = self._create_file('qlog.bz2') From 977dd033c4b2003c06978eed391e744ed06ea8f9 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 14 Dec 2023 19:34:06 -0800 Subject: [PATCH 03/17] Simulator: fix safety param (#30738) fix param --- tools/sim/lib/simulated_car.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/sim/lib/simulated_car.py b/tools/sim/lib/simulated_car.py index 0740f9e3aa..85b4ac2387 100644 --- a/tools/sim/lib/simulated_car.py +++ b/tools/sim/lib/simulated_car.py @@ -5,6 +5,7 @@ from opendbc.can.parser import CANParser from openpilot.selfdrive.boardd.boardd_api_impl import can_list_to_can_capnp from openpilot.selfdrive.car import crc8_pedal from openpilot.tools.sim.lib.common import SimulatorState +from panda.python import Panda class SimulatedCar: @@ -106,7 +107,8 @@ class SimulatedCar: 'pandaType': "blackPanda", 'controlsAllowed': True, 'safetyModel': 'hondaNidec', - 'alternativeExperience': self.sm["carParams"].alternativeExperience + 'alternativeExperience': self.sm["carParams"].alternativeExperience, + 'safetyParam': Panda.FLAG_HONDA_GAS_INTERCEPTOR } self.pm.send('pandaStates', dat) From 303f1cf9cf2f0c933fca103f104b382523db6cf2 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 14 Dec 2023 19:59:16 -0800 Subject: [PATCH 04/17] jenkins: run test_onroad in the normal env (#30740) --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 926a9bbfc8..4c0976eb1b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -104,7 +104,7 @@ def pcStage(String stageName, Closure body) { def openpilot_base = retryWithDelay (3, 15) { return docker.build("openpilot-base:build-${env.GIT_COMMIT}", "-f Dockerfile.openpilot_base .") } - + openpilot_base.inside(dockerArgs) { timeout(time: 20, unit: 'MINUTES') { try { @@ -171,8 +171,9 @@ node { parallel ( // tici tests 'onroad tests': { - deviceStage("onroad", "tici-needs-can", ["SKIP_COPY=1"], [ - ["build master-ci", "cd $SOURCE_DIR/release && TARGET_DIR=$TEST_DIR $SOURCE_DIR/scripts/retry.sh ./build_devel.sh"], + deviceStage("onroad", "tici-needs-can", [], [ + // TODO: ideally, this test runs in master-ci, but it takes 5+m to build it + //["build master-ci", "cd $SOURCE_DIR/release && TARGET_DIR=$TEST_DIR $SOURCE_DIR/scripts/retry.sh ./build_devel.sh"], ["build openpilot", "cd selfdrive/manager && ./build.py"], ["check dirty", "release/check-dirty.sh"], ["onroad tests", "pytest selfdrive/test/test_onroad.py -s"], From 05d5056e8c9dff538b5a5be66022bf32c8995802 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 14 Dec 2023 23:36:33 -0500 Subject: [PATCH 05/17] car docs: remove outdated video link (#30737) remove outdated link --- docs/CARS.md | 2 +- selfdrive/car/hyundai/values.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/CARS.md b/docs/CARS.md index 113e7c877b..e48f4765bb 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -97,7 +97,7 @@ A supported vehicle is one that just works when you install a comma device. All |Hyundai|Kona Electric 2018-21|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai G connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Kona Electric 2022-23|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai O connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Kona Electric (with HDA II, Korea only) 2023[6](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai R connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| -|Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai I connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| +|Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai I connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Palisade 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai H connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Cruz 2022-23[6](#footnotes)|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai N connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Fe 2019-20|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai D connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index a8d7c06b9e..08611de790 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -191,8 +191,7 @@ CAR_INFO: Dict[str, Optional[Union[HyundaiCarInfo, List[HyundaiCarInfo]]]] = { CAR.KONA: HyundaiCarInfo("Hyundai Kona 2020", car_parts=CarParts.common([CarHarness.hyundai_b])), CAR.KONA_EV: HyundaiCarInfo("Hyundai Kona Electric 2018-21", car_parts=CarParts.common([CarHarness.hyundai_g])), CAR.KONA_EV_2022: HyundaiCarInfo("Hyundai Kona Electric 2022-23", car_parts=CarParts.common([CarHarness.hyundai_o])), - CAR.KONA_HEV: HyundaiCarInfo("Hyundai Kona Hybrid 2020", video_link="https://youtu.be/0dwpAHiZgFo", - car_parts=CarParts.common([CarHarness.hyundai_i])), # TODO: check packages + CAR.KONA_HEV: HyundaiCarInfo("Hyundai Kona Hybrid 2020", car_parts=CarParts.common([CarHarness.hyundai_i])), # TODO: check packages # TODO: this is the 2024 US MY, not yet released CAR.KONA_EV_2ND_GEN: HyundaiCarInfo("Hyundai Kona Electric (with HDA II, Korea only) 2023", video_link="https://www.youtube.com/watch?v=U2fOCmcQ8hw", car_parts=CarParts.common([CarHarness.hyundai_r])), From 2cad6dfa58f58af09ff70c70ad557fdf761b9293 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 14 Dec 2023 20:41:11 -0800 Subject: [PATCH 06/17] jenkins: only run pandad tests when paths change (#30741) * jenkins: only run pandad when paths changed * fix * ugh shadow --- Jenkinsfile | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4c0976eb1b..25649c4949 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,13 +67,14 @@ END""" } } -def deviceStage(String stageName, String deviceType, List env, def steps) { +def deviceStage(String stageName, String deviceType, List extra_env, def steps) { stage(stageName) { if (currentBuild.result != null) { return } - def extra = env.collect { "export ${it}" }.join('\n'); + def extra = extra_env.collect { "export ${it}" }.join('\n'); + def branch = env.BRANCH_NAME ?: 'master'; docker.image('ghcr.io/commaai/alpine-ssh').inside('--user=root') { lock(resource: "", label: deviceType, inversePrecedence: true, variable: 'device_ip', quantity: 1) { @@ -82,6 +83,10 @@ def deviceStage(String stageName, String deviceType, List env, def steps) { device(device_ip, "git checkout", extra + "\n" + readFile("selfdrive/test/setup_device_ci.sh")) } steps.each { item -> + if (branch != "master" && item.size() == 3 && !hasDirectoryChanged(item[2])) { + println "Skipped '${item[0]}', no relevant changes were detected." + return; + } device(device_ip, item[0], item[1]) } } @@ -134,6 +139,21 @@ def setupCredentials() { } } +def hasDirectoryChanged(List paths) { + for (change in currentBuild.changeSets) { + for (item in change.items) { + for (affectedPath in item.affectedPaths) { + for (path in paths) { + if (affectedPath.startsWith(path)) { + return true + } + } + } + } + } + return false +} + node { env.CI = "1" env.PYTHONWARNINGS = "error" @@ -171,7 +191,7 @@ node { parallel ( // tici tests 'onroad tests': { - deviceStage("onroad", "tici-needs-can", [], [ + deviceStage("onroad", "tici-needs-can", ["UNSAFE=1"], [ // TODO: ideally, this test runs in master-ci, but it takes 5+m to build it //["build master-ci", "cd $SOURCE_DIR/release && TARGET_DIR=$TEST_DIR $SOURCE_DIR/scripts/retry.sh ./build_devel.sh"], ["build openpilot", "cd selfdrive/manager && ./build.py"], @@ -183,7 +203,7 @@ node { 'HW + Unit Tests': { deviceStage("tici", "tici-common", ["UNSAFE=1"], [ ["build", "cd selfdrive/manager && ./build.py"], - ["test pandad", "pytest selfdrive/boardd/tests/test_pandad.py"], + ["test pandad", "pytest selfdrive/boardd/tests/test_pandad.py", ["panda/", "selfdrive/boardd/"]], ["test power draw", "./system/hardware/tici/tests/test_power_draw.py"], ["test encoder", "LD_LIBRARY_PATH=/usr/local/lib pytest system/loggerd/tests/test_encoder.py"], ["test pigeond", "pytest system/sensord/tests/test_pigeond.py"], @@ -228,7 +248,7 @@ node { deviceStage("tizi", "tizi", ["UNSAFE=1"], [ ["build openpilot", "cd selfdrive/manager && ./build.py"], ["test boardd loopback", "SINGLE_PANDA=1 pytest selfdrive/boardd/tests/test_boardd_loopback.py"], - ["test pandad", "pytest selfdrive/boardd/tests/test_pandad.py"], + ["test pandad", "pytest selfdrive/boardd/tests/test_pandad.py", ["panda/", "selfdrive/boardd/"]], ["test amp", "pytest system/hardware/tici/tests/test_amplifier.py"], ["test hw", "pytest system/hardware/tici/tests/test_hardware.py"], ["test qcomgpsd", "pytest system/qcomgpsd/tests/test_qcomgpsd.py"], From 0830f62b36fd4e802ea6f1a74062ae9e8bd7ecd1 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 14 Dec 2023 20:44:14 -0800 Subject: [PATCH 07/17] also run qcomgpsd on path update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 25649c4949..2522dcc0cd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -251,7 +251,7 @@ node { ["test pandad", "pytest selfdrive/boardd/tests/test_pandad.py", ["panda/", "selfdrive/boardd/"]], ["test amp", "pytest system/hardware/tici/tests/test_amplifier.py"], ["test hw", "pytest system/hardware/tici/tests/test_hardware.py"], - ["test qcomgpsd", "pytest system/qcomgpsd/tests/test_qcomgpsd.py"], + ["test qcomgpsd", "pytest system/qcomgpsd/tests/test_qcomgpsd.py", ["system/qcomgpsd/"]], ]) }, From 5fe9f1459c73d338bf6277dafc8654f92ee8b00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Thu, 14 Dec 2023 20:51:06 -0800 Subject: [PATCH 08/17] metadrive: fix dual_camera mode (#30743) * Use wide cam in metadrive * 120 fov --- tools/sim/bridge/metadrive/metadrive_bridge.py | 4 ++-- tools/sim/bridge/metadrive/metadrive_process.py | 9 ++++++--- tools/sim/bridge/metadrive/metadrive_world.py | 6 +++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/sim/bridge/metadrive/metadrive_bridge.py b/tools/sim/bridge/metadrive/metadrive_bridge.py index fa946e11e3..142a9e0462 100644 --- a/tools/sim/bridge/metadrive/metadrive_bridge.py +++ b/tools/sim/bridge/metadrive/metadrive_bridge.py @@ -36,7 +36,7 @@ class RGBCameraWide(CopyRamRGBCamera): cam = self.get_cam() cam.setPos(C3_POSITION) lens = self.get_lens() - lens.setFov(160) + lens.setFov(120) class RGBCameraRoad(CopyRamRGBCamera): def __init__(self, *args, **kwargs): @@ -116,4 +116,4 @@ class MetaDriveBridge(SimulatorBridge): preload_models=False ) - return MetaDriveWorld(config) + return MetaDriveWorld(config, self.dual_camera) diff --git a/tools/sim/bridge/metadrive/metadrive_process.py b/tools/sim/bridge/metadrive/metadrive_process.py index 3ce89d7d41..d55ecd7ae5 100644 --- a/tools/sim/bridge/metadrive/metadrive_process.py +++ b/tools/sim/bridge/metadrive/metadrive_process.py @@ -39,10 +39,13 @@ def apply_metadrive_patches(): MetaDriveEnv._is_arrive_destination = arrive_destination_patch -def metadrive_process(dual_camera: bool, config: dict, camera_array, controls_recv: Connection, state_send: Connection, exit_event): +def metadrive_process(dual_camera: bool, config: dict, camera_array, wide_camera_array, controls_recv: Connection, state_send: Connection, exit_event): apply_metadrive_patches() road_image = np.frombuffer(camera_array.get_obj(), dtype=np.uint8).reshape((H, W, 3)) + if dual_camera: + assert wide_camera_array is not None + wide_road_image = np.frombuffer(wide_camera_array.get_obj(), dtype=np.uint8).reshape((H, W, 3)) env = MetaDriveEnv(config) @@ -92,8 +95,8 @@ def metadrive_process(dual_camera: bool, config: dict, camera_array, controls_re if terminated: reset() - #if dual_camera: - # wide_road_image = get_cam_as_rgb("rgb_wide") + if dual_camera: + wide_road_image[...] = get_cam_as_rgb("rgb_wide") road_image[...] = get_cam_as_rgb("rgb_road") rk.keep_time() diff --git a/tools/sim/bridge/metadrive/metadrive_world.py b/tools/sim/bridge/metadrive/metadrive_world.py index 3705f19a97..570c9cb4f5 100644 --- a/tools/sim/bridge/metadrive/metadrive_world.py +++ b/tools/sim/bridge/metadrive/metadrive_world.py @@ -15,6 +15,10 @@ class MetaDriveWorld(World): super().__init__(dual_camera) self.camera_array = Array(ctypes.c_uint8, W*H*3) self.road_image = np.frombuffer(self.camera_array.get_obj(), dtype=np.uint8).reshape((H, W, 3)) + self.wide_camera_array = None + if dual_camera: + self.wide_camera_array = Array(ctypes.c_uint8, W*H*3) + self.wide_road_image = np.frombuffer(self.wide_camera_array.get_obj(), dtype=np.uint8).reshape((H, W, 3)) self.controls_send, self.controls_recv = Pipe() self.state_send, self.state_recv = Pipe() @@ -23,7 +27,7 @@ class MetaDriveWorld(World): self.metadrive_process = multiprocessing.Process(name="metadrive process", target= functools.partial(metadrive_process, dual_camera, config, - self.camera_array, self.controls_recv, self.state_send, self.exit_event)) + self.camera_array, self.wide_camera_array, self.controls_recv, self.state_send, self.exit_event)) self.metadrive_process.start() print("----------------------------------------------------------") From da12a34ff66dbe70f532056ba43a6fdb228d41d3 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 14 Dec 2023 21:03:02 -0800 Subject: [PATCH 09/17] Metadrive: set near clip (#30745) set near --- tools/sim/bridge/metadrive/metadrive_bridge.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/sim/bridge/metadrive/metadrive_bridge.py b/tools/sim/bridge/metadrive/metadrive_bridge.py index 142a9e0462..c8d59ff5e6 100644 --- a/tools/sim/bridge/metadrive/metadrive_bridge.py +++ b/tools/sim/bridge/metadrive/metadrive_bridge.py @@ -37,6 +37,7 @@ class RGBCameraWide(CopyRamRGBCamera): cam.setPos(C3_POSITION) lens = self.get_lens() lens.setFov(120) + lens.setNear(0.1) class RGBCameraRoad(CopyRamRGBCamera): def __init__(self, *args, **kwargs): @@ -45,6 +46,7 @@ class RGBCameraRoad(CopyRamRGBCamera): cam.setPos(C3_POSITION) lens = self.get_lens() lens.setFov(40) + lens.setNear(0.1) def straight_block(length): From 10ea45183184001b1b3ac513b96f233ed7053cb9 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 14 Dec 2023 22:24:09 -0800 Subject: [PATCH 10/17] test_onroad: fix test_log_sizes when running inside a prefix --- selfdrive/test/test_onroad.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/selfdrive/test/test_onroad.py b/selfdrive/test/test_onroad.py index d7c5c58280..e3807af143 100755 --- a/selfdrive/test/test_onroad.py +++ b/selfdrive/test/test_onroad.py @@ -168,6 +168,15 @@ class TestOnroad(unittest.TestCase): cls.lr = list(LogReader(os.path.join(str(cls.segments[1]), "rlog"))) cls.log_path = cls.segments[1] + cls.log_sizes = {} + for f in cls.log_path.iterdir(): + assert f.is_file() + cls.log_sizes[f] = f.stat().st_size / 1e6 + if f.name in ("qlog", "rlog"): + with open(f, 'rb') as ff: + cls.log_sizes[f] = len(bz2.compress(ff.read())) / 1e6 + + @cached_property def service_msgs(self): msgs = defaultdict(list) @@ -198,14 +207,7 @@ class TestOnroad(unittest.TestCase): self.assertEqual(len(big_logs), 0, f"Log spam: {big_logs}") def test_log_sizes(self): - for f in self.log_path.iterdir(): - assert f.is_file() - - sz = f.stat().st_size / 1e6 - if f.name in ("qlog", "rlog"): - with open(f, 'rb') as ff: - sz = len(bz2.compress(ff.read())) / 1e6 - + for f, sz in self.log_sizes.items(): if f.name == "qcamera.ts": assert 2.15 < sz < 2.35 elif f.name == "qlog": From 37351cbdc1e40c5d990035d867008aec44b64c76 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 14 Dec 2023 22:30:46 -0800 Subject: [PATCH 11/17] uploader: reduce max qlog/qcam size (#30746) --- system/loggerd/uploader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/loggerd/uploader.py b/system/loggerd/uploader.py index 4bc031a632..914c9e8079 100755 --- a/system/loggerd/uploader.py +++ b/system/loggerd/uploader.py @@ -25,7 +25,7 @@ NetworkType = log.DeviceState.NetworkType UPLOAD_ATTR_NAME = 'user.upload' UPLOAD_ATTR_VALUE = b'1' -UPLOAD_QLOG_QCAM_MAX_SIZE = 100 * 1e6 # MB +UPLOAD_QLOG_QCAM_MAX_SIZE = 5 * 1e6 # MB allow_sleep = bool(os.getenv("UPLOADER_SLEEP", "1")) force_wifi = os.getenv("FORCEWIFI") is not None From d6eb1265a0cf14f2d53a2eb8250e0d6990503c7f Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 14 Dec 2023 22:31:29 -0800 Subject: [PATCH 12/17] Docker: cleanup .git and test folders (#30747) docker cleanup --- Dockerfile.openpilot_base | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile.openpilot_base b/Dockerfile.openpilot_base index 98d07ea39e..028d877a93 100644 --- a/Dockerfile.openpilot_base +++ b/Dockerfile.openpilot_base @@ -40,7 +40,9 @@ COPY --chown=$USER tools/install_python_dependencies.sh /tmp/tools/ RUN cd /tmp && \ tools/install_python_dependencies.sh && \ rm -rf /tmp/* && \ - rm -rf /home/$USER/.cache + rm -rf /home/$USER/.cache && \ + find /home/$USER/pyenv -type d -name ".git" | xargs rm -rf && \ + rm -rf /home/$USER/pyenv/versions/3.11.4/lib/python3.11/test USER root RUN sudo git config --global --add safe.directory /tmp/openpilot \ No newline at end of file From 6f143f6c45b04702de24371db2d836210be9b860 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 14 Dec 2023 23:00:07 -0800 Subject: [PATCH 13/17] full clean for onroad device --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2522dcc0cd..3f573e6ae4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -191,7 +191,7 @@ node { parallel ( // tici tests 'onroad tests': { - deviceStage("onroad", "tici-needs-can", ["UNSAFE=1"], [ + deviceStage("onroad", "tici-needs-can", [], [ // TODO: ideally, this test runs in master-ci, but it takes 5+m to build it //["build master-ci", "cd $SOURCE_DIR/release && TARGET_DIR=$TEST_DIR $SOURCE_DIR/scripts/retry.sh ./build_devel.sh"], ["build openpilot", "cd selfdrive/manager && ./build.py"], From 1733b04741323155ee241fa5f300e779f3c931bb Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 14 Dec 2023 23:40:46 -0800 Subject: [PATCH 14/17] jenkins: always do the copy in safe_checkout --- selfdrive/test/setup_device_ci.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/selfdrive/test/setup_device_ci.sh b/selfdrive/test/setup_device_ci.sh index a180fe0de6..5c85312f1a 100755 --- a/selfdrive/test/setup_device_ci.sh +++ b/selfdrive/test/setup_device_ci.sh @@ -79,9 +79,7 @@ safe_checkout() { echo "git checkout done, t=$SECONDS" du -hs $SOURCE_DIR $SOURCE_DIR/.git - if [ -z "SKIP_COPY" ]; then - rsync -a --delete $SOURCE_DIR $TEST_DIR - fi + rsync -a --delete $SOURCE_DIR $TEST_DIR } unsafe_checkout() { From 1ca1cf39223557955cee58e18a418914faf472c3 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Fri, 15 Dec 2023 14:50:37 -0800 Subject: [PATCH 15/17] test_models: check consitency between panda and openpilot for velocity (#30750) * sanity check on velocity * import from there * use raw * just check last * ignore body * reduce tolerance and bump panda * its not average anymore * slightly higher tolerance --- panda | 2 +- selfdrive/car/tests/test_models.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/panda b/panda index bb75afc84e..7e2b312fa8 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit bb75afc84e4d33af1554ada81851547db648e33e +Subproject commit 7e2b312fa86e6cdfeba496f261407cb47cb005d1 diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index aaaa6b9d79..3a76eff3ab 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -23,6 +23,7 @@ from openpilot.tools.lib.logreader import LogReader from openpilot.tools.lib.route import Route, SegmentName, RouteName from panda.tests.libpanda import libpanda_py +from panda.tests.safety.common import VEHICLE_SPEED_FACTOR EventName = car.CarEvent.EventName PandaType = log.PandaState.PandaType @@ -345,6 +346,11 @@ class TestCarModelBase(unittest.TestCase): checks['brakePressed'] += brake_pressed != self.safety.get_brake_pressed_prev() checks['regenBraking'] += CS.regenBraking != self.safety.get_regen_braking_prev() + # Verify that panda has the correct velocity for cars that use it (angle based cars) + if self.CP.steerControlType in [car.CarParams.SteerControlType.angle] and not self.CP.notCar: + panda_velocity = self.safety.get_vehicle_speed_last() / VEHICLE_SPEED_FACTOR + checks['vEgo'] += abs(panda_velocity - CS.vEgoRaw) > 0.2 + if self.CP.pcmCruise: # On most pcmCruise cars, openpilot's state is always tied to the PCM's cruise state. # On Honda Nidec, we always engage on the rising edge of the PCM cruise state, but From 123ef46af3694afc30b4ec28ce8f995d9fa92cd1 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 15 Dec 2023 17:16:01 -0800 Subject: [PATCH 16/17] Revert "test_models: check consitency between panda and openpilot for velocity (#30750)" (#30753) This reverts commit 1ca1cf39223557955cee58e18a418914faf472c3. --- panda | 2 +- selfdrive/car/tests/test_models.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/panda b/panda index 7e2b312fa8..bb75afc84e 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 7e2b312fa86e6cdfeba496f261407cb47cb005d1 +Subproject commit bb75afc84e4d33af1554ada81851547db648e33e diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index 3a76eff3ab..aaaa6b9d79 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -23,7 +23,6 @@ from openpilot.tools.lib.logreader import LogReader from openpilot.tools.lib.route import Route, SegmentName, RouteName from panda.tests.libpanda import libpanda_py -from panda.tests.safety.common import VEHICLE_SPEED_FACTOR EventName = car.CarEvent.EventName PandaType = log.PandaState.PandaType @@ -346,11 +345,6 @@ class TestCarModelBase(unittest.TestCase): checks['brakePressed'] += brake_pressed != self.safety.get_brake_pressed_prev() checks['regenBraking'] += CS.regenBraking != self.safety.get_regen_braking_prev() - # Verify that panda has the correct velocity for cars that use it (angle based cars) - if self.CP.steerControlType in [car.CarParams.SteerControlType.angle] and not self.CP.notCar: - panda_velocity = self.safety.get_vehicle_speed_last() / VEHICLE_SPEED_FACTOR - checks['vEgo'] += abs(panda_velocity - CS.vEgoRaw) > 0.2 - if self.CP.pcmCruise: # On most pcmCruise cars, openpilot's state is always tied to the PCM's cruise state. # On Honda Nidec, we always engage on the rising edge of the PCM cruise state, but From d9a8846d58af2a3a9a598fcf9fb1acf89e4b54f6 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 15 Dec 2023 17:16:19 -0800 Subject: [PATCH 17/17] test_models: use gen_empty_fingerprint (#30752) use gen_empty_fingerprint --- selfdrive/car/tests/test_models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index aaaa6b9d79..2103b6ccce 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -13,6 +13,7 @@ from cereal import log, car from openpilot.common.basedir import BASEDIR from openpilot.common.params import Params from openpilot.common.realtime import DT_CTRL +from openpilot.selfdrive.car import gen_empty_fingerprint from openpilot.selfdrive.car.fingerprints import all_known_cars from openpilot.selfdrive.car.car_helpers import FRAME_FINGERPRINT, interfaces from openpilot.selfdrive.car.honda.values import CAR as HONDA, HONDA_BOSCH @@ -104,7 +105,7 @@ class TestCarModelBase(unittest.TestCase): can_msgs = [] cls.elm_frame = None cls.car_safety_mode_frame = None - fingerprint = defaultdict(dict) + fingerprint = gen_empty_fingerprint() experimental_long = False for msg in lr: if msg.which() == "can":