Skip to content

Commit 85be149

Browse files
committed
Merge branch 'master' into libdatachannel
2 parents 98f440d + 5d23a78 commit 85be149

121 files changed

Lines changed: 2573 additions & 1543 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/diff_report.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,29 @@ jobs:
2424
repo-token: ${{ secrets.GITHUB_TOKEN }}
2525
allowed-conclusions: success,failure
2626
wait-interval: 20
27+
- name: Get tests run ID
28+
if: steps.wait.outcome == 'success'
29+
id: tests-run
30+
env:
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
run_id=$(gh api \
34+
"repos/${{ github.repository }}/actions/workflows/tests.yaml/runs?event=pull_request&head_sha=${{ github.event.pull_request.head.sha }}&per_page=1" \
35+
--jq '.workflow_runs[0].id // empty')
36+
if [ -z "$run_id" ]; then
37+
echo "No tests.yaml run found for ${{ github.event.pull_request.head.sha }}" >&2
38+
exit 1
39+
fi
40+
echo "run-id=$run_id" >> "$GITHUB_OUTPUT"
2741
- name: Download diff
2842
if: steps.wait.outcome == 'success'
29-
uses: dawidd6/action-download-artifact@b6e2e70617bc3265edd6dab6c906732b2f1ae151
43+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
3044
with:
31-
github_token: ${{ secrets.GITHUB_TOKEN }}
32-
workflow: tests.yaml
33-
workflow_conclusion: ''
34-
pr: ${{ github.event.number }}
45+
github-token: ${{ secrets.GITHUB_TOKEN }}
46+
repository: ${{ github.repository }}
47+
run-id: ${{ steps.tests-run.outputs.run-id }}
3548
name: diff_report_${{ github.event.number }}
3649
path: .
37-
allow_forks: true
3850
- name: Comment on PR
3951
if: steps.wait.outcome == 'success'
4052
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b

.github/workflows/tests.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ jobs:
6666
runs-on: ${{ ((github.repository == 'commaai/openpilot') && ((github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == 'commaai/openpilot'))) && 'namespace-profile-macos-8x14' || 'macos-latest' }}
6767
steps:
6868
- uses: actions/checkout@v7
69-
with:
70-
submodules: true
7169
- name: Remove Homebrew from environment
7270
run: |
7371
FILTERED=$(echo "$PATH" | tr ':' '\n' | grep -v '/opt/homebrew' | tr '\n' ':')
@@ -86,8 +84,6 @@ jobs:
8684
|| fromJSON('["ubuntu-24.04"]') }}
8785
steps:
8886
- uses: actions/checkout@v7
89-
with:
90-
submodules: true
9187
- run: ./tools/op.sh setup
9288
- name: Static analysis
9389
timeout-minutes: 1
@@ -103,15 +99,14 @@ jobs:
10399
|| fromJSON('["ubuntu-24.04"]') }}
104100
steps:
105101
- uses: actions/checkout@v7
106-
with:
107-
submodules: true
108102
- run: ./tools/op.sh setup
109103
- name: Build openpilot
110104
run: scons
111105
- name: Run unit tests
112106
timeout-minutes: ${{ contains(runner.name, 'nsc') && 2 || 20 }}
107+
env:
108+
RAYLIB_BACKEND: headless
113109
run: |
114-
source openpilot/selfdrive/test/setup_xvfb.sh
115110
# Pre-compile Python bytecode so each pytest worker doesn't need to
116111
$PYTEST --collect-only -m 'not slow' -qq
117112
MAX_EXAMPLES=1 $PYTEST -m 'not slow'
@@ -126,8 +121,6 @@ jobs:
126121
|| fromJSON('["ubuntu-24.04"]') }}
127122
steps:
128123
- uses: actions/checkout@v7
129-
with:
130-
submodules: true
131124
- run: ./tools/op.sh setup
132125
- name: Build openpilot
133126
run: scons
@@ -199,16 +192,15 @@ jobs:
199192
if: false # FIXME: Started to timeout recently
200193
steps:
201194
- uses: actions/checkout@v7
202-
with:
203-
submodules: true
204195
- run: ./tools/op.sh setup
205196
- name: Build openpilot
206197
run: scons
207198
- name: Driving test
208199
timeout-minutes: 2
209-
run: |
210-
source openpilot/selfdrive/test/setup_xvfb.sh
211-
pytest -s openpilot/tools/sim/tests/test_metadrive_bridge.py
200+
env:
201+
# MetaDrive renders offscreen through panda3d's EGL pipe on llvmpipe
202+
EGL_PLATFORM: surfaceless
203+
run: pytest -s openpilot/tools/sim/tests/test_metadrive_bridge.py
212204

