diff --git a/Jenkinsfile b/Jenkinsfile index ae1423b6d4..840dd29503 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ export GIT_COMMIT=${env.GIT_COMMIT} export AZURE_TOKEN='${env.AZURE_TOKEN}' export MAPBOX_TOKEN='${env.MAPBOX_TOKEN}' # only use 1 thread for tici tests since most require HIL -export PYTEST_ADDOPTS="-n 1" +export PYTEST_ADDOPTS="-n 0" export GIT_SSH_COMMAND="ssh -i /data/gitkey" @@ -235,8 +235,8 @@ node { pcStage("car tests") { sh label: "build", script: "selfdrive/manager/build.py" sh label: "test_models.py", script: "INTERNAL_SEG_CNT=250 INTERNAL_SEG_LIST=selfdrive/car/tests/test_models_segs.txt FILEREADER_CACHE=1 \ - pytest -n auto --dist=loadscope selfdrive/car/tests/test_models.py" - sh label: "test_car_interfaces.py", script: "MAX_EXAMPLES=100 pytest -n auto --dist=load selfdrive/car/tests/test_car_interfaces.py" + pytest selfdrive/car/tests/test_models.py" + sh label: "test_car_interfaces.py", script: "MAX_EXAMPLES=100 pytest selfdrive/car/tests/test_car_interfaces.py" } }, diff --git a/RELEASES.md b/RELEASES.md index 6a531791df..28c3da70a2 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,6 +1,7 @@ -Version 0.9.6 (2023-XX-XX) +Version 0.9.6 (2023-12-14) ======================== * AGNOS 9 +* comma body streaming and controls over WebRTC Version 0.9.5 (2023-11-17) ======================== diff --git a/conftest.py b/conftest.py index 9aaf04d798..d1787c24ef 100644 --- a/conftest.py +++ b/conftest.py @@ -45,8 +45,9 @@ def pytest_collection_modifyitems(config, items): item.add_marker(skipper) if "xdist_group_class_property" in item.keywords: - class_property = item.get_closest_marker('xdist_group_class_property').args[0] - item.add_marker(pytest.mark.xdist_group(getattr(item.cls, class_property))) + class_property_name = item.get_closest_marker('xdist_group_class_property').args[0] + class_property_value = getattr(item.cls, class_property_name) + item.add_marker(pytest.mark.xdist_group(class_property_value)) @pytest.hookimpl(trylast=True) diff --git a/pyproject.toml b/pyproject.toml index 0e55e2ac60..ffbd5d43b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -190,6 +190,7 @@ exclude = [ "rednose_repo", "tinygrad_repo", "teleoprtc", + "teleoprtc_repo", "third_party", ] flake8-implicit-str-concat.allow-multiline=false diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index f26fd363ca..0ae104f9f5 100755 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -382,7 +382,7 @@ class TestCarModelBase(unittest.TestCase): @parameterized_class(('car_model', 'test_route'), get_test_cases()) -@pytest.mark.xdist_group_class_property('car_model') +@pytest.mark.xdist_group_class_property('test_route') class TestCarModel(TestCarModelBase): pass diff --git a/selfdrive/ui/soundd.py b/selfdrive/ui/soundd.py index dac4bb74d8..a3dc6fedfe 100644 --- a/selfdrive/ui/soundd.py +++ b/selfdrive/ui/soundd.py @@ -1,12 +1,16 @@ import math -import time import numpy as np +import time import wave from typing import Dict, Optional, Tuple from cereal import car, messaging from openpilot.common.basedir import BASEDIR +from openpilot.common.filter_simple import FirstOrderFilter + +from openpilot.system import micd + from openpilot.common.realtime import Ratekeeper from openpilot.system.hardware import PC from openpilot.system.swaglog import cloudlog @@ -15,6 +19,7 @@ SAMPLE_RATE = 48000 MAX_VOLUME = 1.0 MIN_VOLUME = 0.1 CONTROLS_TIMEOUT = 5 # 5 seconds +FILTER_DT = 1. / (micd.SAMPLE_RATE / micd.FFT_SAMPLES) AMBIENT_DB = 30 # DB where MIN_VOLUME is applied DB_SCALE = 30 # AMBIENT_DB + DB_SCALE is where MAX_VOLUME is applied @@ -56,6 +61,8 @@ class Soundd: self.controls_timeout_alert = False + self.spl_filter_weighted = FirstOrderFilter(0, 2.5, FILTER_DT, initialized=False) + def load_sounds(self): self.loaded_sounds: Dict[int, np.ndarray] = {} @@ -137,8 +144,9 @@ class Soundd: while True: sm.update(0) - if sm.updated['microphone']: - self.current_volume = self.calculate_volume(sm["microphone"].filteredSoundPressureWeightedDb) + if sm.updated['microphone'] and self.current_alert == AudibleAlert.none: # only update volume filter when not playing alert + self.spl_filter_weighted.update(sm["microphone"].soundPressureWeightedDb) + self.current_volume = self.calculate_volume(float(self.spl_filter_weighted.x)) self.get_audible_alert(sm) diff --git a/system/micd.py b/system/micd.py index 0b7a4dadfb..452c04bc03 100755 --- a/system/micd.py +++ b/system/micd.py @@ -2,7 +2,6 @@ import numpy as np from cereal import messaging -from openpilot.common.filter_simple import FirstOrderFilter from openpilot.common.realtime import Ratekeeper from openpilot.system.swaglog import cloudlog @@ -10,7 +9,6 @@ RATE = 10 FFT_SAMPLES = 4096 REFERENCE_SPL = 2e-5 # newtons/m^2 SAMPLE_RATE = 44100 -FILTER_DT = 1. / (SAMPLE_RATE / FFT_SAMPLES) def calculate_spl(measurements): @@ -50,15 +48,12 @@ class Mic: self.sound_pressure_weighted = 0 self.sound_pressure_level_weighted = 0 - self.spl_filter_weighted = FirstOrderFilter(0, 2.5, FILTER_DT, initialized=False) - def update(self): msg = messaging.new_message('microphone', valid=True) msg.microphone.soundPressure = float(self.sound_pressure) msg.microphone.soundPressureWeighted = float(self.sound_pressure_weighted) msg.microphone.soundPressureWeightedDb = float(self.sound_pressure_level_weighted) - msg.microphone.filteredSoundPressureWeightedDb = float(self.spl_filter_weighted.x) self.pm.send('microphone', msg) self.rk.keep_time() @@ -79,7 +74,6 @@ class Mic: self.sound_pressure, _ = calculate_spl(measurements) measurements_weighted = apply_a_weighting(measurements) self.sound_pressure_weighted, self.sound_pressure_level_weighted = calculate_spl(measurements_weighted) - self.spl_filter_weighted.update(self.sound_pressure_level_weighted) self.measurements = self.measurements[FFT_SAMPLES:]