213205
create_ui_report:
214206
name: Create UI Report
@@ -220,14 +212,13 @@ jobs:
220212
|| fromJSON('["ubuntu-24.04"]') }}
221213
steps:
222214
- uses: actions/checkout@v7
223-
with:
224-
submodules: true
225215
- run: ./tools/op.sh setup
226216
- name: Build openpilot
227217
run: scons
228218
- name: Create UI Report
219+
env:
220+
RAYLIB_BACKEND: headless
229221
run: |
230-
source openpilot/selfdrive/test/setup_xvfb.sh
231222
python3 openpilot/selfdrive/ui/tests/diff/replay.py
232223
python3 openpilot/selfdrive/ui/tests/diff/replay.py --big
233224
- name: Upload UI Report

.github/workflows/ui_preview.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ env:
2525

2626
jobs:
2727
preview:
28-
if: github.repository == 'commaai/openpilot'
28+
if: false # tmp disable due to GH API rate limiting flakiness
29+
#if: github.repository == 'commaai/openpilot'
2930
name: preview
3031
runs-on: ubuntu-latest
3132
timeout-minutes: 20

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ a.out
1515
.cache/
1616
bin/
1717

18+
# created at launch for TICI PYTHONPATH (PC uses editable installs via pyproject.toml)
19+
/msgq
20+
/opendbc
21+
/rednose
22+
/teleoprtc
23+
/tinygrad
24+
1825
*.mp4
1926
*.dylib
2027
*.DSYM

SConstruct

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ AddOption('--minimal',
2727
default=(not TICI and not release),
2828
help='the minimum build to run openpilot. no tests, tools, etc.')
2929

30+
submodule_python_paths = [
31+
Dir("#").abspath,
32+
Dir("#msgq_repo").abspath,
33+
Dir("#opendbc_repo").abspath,
34+
Dir("#rednose_repo").abspath,
35+
Dir("#teleoprtc_repo").abspath,
36+
Dir("#tinygrad_repo").abspath,
37+
]
38+
for p in reversed(submodule_python_paths):
39+
if p not in sys.path:
40+
sys.path.insert(0, p)
41+
42+
if external_pythonpath := os.environ.get("PYTHONPATH"):
43+
submodule_python_paths += [p for p in external_pythonpath.split(os.pathsep) if p and p not in submodule_python_paths]
44+
3045
# Detect platform
3146
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
3247
if platform.system() == "Darwin":
@@ -40,9 +55,24 @@ assert arch in [
4055
"Darwin", # macOS arm64 (x86 not supported)
4156
]
4257

43-
pkg_names = ['acados', 'bzip2', 'capnproto', 'catch2', 'eigen', 'ffmpeg', 'json11', 'libjpeg', 'libyuv', 'ncurses', 'zeromq', 'zstd']
58+
pkg_names = ['acados', 'bzip2', 'capnproto', 'catch2', 'ffmpeg', 'json11', 'ncurses', 'zeromq', 'zstd']
4459
pkgs = [importlib.import_module(name) for name in pkg_names]
4560
acados = pkgs[pkg_names.index('acados')]
61+
ffmpeg = pkgs[pkg_names.index('ffmpeg')]
62+
# Shared package ships .so/.dylib; older device venvs still have static .a only.
63+
# Keep static link deps (x264/z/va/drm) when the installed package is static so
64+
# TICI CI works without upgrading the device venv yet.
65+
# TODO: drop the static fallback once device venvs have comma-deps-ffmpeg>=7.1.0.post94
66+
_ffmpeg_lib_names = os.listdir(ffmpeg.LIB_DIR) if os.path.isdir(ffmpeg.LIB_DIR) else []
67+
ffmpeg_shared = any(
68+
n.startswith('libavcodec.so') or (n.startswith('libavcodec') and n.endswith('.dylib'))
69+
for n in _ffmpeg_lib_names
70+
)
71+
ffmpeg_libs = ['avformat', 'avcodec', 'swresample', 'avutil']
72+
if not ffmpeg_shared:
73+
ffmpeg_libs += ['x264', 'z']
74+
if arch != "Darwin":
75+
ffmpeg_libs += ['va', 'va-drm', 'drm']
4676
acados_include_dirs = [
4777
acados.INCLUDE_DIR,
4878
os.path.join(acados.INCLUDE_DIR, "blasfeo", "include"),
@@ -91,7 +121,7 @@ def _libflags(target, source, env, for_signature):
91121
env = Environment(
92122
ENV={
93123
"PATH": os.environ['PATH'],
94-
"PYTHONPATH": Dir("#").abspath,
124+
"PYTHONPATH": os.pathsep.join(submodule_python_paths),
95125
"ACADOS_SOURCE_DIR": acados.DIR,
96126
"ACADOS_PYTHON_INTERFACE_PATH": acados.TEMPLATE_DIR,
97127
"TERA_PATH": acados.TERA_PATH
@@ -113,7 +143,10 @@ env = Environment(
113143
CXXFLAGS=["-std=c++1z"],
114144
CPPPATH=[
115145
"#openpilot",
116-
"#msgq",
146+
"#msgq_repo", # #include "msgq/..."
147+
"#opendbc_repo", # #include "opendbc/..."
148+
"#rednose_repo", # #include "rednose/..."
149+
"#rednose_repo/rednose", # #include "logger/..." (rednose package root)
117150
"#openpilot/cereal/gen/cpp",
118151
acados_include_dirs,
119152
[x.INCLUDE_DIR for x in pkgs],
@@ -123,16 +156,21 @@ env = Environment(
123156
"#openpilot/common",
124157
"#msgq_repo",
125158
"#openpilot/selfdrive/pandad",
126-
"#rednose/helpers",
159+
"#rednose_repo/rednose/helpers",
127160
[x.LIB_DIR for x in pkgs],
128161
],
129-
RPATH=[],
162+
RPATH=[ffmpeg.LIB_DIR] if ffmpeg_shared else [],
130163
CYTHONCFILESUFFIX=".cpp",
131164
COMPILATIONDB_USE_ABSPATH=True,
132-
REDNOSE_ROOT="#",
165+
REDNOSE_ROOT="#rednose_repo",
133166
tools=["default", "cython", "compilation_db", "rednose_filter"],
134167
toolpath=["#site_scons/site_tools", "#rednose_repo/site_scons/site_tools"],
135168
)
169+
# SCons' Darwin linker tool doesn't define the variables used to expand RPATH.
170+
if arch == "Darwin":
171+
env["RPATHPREFIX"] = "-Wl,-rpath,"
172+
env["RPATHSUFFIX"] = ""
173+
env["_RPATH"] = "${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}"
136174
if arch != "larch64":
137175
env['_LIBFLAGS'] = _libflags
138176

@@ -192,7 +230,7 @@ else:
192230
np_version = SCons.Script.Value(np.__version__)
193231
Export('envCython', 'np_version')
194232

195-
Export('env', 'arch', 'acados')
233+
Export('env', 'arch', 'acados', 'ffmpeg_libs')
196234

197235
# Setup cache dir
198236
cache_dir = '/data/scons_cache' if arch == "larch64" else '/tmp/scons_cache'
@@ -234,7 +272,7 @@ Export('messaging')
234272
SConscript(['panda/SConscript'])
235273

236274
# Build rednose library
237-
SConscript(['rednose/SConscript'])
275+
SConscript(['rednose_repo/rednose/SConscript'])
238276

239277
# Build system services
240278
SConscript([

launch_chffrplus.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ function launch {
7070
ln -sfn $(pwd) /data/pythonpath
7171
export PYTHONPATH="$PWD"
7272

73+
# submodule package symlinks for PYTHONPATH imports on device.
74+
# on PC these come from editable installs via pyproject.toml / uv.
75+
ln -sfn msgq_repo/msgq msgq
76+
ln -sfn opendbc_repo/opendbc opendbc
77+
ln -sfn rednose_repo/rednose rednose
78+
ln -sfn teleoprtc_repo/teleoprtc teleoprtc
79+
ln -sfn tinygrad_repo/tinygrad tinygrad
80+
7381
# hardware specific init
7482
if [ -f /AGNOS ]; then
7583
agnos_init

msgq

Lines changed: 0 additions & 1 deletion
This file was deleted.

opendbc

Lines changed: 0 additions & 1 deletion
This file was deleted.

openpilot/cereal/log.capnp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -699,36 +699,36 @@ struct UsbState {
699699
speedMbps @4 :UInt16;
700700
manufacturer @6 :Text;
701701
product @5 :Text;
702+
linkErrorCount @7 :UInt16;
702703
}
703704
}
704705

705706
struct RadarState @0x9a185389d6fdd05f {
706-
mdMonoTime @6 :UInt64;
707-
carStateMonoTime @11 :UInt64;
707+
mdMonoTime @6 :UInt64; # for debugging
708708
radarErrors @13 :Car.RadarData.Error;
709709

710710
leadOne @3 :LeadData;
711711
leadTwo @4 :LeadData;
712712

713713
struct LeadData {
714-
dRel @0 :Float32;
715-
yRel @1 :Float32;
716-
vRel @2 :Float32;
717-
aRel @3 :Float32;
718-
vLead @4 :Float32;
719-
dPath @6 :Float32;
720-
vLat @7 :Float32;
721-
vLeadK @8 :Float32;
722-
aLeadK @9 :Float32;
723-
fcw @10 :Bool;
724-
status @11 :Bool;
725-
aLeadTau @12 :Float32;
726-
modelProb @13 :Float32;
727-
radar @14 :Bool;
728-
radarTrackId @15 :Int32 = -1;
714+
dRel @0 :Float32; # m from the front bumper of the car
715+
yRel @1 :Float32; # m in car frame, left positive
716+
vRel @2 :Float32; # m/s relative longitudinal speed
717+
vLead @4 :Float32; # m/s absolute lead speed
718+
vLeadK @8 :Float32; # kalman-filtered lead speed
719+
aLeadK @9 :Float32; # kalman-filtered lead accel
720+
present @11 :Bool; # true if a lead is present
721+
aLeadTau @12 :Float32; # lead accel time constant
722+
modelProb @13 :Float32; # vision model lead probability
723+
radar @14 :Bool; # true if lead is radar-matched (vs vision-only)
724+
radarTrackId @15 :Int32 = -1; # for debugging
729725

730726
deprecated :group {
727+
aRel @3 :Float32;
731728
aLead @5 :Float32;
729+
dPath @6 :Float32;
730+
vLat @7 :Float32;
731+
fcw @10 :Bool;
732732
}
733733
}
734734

@@ -741,6 +741,7 @@ struct RadarState @0x9a185389d6fdd05f {
741741
calPerc @9 :Int8;
742742
canMonoTimes @10 :List(UInt64);
743743
cumLagMs @5 :Float32;
744+
carStateMonoTime @11 :UInt64;
744745
radarErrors @12 :List(Car.RadarData.ErrorDEPRECATED);
745746
}
746747
}
@@ -1040,7 +1041,6 @@ struct ModelDataV2 {
10401041
roadEdgeStds @14 :List(Float32);
10411042

10421043
# predicted lead cars
1043-
leads @11 :List(LeadDataV2);
10441044
leadsV3 @18 :List(LeadDataV3);
10451045

10461046
meta @12 :MetaData;
@@ -1050,8 +1050,9 @@ struct ModelDataV2 {
10501050
action @26: Action;
10511051

10521052
lateralPlannerSolutionDEPRECATED @25: Deprecated.LateralPlannerSolution;
1053+
leadsDEPRECATED @11 :List(LeadDataV2DEPRECATED);
10531054

1054-
struct LeadDataV2 {
1055+
struct LeadDataV2DEPRECATED {
10551056
prob @0 :Float32; # probability that car is your lead at time t
10561057
t @1 :Float32;
10571058

openpilot/common/SConscript

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ common_libs = [
55
'swaglog.cc',
66
'util.cc',
77
'ratekeeper.cc',
8+
'yuv.cc',
89
]
910

1011
_common = env.Library('common', common_libs, LIBS="json11")
1112
Export('_common')
1213

1314
if GetOption('extras'):
1415
env.Program('tests/test_common',
15-
['tests/test_runner.cc', 'tests/test_params.cc', 'tests/test_util.cc', 'tests/test_swaglog.cc'],
16+
['tests/test_runner.cc', 'tests/test_util.cc', 'tests/test_swaglog.cc'],
1617
LIBS=[_common, 'json11', 'zmq', 'pthread'])
1718

1819
# Cython bindings

0 commit comments

Comments
 (0)