Compare commits

..

15 Commits

Author SHA1 Message Date
royjr 9061b2cb65 Merge branch 'master' into developer-panel-external-storage 2026-06-30 21:55:06 -04:00
royjr fb724b9612 Merge branch 'master' into developer-panel-external-storage 2026-06-09 11:44:46 -04:00
royjr 71e4f251d2 Merge branch 'master' into developer-panel-external-storage 2026-03-02 02:42:38 -05:00
royjr dbefa8afbd Merge branch 'master' into developer-panel-external-storage 2026-02-20 22:29:35 -05:00
royjr fb54689300 Merge branch 'master' into developer-panel-external-storage 2025-12-29 09:57:43 -05:00
royjr db8e56687f Update developer.py 2025-12-21 17:00:44 -05:00
royjr 88e5e3d23d Update developer.py 2025-12-21 16:55:16 -05:00
royjr 0b00470999 Merge branch 'master' into developer-panel-external-storage 2025-12-21 16:51:48 -05:00
royjr 65dcbf698e lint 2025-11-27 22:12:18 -05:00
royjr ac99ce017c cleanup 2025-11-27 22:07:03 -05:00
royjr 508abb227c sudo 2025-11-27 22:04:41 -05:00
royjr b609622398 init 2025-11-27 21:38:18 -05:00
discountchubbs c9f2756264 double translate 2025-11-27 12:05:07 -08:00
discountchubbs 3580656d78 comment out 2025-11-27 11:57:03 -08:00
discountchubbs f973b7fdcb ui: developer panel 2025-11-27 11:53:30 -08:00
1545 changed files with 7177 additions and 5330 deletions
+18
View File
@@ -0,0 +1,18 @@
**/.git
.DS_Store
*.dylib
*.DSYM
*.d
*.pyc
*.pyo
.*.swp
.*.swo
.*.un~
*.tmp
*.o
*.o-*
*.os
*.os-*
venv/
.venv/
+2 -2
View File
@@ -10,5 +10,5 @@
*.otf filter=lfs diff=lfs merge=lfs -text *.otf filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text *.wav filter=lfs diff=lfs merge=lfs -text
openpilot/selfdrive/car/tests/test_models_segs.txt filter=lfs diff=lfs merge=lfs -text selfdrive/car/tests/test_models_segs.txt filter=lfs diff=lfs merge=lfs -text
openpilot/common/hardware/tici/updater filter=lfs diff=lfs merge=lfs -text system/hardware/tici/updater filter=lfs diff=lfs merge=lfs -text
+6 -6
View File
@@ -8,24 +8,24 @@ chore:
car: car:
- changed-files: - changed-files:
- any-glob-to-all-files: '{openpilot/selfdrive/car/**,opendbc_repo}' - any-glob-to-all-files: '{selfdrive/car/**,opendbc_repo}'
simulation: simulation:
- changed-files: - changed-files:
- any-glob-to-all-files: 'openpilot/tools/sim/**' - any-glob-to-all-files: 'tools/sim/**'
ui: ui:
- changed-files: - changed-files:
- any-glob-to-all-files: '{openpilot/selfdrive/assets/**,openpilot/selfdrive/ui/**,openpilot/system/ui/**}' - any-glob-to-all-files: '{selfdrive/assets/**,selfdrive/ui/**,system/ui/**}'
tools: tools:
- changed-files: - changed-files:
- any-glob-to-all-files: 'openpilot/tools/**' - any-glob-to-all-files: 'tools/**'
multilanguage: multilanguage:
- changed-files: - changed-files:
- any-glob-to-all-files: 'openpilot/selfdrive/ui/translations/**' - any-glob-to-all-files: 'selfdrive/ui/translations/**'
autonomy: autonomy:
- changed-files: - changed-files:
- any-glob-to-all-files: "{openpilot/selfdrive/modeld/models/**,openpilot/selfdrive/test/process_replay/model_replay_ref_commit,openpilot/sunnypilot/modeld*/models/**}" - any-glob-to-all-files: "{selfdrive/modeld/models/**,selfdrive/test/process_replay/model_replay_ref_commit,sunnypilot/modeld*/models/**}"
+2 -2
View File
@@ -44,8 +44,8 @@ Explain how you tested this bug fix.
**Checklist** **Checklist**
- [ ] added entry to CAR in openpilot/selfdrive/car/*/values.py and ran `openpilot/selfdrive/car/docs.py` to generate new docs - [ ] added entry to CAR in selfdrive/car/*/values.py and ran `selfdrive/car/docs.py` to generate new docs
- [ ] test route added to [routes.py](https://github.com/commaai/openpilot/blob/master/openpilot/selfdrive/car/tests/routes.py) - [ ] test route added to [routes.py](https://github.com/commaai/openpilot/blob/master/selfdrive/car/tests/routes.py)
- [ ] route with openpilot: - [ ] route with openpilot:
- [ ] route with stock system: - [ ] route with stock system:
- [ ] car harness used (if comma doesn't sell it, put N/A): - [ ] car harness used (if comma doesn't sell it, put N/A):
+2 -2
View File
@@ -12,7 +12,7 @@ jobs:
issues: write issues: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with: with:
submodules: false submodules: false
@@ -24,7 +24,7 @@ jobs:
# Check PR target branch # Check PR target branch
- name: check branch - name: check branch
uses: Vankka/pr-target-branch-action@5da68a42bcb7b43d39104295a876a6f3f8d7908b uses: Vankka/pr-target-branch-action@def32ec9d93514138d6ac0132ee62e120a72aed5
if: github.repository == 'sunnypilot/sunnypilot' if: github.repository == 'sunnypilot/sunnypilot'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+11 -24
View File
@@ -6,7 +6,7 @@ on:
- master - master
pull_request: pull_request:
paths: paths:
- 'openpilot/cereal/**' - 'cereal/**'
workflow_dispatch: workflow_dispatch:
workflow_call: workflow_call:
inputs: inputs:
@@ -30,25 +30,11 @@ jobs:
- name: Checkout sunnypilot cereal - name: Checkout sunnypilot cereal
uses: actions/checkout@v6 uses: actions/checkout@v6
with: with:
sparse-checkout: | sparse-checkout: cereal
openpilot/cereal
uv.lock
submodules: false
- name: Init sunnypilot opendbc submodule - name: Init sunnypilot opendbc submodule
run: git submodule update --init --depth 1 opendbc_repo run: git submodule update --init --depth 1 opendbc_repo
- name: Locate sunnypilot capnp import paths
id: locate-sp-capnp
run: |
SP_IMPORT_ARGS=""
SP_CAR_CAPNP=$(find opendbc_repo -maxdepth 4 -name car.capnp -path '*/opendbc/car/car.capnp' -printf '%h\n' -quit)
if [ -n "$SP_CAR_CAPNP" ]; then
SP_IMPORT_ARGS="-I $SP_CAR_CAPNP"
echo "Found sunnypilot car.capnp at: $SP_CAR_CAPNP"
fi
echo "import_args=$SP_IMPORT_ARGS" >> "$GITHUB_OUTPUT"
- name: Checkout upstream openpilot - name: Checkout upstream openpilot
uses: actions/checkout@v6 uses: actions/checkout@v6
with: with:
@@ -79,19 +65,20 @@ jobs:
fi fi
echo "import_args=$IMPORT_ARGS" >> "$GITHUB_OUTPUT" echo "import_args=$IMPORT_ARGS" >> "$GITHUB_OUTPUT"
- name: Install pycapnp - name: Install uv
run: | run: pip install uv
PYCAPNP_VER=$(python3 -c "import re; m=re.search(r'name = \"pycapnp\"\nversion = \"([^\"]+)\"', open('uv.lock').read()); print(m.group(1))")
pip install "pycapnp==${PYCAPNP_VER}"
- name: Generate sunnypilot schema - name: Generate sunnypilot schema
run: | run: |
python3 openpilot/cereal/messaging/tests/validate_sp_cereal_upstream.py \ PYCAPNP_VER=$(python3 -c "import re; m=re.search(r'name = \"pycapnp\"\nversion = \"([^\"]+)\"', open('uv.lock').read()); print(m.group(1))")
-g -f /tmp/sp_schema.json --cereal-dir openpilot/cereal \ uv run --isolated --with "pycapnp==${PYCAPNP_VER}" \
${{ steps.locate-sp-capnp.outputs.import_args }} python3 cereal/messaging/tests/validate_sp_cereal_upstream.py \
-g -f /tmp/sp_schema.json --cereal-dir cereal
- name: Validate against upstream - name: Validate against upstream
run: | run: |
python3 openpilot/cereal/messaging/tests/validate_sp_cereal_upstream.py \ PYCAPNP_VER=$(python3 -c "import re; m=re.search(r'name = \"pycapnp\"\nversion = \"([^\"]+)\"', open('uv.lock').read()); print(m.group(1))")
uv run --isolated --with "pycapnp==${PYCAPNP_VER}" \
python3 cereal/messaging/tests/validate_sp_cereal_upstream.py \
-r -f /tmp/sp_schema.json --cereal-dir ${{ steps.locate-capnp.outputs.cereal_dir }} \ -r -f /tmp/sp_schema.json --cereal-dir ${{ steps.locate-capnp.outputs.cereal_dir }} \
${{ steps.locate-capnp.outputs.import_args }} ${{ steps.locate-capnp.outputs.import_args }}
+12 -24
View File
@@ -17,41 +17,29 @@ jobs:
- name: Wait for process replay - name: Wait for process replay
id: wait id: wait
continue-on-error: true continue-on-error: true
uses: lewagon/wait-on-check-action@1d57e2c51a58d812d2765e036a028b6bdb5a6154 uses: lewagon/wait-on-check-action@v1.3.4
with: with:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
check-name: process replay check-name: process replay
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
allowed-conclusions: success,failure allowed-conclusions: success,failure
wait-interval: 20 wait-interval: 20
- name: Get tests run ID
if: steps.wait.outcome == 'success'
id: tests-run
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
run_id=$(gh api \
"repos/${{ github.repository }}/actions/workflows/tests.yaml/runs?event=pull_request&head_sha=${{ github.event.pull_request.head.sha }}&per_page=1" \
--jq '.workflow_runs[0].id // empty')
if [ -z "$run_id" ]; then
echo "No tests.yaml run found for ${{ github.event.pull_request.head.sha }}" >&2
exit 1
fi
echo "run-id=$run_id" >> "$GITHUB_OUTPUT"
- name: Download diff - name: Download diff
if: steps.wait.outcome == 'success' if: steps.wait.outcome == 'success'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c uses: dawidd6/action-download-artifact@v6
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }} workflow: tests.yaml
run-id: ${{ steps.tests-run.outputs.run-id }} workflow_conclusion: ''
pr: ${{ github.event.number }}
name: diff_report_${{ github.event.number }} name: diff_report_${{ github.event.number }}
path: . path: .
allow_forks: true
- name: Comment on PR - name: Comment on PR
if: steps.wait.outcome == 'success' if: steps.wait.outcome == 'success'
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b uses: thollander/actions-comment-pull-request@v2
with: with:
file-path: diff_report.txt filePath: diff_report.txt
comment-tag: diff_report comment_tag: diff_report
pr-number: ${{ github.event.number }} pr_number: ${{ github.event.number }}
github-token: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+3 -3
View File
@@ -22,7 +22,7 @@ jobs:
steps: steps:
- uses: commaai/timeout@v1 - uses: commaai/timeout@v1
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with: with:
submodules: true submodules: true
@@ -34,7 +34,7 @@ jobs:
python scripts/docs.py build python scripts/docs.py build
# Push to docs.comma.ai # Push to docs.comma.ai
- uses: actions/checkout@v7 - uses: actions/checkout@v6
if: github.ref == 'refs/heads/master' && github.repository == 'sunnypilot/sunnypilot' if: github.ref == 'refs/heads/master' && github.repository == 'sunnypilot/sunnypilot'
with: with:
path: openpilot-docs path: openpilot-docs
@@ -45,7 +45,7 @@ jobs:
run: | run: |
set -x set -x
source tools/release/identity.sh source release/identity.sh
cd openpilot-docs cd openpilot-docs
git checkout --orphan tmp git checkout --orphan tmp
+4 -4
View File
@@ -11,7 +11,7 @@ jobs:
contents: write contents: write
steps: steps:
- name: Delete stale Jenkins branches - name: Delete stale Jenkins branches
uses: actions/github-script@v9 uses: actions/github-script@v8
with: with:
script: | script: |
const cutoff = Date.now() - 24 * 60 * 60 * 1000; const cutoff = Date.now() - 24 * 60 * 60 * 1000;
@@ -52,7 +52,7 @@ jobs:
steps: steps:
- name: Check for trigger phrase - name: Check for trigger phrase
id: check_comment id: check_comment
uses: actions/github-script@v9 uses: actions/github-script@v8
with: with:
script: | script: |
const triggerPhrase = "trigger-jenkins"; const triggerPhrase = "trigger-jenkins";
@@ -72,7 +72,7 @@ jobs:
- name: Checkout repository - name: Checkout repository
if: steps.check_comment.outputs.result == 'true' if: steps.check_comment.outputs.result == 'true'
uses: actions/checkout@v7 uses: actions/checkout@v6
with: with:
ref: refs/pull/${{ github.event.issue.number }}/head ref: refs/pull/${{ github.event.issue.number }}/head
@@ -86,7 +86,7 @@ jobs:
- name: Delete trigger comment - name: Delete trigger comment
if: steps.check_comment.outputs.result == 'true' && always() if: steps.check_comment.outputs.result == 'true' && always()
uses: actions/github-script@v9 uses: actions/github-script@v8
with: with:
script: | script: |
await github.rest.issues.deleteComment({ await github.rest.issues.deleteComment({
+4 -4
View File
@@ -4,7 +4,7 @@ on:
pull_request: pull_request:
types: [opened, reopened, synchronize] types: [opened, reopened, synchronize]
paths: paths:
- 'openpilot/selfdrive/modeld/models/*.onnx' - 'selfdrive/modeld/models/*.onnx'
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -16,11 +16,11 @@ jobs:
if: github.repository == 'commaai/openpilot' if: github.repository == 'commaai/openpilot'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v7 uses: actions/checkout@v6
with: with:
submodules: true submodules: true
- name: Checkout master - name: Checkout master
uses: actions/checkout@v7 uses: actions/checkout@v6
with: with:
ref: master ref: master
path: base path: base
@@ -36,7 +36,7 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT
- name: Post model report comment - name: Post model report comment
uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 uses: marocchino/sticky-pull-request-comment@baa7203ed60924babbe5dcd0ac8eae3b66ec5e16
with: with:
header: model-review header: model-review
message: ${{ steps.report.outputs.content }} message: ${{ steps.report.outputs.content }}
+3 -3
View File
@@ -15,17 +15,17 @@ jobs:
steps: steps:
- name: Wait for green check mark - name: Wait for green check mark
if: ${{ github.event_name == 'schedule' }} if: ${{ github.event_name == 'schedule' }}
uses: lewagon/wait-on-check-action@1d57e2c51a58d812d2765e036a028b6bdb5a6154 uses: lewagon/wait-on-check-action@ccfb013c15c8afb7bf2b7c028fb74dc5a068cccc
with: with:
ref: master ref: master
wait-interval: 30 wait-interval: 30
running-workflow-name: 'build __nightly' running-workflow-name: 'build __nightly'
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
check-regexp: ^((?!.*(build prebuilt|create badges).*).)*$ check-regexp: ^((?!.*(build prebuilt|create badges).*).)*$
- uses: actions/checkout@v4 # checkout version > v4 breaks nightly release script - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
fetch-depth: 0 fetch-depth: 0
- run: ./tools/op.sh setup - run: ./tools/op.sh setup
- name: Push __nightly - name: Push __nightly
run: BRANCH=__nightly tools/release/build_stripped.sh run: BRANCH=__nightly release/build_stripped.sh
+4 -48
View File
@@ -3,8 +3,6 @@ name: repo maintenance
on: on:
schedule: schedule:
- cron: "0 14 * * 1" # every Monday at 2am UTC (6am PST) - cron: "0 14 * * 1" # every Monday at 2am UTC (6am PST)
pull_request:
types: [closed]
workflow_dispatch: workflow_dispatch:
env: env:
@@ -14,11 +12,9 @@ jobs:
package_updates: package_updates:
name: package_updates name: package_updates
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: >- if: github.repository == 'sunnypilot/sunnypilot'
github.repository == 'sunnypilot/sunnypilot' &&
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with: with:
submodules: true submodules: true
- run: ./tools/op.sh setup - run: ./tools/op.sh setup
@@ -54,10 +50,10 @@ jobs:
git add . git add .
- name: update car docs - name: update car docs
run: | run: |
python openpilot/selfdrive/car/docs.py python selfdrive/car/docs.py
git add docs/CARS.md git add docs/CARS.md
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
with: with:
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
token: ${{ github.repository == 'commaai/openpilot' && secrets.ACTIONS_CREATE_PR_PAT || secrets.GITHUB_TOKEN }} token: ${{ github.repository == 'commaai/openpilot' && secrets.ACTIONS_CREATE_PR_PAT || secrets.GITHUB_TOKEN }}
@@ -79,43 +75,3 @@ jobs:
${{ steps.pip_tree.outputs.PIP_TREE }} ${{ steps.pip_tree.outputs.PIP_TREE }}
``` ```
labels: bot labels: bot
cleanup_closed_branches:
if: github.repository == 'commaai/openpilot'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- uses: actions/github-script@v9
with:
script: |
const { owner, repo } = context.repo;
const upstream = `${owner}/${repo}`;
for await (const response of github.paginate.iterator(github.rest.pulls.list, {
owner,
repo,
state: 'closed',
per_page: 100,
})) {
for (const pr of response.data) {
if (pr.head.repo?.full_name !== upstream) continue;
const branch = pr.head.ref;
try {
await github.rest.git.deleteRef({
owner,
repo,
ref: `heads/${branch}`,
});
console.log(`Deleted branch ${branch} (PR #${pr.number})`);
} catch (error) {
if (error.status === 422 || error.status === 403) {
console.log(`Skipping branch ${branch} (PR #${pr.number}): ${error.message}`);
continue;
}
throw error;
}
}
}
@@ -79,7 +79,7 @@ jobs:
is_stable_branch="$(echo "$CONFIG" | jq -r '.stable_branch // false')"; is_stable_branch="$(echo "$CONFIG" | jq -r '.stable_branch // false')";
echo "is_stable_branch=$is_stable_branch" >> $GITHUB_OUTPUT echo "is_stable_branch=$is_stable_branch" >> $GITHUB_OUTPUT
stable_version=$(cat openpilot/sunnypilot/common/version.h | grep SUNNYPILOT_VERSION | sed -e 's/[^0-9|.]//g'); stable_version=$(cat sunnypilot/common/version.h | grep SUNNYPILOT_VERSION | sed -e 's/[^0-9|.]//g');
echo "version=$([ "$is_stable_branch" = "true" ] && echo "$stable_version" || echo "$BUILD")" >> $GITHUB_OUTPUT echo "version=$([ "$is_stable_branch" = "true" ] && echo "$stable_version" || echo "$BUILD")" >> $GITHUB_OUTPUT
echo "extra_version_identifier=${environment}" >> $GITHUB_OUTPUT echo "extra_version_identifier=${environment}" >> $GITHUB_OUTPUT
fi fi
@@ -177,7 +177,7 @@ jobs:
- name: Build Main Project - name: Build Main Project
run: | run: |
export PYTHONPATH="$BUILD_DIR" export PYTHONPATH="$BUILD_DIR"
./tools/release/release_files.py | sort | uniq | rsync -rRl${RUNNER_DEBUG:+v} --files-from=- . $BUILD_DIR/ ./release/release_files.py | sort | uniq | rsync -rRl${RUNNER_DEBUG:+v} --files-from=- . $BUILD_DIR/
cd $BUILD_DIR cd $BUILD_DIR
sed -i '/from .board.jungle import PandaJungle, PandaJungleDFU/s/^/#/' panda/__init__.py sed -i '/from .board.jungle import PandaJungle, PandaJungleDFU/s/^/#/' panda/__init__.py
echo "Building sunnypilot's modeld_v2..." echo "Building sunnypilot's modeld_v2..."
@@ -208,17 +208,17 @@ jobs:
--exclude='Jenkinsfile' \ --exclude='Jenkinsfile' \
--exclude='**/release/' \ --exclude='**/release/' \
--exclude='**/.github/' \ --exclude='**/.github/' \
--exclude='**/openpilot/selfdrive/ui/replay/' \ --exclude='**/selfdrive/ui/replay/' \
--exclude='**/__pycache__/' \ --exclude='**/__pycache__/' \
--exclude='${{env.SCONS_CACHE_DIR}}' \ --exclude='${{env.SCONS_CACHE_DIR}}' \
--exclude='**/.git/' \ --exclude='**/.git/' \
--exclude='**/SConstruct' \ --exclude='**/SConstruct' \
--exclude='**/SConscript' \ --exclude='**/SConscript' \
--exclude='**/.venv/' \ --exclude='**/.venv/' \
--exclude='openpilot/selfdrive/modeld/models/*.onnx*' \ --exclude='selfdrive/modeld/models/*.onnx*' \
--exclude='openpilot/sunnypilot/modeld*/models/*.onnx*' \ --exclude='sunnypilot/modeld*/models/*.onnx*' \
--exclude='openpilot/third_party/*x86*' \ --exclude='third_party/*x86*' \
--exclude='openpilot/third_party/*Darwin*' \ --exclude='third_party/*Darwin*' \
--delete-excluded \ --delete-excluded \
--chown=comma:comma \ --chown=comma:comma \
${BUILD_DIR}/ ${OUTPUT_DIR}/ ${BUILD_DIR}/ ${OUTPUT_DIR}/
+45 -42
View File
@@ -35,27 +35,27 @@ jobs:
STRIPPED_DIR: /tmp/releasepilot STRIPPED_DIR: /tmp/releasepilot
PYTHONPATH: /tmp/releasepilot PYTHONPATH: /tmp/releasepilot
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with: with:
submodules: true submodules: true
- name: Getting LFS files - name: Getting LFS files
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e
with: with:
timeout_minutes: 2 timeout_minutes: 2
max_attempts: 3 max_attempts: 3
command: git lfs pull command: git lfs pull
- name: Build devel - name: Build devel
timeout-minutes: 3 timeout-minutes: 1
run: TARGET_DIR=$STRIPPED_DIR tools/release/build_stripped.sh run: TARGET_DIR=$STRIPPED_DIR release/build_stripped.sh
- run: ./tools/op.sh setup - run: ./tools/op.sh setup
- name: Build openpilot and run checks - name: Build openpilot and run checks
timeout-minutes: 30 timeout-minutes: 30
working-directory: ${{ env.STRIPPED_DIR }} working-directory: ${{ env.STRIPPED_DIR }}
run: python3 openpilot/system/manager/build.py run: python3 system/manager/build.py
- name: Run tests - name: Run tests
timeout-minutes: 1 timeout-minutes: 1
working-directory: ${{ env.STRIPPED_DIR }} working-directory: ${{ env.STRIPPED_DIR }}
run: tools/release/check-dirty.sh run: release/check-dirty.sh
- name: Check submodules - name: Check submodules
if: github.repository == 'sunnypilot/sunnypilot' if: github.repository == 'sunnypilot/sunnypilot'
timeout-minutes: 3 timeout-minutes: 3
@@ -75,13 +75,15 @@ jobs:
export CHECK_PR_REFS=true export CHECK_PR_REFS=true
fi fi
fi fi
tools/release/check-submodules.sh release/check-submodules.sh
build_mac: build_mac:
name: build macOS name: build macOS
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' }} 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' }}
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with:
submodules: true
- name: Remove Homebrew from environment - name: Remove Homebrew from environment
run: | run: |
FILTERED=$(echo "$PATH" | tr ':' '\n' | grep -v '/opt/homebrew' | tr '\n' ':') FILTERED=$(echo "$PATH" | tr ':' '\n' | grep -v '/opt/homebrew' | tr '\n' ':')
@@ -99,7 +101,9 @@ jobs:
&& fromJSON('["namespace-profile-amd64-8x16"]') && fromJSON('["namespace-profile-amd64-8x16"]')
|| fromJSON('["ubuntu-24.04"]') }} || fromJSON('["ubuntu-24.04"]') }}
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with:
submodules: true
- run: ./tools/op.sh setup - run: ./tools/op.sh setup
- name: Static analysis - name: Static analysis
timeout-minutes: 1 timeout-minutes: 1
@@ -114,18 +118,16 @@ jobs:
&& fromJSON('["namespace-profile-amd64-8x16"]') && fromJSON('["namespace-profile-amd64-8x16"]')
|| fromJSON('["ubuntu-24.04"]') }} || fromJSON('["ubuntu-24.04"]') }}
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with:
submodules: true
- run: ./tools/op.sh setup - run: ./tools/op.sh setup
- name: Install raylib headless dependencies
if: ${{ !contains(runner.name, 'nsc') }}
run: sudo apt-get install -y --no-install-recommends libgles2 libegl1
- name: Build openpilot - name: Build openpilot
run: scons run: scons
- name: Run unit tests - name: Run unit tests
timeout-minutes: ${{ contains(runner.name, 'nsc') && 2 || 999 }} timeout-minutes: ${{ contains(runner.name, 'nsc') && 2 || 999 }}
env:
RAYLIB_BACKEND: headless
run: | run: |
source selfdrive/test/setup_xvfb.sh
# Pre-compile Python bytecode so each pytest worker doesn't need to # Pre-compile Python bytecode so each pytest worker doesn't need to
$PYTEST --collect-only -m 'not slow' -qq $PYTEST --collect-only -m 'not slow' -qq
MAX_EXAMPLES=1 $PYTEST -m 'not slow' MAX_EXAMPLES=1 $PYTEST -m 'not slow'
@@ -140,37 +142,39 @@ jobs:
&& fromJSON('["namespace-profile-amd64-8x16"]') && fromJSON('["namespace-profile-amd64-8x16"]')
|| fromJSON('["ubuntu-24.04"]') }} || fromJSON('["ubuntu-24.04"]') }}
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with:
submodules: true
- run: ./tools/op.sh setup - run: ./tools/op.sh setup
- name: Build openpilot - name: Build openpilot
run: scons run: scons
- name: Run replay - name: Run replay
timeout-minutes: ${{ contains(runner.name, 'nsc') && 2 || 20 }} timeout-minutes: ${{ contains(runner.name, 'nsc') && 2 || 20 }}
continue-on-error: ${{ github.ref == 'refs/heads/master' }} continue-on-error: ${{ github.ref == 'refs/heads/master' }}
run: openpilot/selfdrive/test/process_replay/test_processes.py -j$(nproc) run: selfdrive/test/process_replay/test_processes.py -j$(nproc)
- name: Print diff - name: Print diff
id: print-diff id: print-diff
if: always() if: always()
run: cat openpilot/selfdrive/test/process_replay/diff.txt run: cat selfdrive/test/process_replay/diff.txt
- name: Print diff report - name: Print diff report
if: always() if: always()
run: cat openpilot/selfdrive/test/process_replay/diff_report.txt run: cat selfdrive/test/process_replay/diff_report.txt
- uses: actions/upload-artifact@v7 - uses: actions/upload-artifact@v6
if: always() if: always()
continue-on-error: true continue-on-error: true
with: with:
name: process_replay_diff.txt name: process_replay_diff.txt
path: openpilot/selfdrive/test/process_replay/diff.txt path: selfdrive/test/process_replay/diff.txt
- name: Upload diff report - name: Upload diff report
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v6
if: always() && github.event_name == 'pull_request' if: always() && github.event_name == 'pull_request'
continue-on-error: true continue-on-error: true
with: with:
name: diff_report_${{ github.event.number }} name: diff_report_${{ github.event.number }}
path: openpilot/selfdrive/test/process_replay/diff_report.txt path: selfdrive/test/process_replay/diff_report.txt
- name: Checkout ci-artifacts - name: Checkout ci-artifacts
if: github.repository == 'commaai/openpilot' && github.ref == 'refs/heads/master' if: github.repository == 'commaai/openpilot' && github.ref == 'refs/heads/master'
uses: actions/checkout@v7 uses: actions/checkout@v4
with: with:
repository: commaai/ci-artifacts repository: commaai/ci-artifacts
ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }} ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }}
@@ -183,13 +187,13 @@ jobs:
git config user.email "<>" git config user.email "<>"
git fetch origin process-replay || true git fetch origin process-replay || true
git checkout process-replay 2>/dev/null || git checkout --orphan process-replay git checkout process-replay 2>/dev/null || git checkout --orphan process-replay
cp ${{ github.workspace }}/openpilot/selfdrive/test/process_replay/fakedata/*.zst . cp ${{ github.workspace }}/selfdrive/test/process_replay/fakedata/*.zst .
echo "${{ github.sha }}" > ref_commit echo "${{ github.sha }}" > ref_commit
git add . git add .
git commit -m "process-replay refs for ${{ github.repository }}@${{ github.sha }}" || echo "No changes to commit" git commit -m "process-replay refs for ${{ github.repository }}@${{ github.sha }}" || echo "No changes to commit"
- name: Push refs - name: Push refs
if: github.repository == 'commaai/openpilot' && github.ref == 'refs/heads/master' if: github.repository == 'commaai/openpilot' && github.ref == 'refs/heads/master'
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e
with: with:
timeout_minutes: 2 timeout_minutes: 2
max_attempts: 3 max_attempts: 3
@@ -199,7 +203,7 @@ jobs:
timeout-minutes: 4 timeout-minutes: 4
env: env:
ONNXCPU: 1 ONNXCPU: 1
run: $PYTEST openpilot/selfdrive/test/process_replay/test_regen.py run: $PYTEST selfdrive/test/process_replay/test_regen.py
simulator_driving: simulator_driving:
name: simulator driving name: simulator driving
@@ -211,16 +215,17 @@ jobs:
|| fromJSON('["ubuntu-24.04"]') }} || fromJSON('["ubuntu-24.04"]') }}
if: false # FIXME: Started to timeout recently if: false # FIXME: Started to timeout recently
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with:
submodules: true
- run: ./tools/op.sh setup - run: ./tools/op.sh setup
- name: Build openpilot - name: Build openpilot
run: scons run: scons
- name: Driving test - name: Driving test
timeout-minutes: 2 timeout-minutes: 2
env: run: |
# MetaDrive renders offscreen through panda3d's EGL pipe on llvmpipe source selfdrive/test/setup_xvfb.sh
EGL_PLATFORM: surfaceless pytest -s tools/sim/tests/test_metadrive_bridge.py
run: pytest -s openpilot/tools/sim/tests/test_metadrive_bridge.py
create_ui_report: create_ui_report:
name: Create UI Report name: Create UI Report
@@ -231,21 +236,19 @@ jobs:
&& fromJSON('["namespace-profile-amd64-8x16"]') && fromJSON('["namespace-profile-amd64-8x16"]')
|| fromJSON('["ubuntu-24.04"]') }} || fromJSON('["ubuntu-24.04"]') }}
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with:
submodules: true
- run: ./tools/op.sh setup - run: ./tools/op.sh setup
- name: Install raylib headless dependencies
if: ${{ !contains(runner.name, 'nsc') }}
run: sudo apt-get install -y --no-install-recommends libgles2 libegl1
- name: Build openpilot - name: Build openpilot
run: scons run: scons
- name: Create UI Report - name: Create UI Report
env:
RAYLIB_BACKEND: headless
run: | run: |
python3 openpilot/selfdrive/ui/tests/diff/replay.py source selfdrive/test/setup_xvfb.sh
python3 openpilot/selfdrive/ui/tests/diff/replay.py --big python3 selfdrive/ui/tests/diff/replay.py
python3 selfdrive/ui/tests/diff/replay.py --big
- name: Upload UI Report - name: Upload UI Report
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v6
with: with:
name: ui-report-${{ inputs.run_number || '1' }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 'master' || github.event.number }} name: ui-report-${{ inputs.run_number || '1' }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 'master' || github.event.number }}
path: openpilot/selfdrive/ui/tests/diff/report path: selfdrive/ui/tests/diff/report
+17 -17
View File
@@ -8,9 +8,9 @@ on:
branches: branches:
- 'master' - 'master'
paths: paths:
- 'openpilot/selfdrive/assets/**' - 'selfdrive/assets/**'
- 'openpilot/selfdrive/ui/**' - 'selfdrive/ui/**'
- 'openpilot/system/ui/**' - 'system/ui/**'
workflow_dispatch: workflow_dispatch:
env: env:
@@ -34,12 +34,12 @@ jobs:
pull-requests: write pull-requests: write
actions: read actions: read
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with: with:
submodules: true submodules: true
- name: Waiting for ui generation to end - name: Waiting for ui generation to end
uses: lewagon/wait-on-check-action@1d57e2c51a58d812d2765e036a028b6bdb5a6154 uses: lewagon/wait-on-check-action@v1.3.4
with: with:
ref: ${{ env.SHA }} ref: ${{ env.SHA }}
check-name: ${{ env.UI_JOB_NAME }} check-name: ${{ env.UI_JOB_NAME }}
@@ -53,7 +53,7 @@ jobs:
echo "run_id=$(curl https://api.github.com/repos/${{ github.repository }}/commits/${{ env.SHA }}/check-runs | jq -r '.check_runs[] | select(.name == "${{ env.UI_JOB_NAME }}") | .html_url | capture("(?<number>[0-9]+)") | .number')" >> $GITHUB_OUTPUT echo "run_id=$(curl https://api.github.com/repos/${{ github.repository }}/commits/${{ env.SHA }}/check-runs | jq -r '.check_runs[] | select(.name == "${{ env.UI_JOB_NAME }}") | .html_url | capture("(?<number>[0-9]+)") | .number')" >> $GITHUB_OUTPUT
- name: Getting proposed ui - name: Getting proposed ui
uses: dawidd6/action-download-artifact@b6e2e70617bc3265edd6dab6c906732b2f1ae151 uses: dawidd6/action-download-artifact@v6
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ steps.get_run_id.outputs.run_id }} run_id: ${{ steps.get_run_id.outputs.run_id }}
@@ -62,7 +62,7 @@ jobs:
path: ${{ github.workspace }}/pr_ui path: ${{ github.workspace }}/pr_ui
- name: Getting mici master ui - name: Getting mici master ui
uses: actions/checkout@v7 uses: actions/checkout@v6
with: with:
repository: sunnypilot/ci-artifacts repository: sunnypilot/ci-artifacts
ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }} ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }}
@@ -70,7 +70,7 @@ jobs:
ref: openpilot_master_ui_mici_raylib ref: openpilot_master_ui_mici_raylib
- name: Getting big master ui - name: Getting big master ui
uses: actions/checkout@v7 uses: actions/checkout@v6
with: with:
repository: sunnypilot/ci-artifacts repository: sunnypilot/ci-artifacts
ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }} ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }}
@@ -97,7 +97,7 @@ jobs:
done done
- name: Setup FFmpeg - name: Setup FFmpeg
uses: AnimMouse/setup-ffmpeg@178e0b4a408f06ce40d896c3cd79f50fa6f8b0c3 uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae
- name: Finding diffs - name: Finding diffs
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
@@ -115,13 +115,13 @@ jobs:
cp "${{ github.workspace }}/master_${name}/${video}.mp4" "${{ github.workspace }}/pr_ui/${video}_master.mp4" cp "${{ github.workspace }}/master_${name}/${video}.mp4" "${{ github.workspace }}/pr_ui/${video}_master.mp4"
diff_exit_code=0 diff_exit_code=0
python3 ${{ github.workspace }}/openpilot/selfdrive/ui/tests/diff/diff.py \ python3 ${{ github.workspace }}/selfdrive/ui/tests/diff/diff.py \
"${{ github.workspace }}/pr_ui/${video}_master.mp4" \ "${{ github.workspace }}/pr_ui/${video}_master.mp4" \
"${{ github.workspace }}/pr_ui/${video}_proposed.mp4" \ "${{ github.workspace }}/pr_ui/${video}_proposed.mp4" \
"${diff_name}.html" --basedir "$baseurl" --no-open || diff_exit_code=$? "${diff_name}.html" --basedir "$baseurl" --no-open || diff_exit_code=$?
cp "${{ github.workspace }}/openpilot/selfdrive/ui/tests/diff/report/${diff_name}.html" "${{ github.workspace }}/pr_ui/" cp "${{ github.workspace }}/selfdrive/ui/tests/diff/report/${diff_name}.html" "${{ github.workspace }}/pr_ui/"
cp "${{ github.workspace }}/openpilot/selfdrive/ui/tests/diff/report/${diff_name}.mp4" "${{ github.workspace }}/pr_ui/" cp "${{ github.workspace }}/selfdrive/ui/tests/diff/report/${diff_name}.mp4" "${{ github.workspace }}/pr_ui/"
REPORT_URL="https://sunnypilot.github.io/ci-artifacts/${diff_name}_pr_${{ github.event.number }}.html" REPORT_URL="https://sunnypilot.github.io/ci-artifacts/${diff_name}_pr_${{ github.event.number }}.html"
if [ $diff_exit_code -eq 0 ]; then if [ $diff_exit_code -eq 0 ]; then
@@ -156,7 +156,7 @@ jobs:
for variant in $VARIANTS; do for variant in $VARIANTS; do
IFS=':' read -r name _ _ <<< "$variant" IFS=':' read -r name _ _ <<< "$variant"
diff_name="${name}_diff" diff_name="${name}_diff"
cp "${{ github.workspace }}/openpilot/selfdrive/ui/tests/diff/report/${diff_name}.html" "${diff_name}_pr_${{ github.event.number }}.html" cp "${{ github.workspace }}/selfdrive/ui/tests/diff/report/${diff_name}.html" "${diff_name}_pr_${{ github.event.number }}.html"
git add "${diff_name}_pr_${{ github.event.number }}.html" git add "${diff_name}_pr_${{ github.event.number }}.html"
done done
git commit -m "ui diff reports for PR #${{ github.event.number }}" || echo "No changes to commit" git commit -m "ui diff reports for PR #${{ github.event.number }}" || echo "No changes to commit"
@@ -164,12 +164,12 @@ jobs:
- name: Comment on PR - name: Comment on PR
if: github.event_name == 'pull_request_target' if: github.event_name == 'pull_request_target'
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b uses: thollander/actions-comment-pull-request@v2
with: with:
message: | message: |
<!-- _(run_id_ui_preview **${{ github.run_id }}**)_ --> <!-- _(run_id_ui_preview **${{ github.run_id }}**)_ -->
## UI Preview ## UI Preview
${{ steps.find_diff.outputs.COMMENT }} ${{ steps.find_diff.outputs.COMMENT }}
comment-tag: run_id_ui_preview comment_tag: run_id_ui_preview
pr-number: ${{ github.event.number }} pr_number: ${{ github.event.number }}
github-token: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+9 -16
View File
@@ -15,13 +15,6 @@ a.out
.cache/ .cache/
bin/ bin/
# created at launch for TICI PYTHONPATH (PC uses editable installs via pyproject.toml)
/msgq
/opendbc
/rednose
/teleoprtc
/tinygrad
*.mp4 *.mp4
*.dylib *.dylib
*.DSYM *.DSYM
@@ -51,18 +44,18 @@ bin/
config.json config.json
compile_commands.json compile_commands.json
compare_runtime*.html compare_runtime*.html
openpilot/selfdrive/modeld/models/tg_input_devices.json selfdrive/modeld/models/tg_input_devices.json
# build artifacts # build artifacts
docs_site/ docs_site/
openpilot/selfdrive/pandad/pandad selfdrive/pandad/pandad
openpilot/cereal/services.h cereal/services.h
openpilot/cereal/gen cereal/gen
openpilot/cereal/messaging/bridge cereal/messaging/bridge
openpilot/selfdrive/ui/translations/tmp selfdrive/ui/translations/tmp
openpilot/selfdrive/car/tests/cars_dump selfdrive/car/tests/cars_dump
openpilot/system/camerad/camerad system/camerad/camerad
openpilot/system/camerad/test/ae_gray_test system/camerad/test/ae_gray_test
.coverage* .coverage*
coverage.xml coverage.xml
+2 -2
View File
@@ -6,7 +6,7 @@
url = https://github.com/sunnypilot/opendbc.git url = https://github.com/sunnypilot/opendbc.git
[submodule "msgq"] [submodule "msgq"]
path = msgq_repo path = msgq_repo
url = https://github.com/sunnypilot/msgq.git url = https://github.com/commaai/msgq.git
[submodule "rednose_repo"] [submodule "rednose_repo"]
path = rednose_repo path = rednose_repo
url = https://github.com/commaai/rednose.git url = https://github.com/commaai/rednose.git
@@ -17,5 +17,5 @@
path = tinygrad_repo path = tinygrad_repo
url = https://github.com/sunnypilot/tinygrad.git url = https://github.com/sunnypilot/tinygrad.git
[submodule "sunnypilot/neural_network_data"] [submodule "sunnypilot/neural_network_data"]
path = openpilot/sunnypilot/neural_network_data path = sunnypilot/neural_network_data
url = https://github.com/sunnypilot/neural-network-data.git url = https://github.com/sunnypilot/neural-network-data.git
+4 -4
View File
@@ -6,9 +6,9 @@
"type": "pickString", "type": "pickString",
"description": "Select the process to debug", "description": "Select the process to debug",
"options": [ "options": [
"openpilot/selfdrive/controls/controlsd.py", "selfdrive/controls/controlsd.py",
"openpilot/system/timed/timed.py", "system/timed/timed.py",
"openpilot/tools/sim/run_bridge.py" "tools/sim/run_bridge.py"
] ]
}, },
{ {
@@ -16,7 +16,7 @@
"type": "pickString", "type": "pickString",
"description": "Select the process to debug", "description": "Select the process to debug",
"options": [ "options": [
"openpilot/selfdrive/ui/ui" "selfdrive/ui/ui"
] ]
}, },
{ {
+5
View File
@@ -17,5 +17,10 @@
"**/.git", "**/.git",
"**/.venv", "**/.venv",
"**/__pycache__", "**/__pycache__",
// exclude directories that should be using the symlinked version
"common/**",
"selfdrive/**",
"system/**",
"tools/**",
] ]
} }
+38
View File
@@ -0,0 +1,38 @@
FROM ubuntu:24.04
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends sudo tzdata locales && \
rm -rf /var/lib/apt/lists/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=graphics,utility,compute
ARG USER=batman
ARG USER_UID=1001
RUN useradd -m -s /bin/bash -u $USER_UID $USER
RUN usermod -aG sudo $USER
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $USER
ENV OPENPILOT_PATH=/home/$USER/openpilot
RUN mkdir -p ${OPENPILOT_PATH}
WORKDIR ${OPENPILOT_PATH}
COPY --chown=$USER . ${OPENPILOT_PATH}/
ENV UV_BIN="/home/$USER/.local/bin/"
ENV VIRTUAL_ENV=${OPENPILOT_PATH}/.venv
ENV PATH="$UV_BIN:$VIRTUAL_ENV/bin:$PATH"
RUN tools/setup_dependencies.sh && \
sudo rm -rf /var/lib/apt/lists/*
USER root
RUN git config --global --add safe.directory '*'
Vendored
+26 -28
View File
@@ -12,7 +12,7 @@ def retryWithDelay(int maxRetries, int delay, Closure body) {
def device(String ip, String step_label, String cmd) { def device(String ip, String step_label, String cmd) {
withCredentials([file(credentialsId: 'id_rsa', variable: 'key_file')]) { withCredentials([file(credentialsId: 'id_rsa', variable: 'key_file')]) {
def ssh_cmd = """ def ssh_cmd = """
ssh -o ControlMaster=auto -o ControlPath=/tmp/ssh_control_%C -o ControlPersist=yes -o ConnectTimeout=5 -o ServerAliveInterval=5 -o ServerAliveCountMax=2 -o BatchMode=yes -o StrictHostKeyChecking=no -i ${key_file} 'comma@${ip}' exec /usr/bin/bash <<'END' ssh -o ConnectTimeout=5 -o ServerAliveInterval=5 -o ServerAliveCountMax=2 -o BatchMode=yes -o StrictHostKeyChecking=no -i ${key_file} 'comma@${ip}' exec /usr/bin/bash <<'END'
set -e set -e
@@ -63,8 +63,6 @@ if [ -f /data/openpilot/launch_env.sh ]; then
source /data/openpilot/launch_env.sh source /data/openpilot/launch_env.sh
fi fi
export LD_LIBRARY_PATH="\$(python -c 'import ffmpeg; print(ffmpeg.LIB_DIR)'):/usr/local/lib:\${LD_LIBRARY_PATH:-}"
ln -snf ${env.TEST_DIR} /data/pythonpath ln -snf ${env.TEST_DIR} /data/pythonpath
cd ${env.TEST_DIR} || true cd ${env.TEST_DIR} || true
@@ -95,7 +93,7 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps)
retry (3) { retry (3) {
def date = sh(script: 'date', returnStdout: true).trim(); def date = sh(script: 'date', returnStdout: true).trim();
device(device_ip, "set time", "date -s '" + date + "'") device(device_ip, "set time", "date -s '" + date + "'")
device(device_ip, "git checkout", extra + "\n" + readFile("openpilot/selfdrive/test/setup_device_ci.sh")) device(device_ip, "git checkout", extra + "\n" + readFile("selfdrive/test/setup_device_ci.sh"))
} }
steps.each { item -> steps.each { item ->
def name = item[0] def name = item[0]
@@ -181,7 +179,7 @@ node {
try { try {
if (env.BRANCH_NAME == 'devel-staging') { if (env.BRANCH_NAME == 'devel-staging') {
deviceStage("build release-tizi-staging", "tizi-needs-can", [], [ deviceStage("build release-tizi-staging", "tizi-needs-can", [], [
step("build release-tizi-staging", "RELEASE_BRANCH=release-tizi-staging,release-mici-staging $SOURCE_DIR/tools/release/build_release.sh"), step("build release-tizi-staging", "RELEASE_BRANCH=release-tizi-staging,release-mici-staging $SOURCE_DIR/release/build_release.sh"),
]) ])
} }
@@ -189,12 +187,12 @@ node {
parallel ( parallel (
'nightly': { 'nightly': {
deviceStage("build nightly", "tizi-needs-can", [], [ deviceStage("build nightly", "tizi-needs-can", [], [
step("build nightly", "RELEASE_BRANCH=nightly $SOURCE_DIR/tools/release/build_release.sh"), step("build nightly", "RELEASE_BRANCH=nightly $SOURCE_DIR/release/build_release.sh"),
]) ])
}, },
'nightly-dev': { 'nightly-dev': {
deviceStage("build nightly-dev", "tizi-needs-can", [], [ deviceStage("build nightly-dev", "tizi-needs-can", [], [
step("build nightly-dev", "PANDA_DEBUG_BUILD=1 RELEASE_BRANCH=nightly-dev $SOURCE_DIR/tools/release/build_release.sh"), step("build nightly-dev", "PANDA_DEBUG_BUILD=1 RELEASE_BRANCH=nightly-dev $SOURCE_DIR/release/build_release.sh"),
]) ])
}, },
) )
@@ -204,51 +202,51 @@ node {
parallel ( parallel (
'onroad tests': { 'onroad tests': {
deviceStage("onroad", "tizi-needs-can", ["UNSAFE=1"], [ deviceStage("onroad", "tizi-needs-can", ["UNSAFE=1"], [
step("build openpilot", "cd openpilot/system/manager && ./build.py"), step("build openpilot", "cd system/manager && ./build.py"),
step("check dirty", "tools/release/check-dirty.sh"), step("check dirty", "release/check-dirty.sh"),
step("onroad tests", "pytest openpilot/selfdrive/test/test_onroad.py -s", [timeout: 60]), step("onroad tests", "pytest selfdrive/test/test_onroad.py -s", [timeout: 60]),
]) ])
}, },
'HW + Unit Tests': { 'HW + Unit Tests': {
deviceStage("tizi-hardware", "tizi-common", ["UNSAFE=1"], [ deviceStage("tizi-hardware", "tizi-common", ["UNSAFE=1"], [
step("build", "cd openpilot/system/manager && ./build.py"), step("build", "cd system/manager && ./build.py"),
step("test power draw", "pytest -s openpilot/selfdrive/test//test_power_draw.py"), step("test power draw", "pytest -s system/hardware/tici/tests/test_power_draw.py"),
step("test encoder", "pytest openpilot/system/loggerd/tests/test_encoder.py", [diffPaths: ["openpilot/system/loggerd/"]]), step("test encoder", "LD_LIBRARY_PATH=/usr/local/lib pytest system/loggerd/tests/test_encoder.py", [diffPaths: ["system/loggerd/"]]),
step("test manager", "pytest openpilot/system/manager/test/test_manager.py"), step("test manager", "pytest system/manager/test/test_manager.py"),
]) ])
}, },
'camerad OX03C10': { 'camerad OX03C10': {
deviceStage("OX03C10", "tizi-ox03c10", ["UNSAFE=1"], [ deviceStage("OX03C10", "tizi-ox03c10", ["UNSAFE=1"], [
step("build", "cd openpilot/system/manager && ./build.py"), step("build", "cd system/manager && ./build.py"),
step("test pandad", "pytest openpilot/selfdrive/pandad/tests/test_pandad.py"), step("test pandad", "pytest selfdrive/pandad/tests/test_pandad.py"),
step("test camerad", "pytest openpilot/system/camerad/test/test_camerad.py", [timeout: 90]), step("test camerad", "pytest system/camerad/test/test_camerad.py", [timeout: 90]),
]) ])
}, },
'camerad OS04C10': { 'camerad OS04C10': {
deviceStage("OS04C10", "tici-os04c10", ["UNSAFE=1"], [ deviceStage("OS04C10", "tici-os04c10", ["UNSAFE=1"], [
step("build", "cd openpilot/system/manager && ./build.py"), step("build", "cd system/manager && ./build.py"),
step("test pandad", "pytest openpilot/selfdrive/pandad/tests/test_pandad.py"), step("test pandad", "pytest selfdrive/pandad/tests/test_pandad.py"),
step("test camerad", "pytest openpilot/system/camerad/test/test_camerad.py", [timeout: 90]), step("test camerad", "pytest system/camerad/test/test_camerad.py", [timeout: 90]),
]) ])
}, },
'sensord': { 'sensord': {
deviceStage("LSM + MMC", "tizi-lsmc", ["UNSAFE=1"], [ deviceStage("LSM + MMC", "tizi-lsmc", ["UNSAFE=1"], [
step("build", "cd openpilot/system/manager && ./build.py"), step("build", "cd system/manager && ./build.py"),
step("test sensord", "pytest openpilot/system/sensord/tests/test_sensord.py"), step("test sensord", "pytest system/sensord/tests/test_sensord.py"),
]) ])
}, },
'replay': { 'replay': {
deviceStage("model-replay", "tizi-replay", ["UNSAFE=1"], [ deviceStage("model-replay", "tizi-replay", ["UNSAFE=1"], [
step("build", "cd openpilot/system/manager && ./build.py", [diffPaths: ["openpilot/selfdrive/modeld/", "tinygrad_repo", "openpilot/selfdrive/test/process_replay/model_replay.py"]]), step("build", "cd system/manager && ./build.py", [diffPaths: ["selfdrive/modeld/", "tinygrad_repo", "selfdrive/test/process_replay/model_replay.py"]]),
step("model replay", "openpilot/selfdrive/test/process_replay/model_replay.py", [diffPaths: ["openpilot/selfdrive/modeld/", "tinygrad_repo", "openpilot/selfdrive/test/process_replay/model_replay.py"]]), step("model replay", "selfdrive/test/process_replay/model_replay.py", [diffPaths: ["selfdrive/modeld/", "tinygrad_repo", "selfdrive/test/process_replay/model_replay.py"]]),
]) ])
}, },
'tizi': { 'tizi': {
deviceStage("tizi", "tizi", ["UNSAFE=1"], [ deviceStage("tizi", "tizi", ["UNSAFE=1"], [
step("build openpilot", "cd openpilot/system/manager && ./build.py"), step("build openpilot", "cd system/manager && ./build.py"),
step("test pandad loopback", "pytest openpilot/selfdrive/pandad/tests/test_pandad_loopback.py"), step("test pandad loopback", "pytest selfdrive/pandad/tests/test_pandad_loopback.py"),
step("test pandad spi", "pytest openpilot/selfdrive/pandad/tests/test_pandad_spi.py"), step("test pandad spi", "pytest selfdrive/pandad/tests/test_pandad_spi.py"),
step("test amp", "pytest openpilot/common/hardware/tici/tests/test_amplifier.py"), step("test amp", "pytest system/hardware/tici/tests/test_amplifier.py"),
]) ])
}, },
+1 -1
View File
@@ -1104,7 +1104,7 @@ Version 0.2.1 (2016-12-14)
Version 0.2 (2016-12-12) Version 0.2 (2016-12-12)
========================= =========================
* Car/Radar abstraction layers have shipped, see openpilot/cereal/car.capnp * Car/Radar abstraction layers have shipped, see cereal/car.capnp
* controlsd has been refactored * controlsd has been refactored
* Shipped plant model and testing maneuvers * Shipped plant model and testing maneuvers
* visiond exits more gracefully now * visiond exits more gracefully now
+25 -70
View File
@@ -27,21 +27,6 @@ AddOption('--minimal',
default=(not TICI and not release), default=(not TICI and not release),
help='the minimum build to run openpilot. no tests, tools, etc.') help='the minimum build to run openpilot. no tests, tools, etc.')
submodule_python_paths = [
Dir("#").abspath,
Dir("#msgq_repo").abspath,
Dir("#opendbc_repo").abspath,
Dir("#rednose_repo").abspath,
Dir("#teleoprtc_repo").abspath,
Dir("#tinygrad_repo").abspath,
]
for p in reversed(submodule_python_paths):
if p not in sys.path:
sys.path.insert(0, p)
if external_pythonpath := os.environ.get("PYTHONPATH"):
submodule_python_paths += [p for p in external_pythonpath.split(os.pathsep) if p and p not in submodule_python_paths]
# Detect platform # Detect platform
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
if platform.system() == "Darwin": if platform.system() == "Darwin":
@@ -55,24 +40,9 @@ assert arch in [
"Darwin", # macOS arm64 (x86 not supported) "Darwin", # macOS arm64 (x86 not supported)
] ]
pkg_names = ['acados', 'bzip2', 'capnproto', 'catch2', 'eigen', 'ffmpeg', 'json11', 'ncurses', 'zeromq', 'zstd'] pkg_names = ['acados', 'bzip2', 'capnproto', 'catch2', 'eigen', 'ffmpeg', 'json11', 'libjpeg', 'libyuv', 'ncurses', 'zeromq', 'zstd']
pkgs = [importlib.import_module(name) for name in pkg_names] pkgs = [importlib.import_module(name) for name in pkg_names]
acados = pkgs[pkg_names.index('acados')] acados = pkgs[pkg_names.index('acados')]
ffmpeg = pkgs[pkg_names.index('ffmpeg')]
# Shared package ships .so/.dylib; older device venvs still have static .a only.
# Keep static link deps (x264/z/va/drm) when the installed package is static so
# TICI CI works without upgrading the device venv yet.
# TODO: drop the static fallback once device venvs have comma-deps-ffmpeg>=7.1.0.post94
_ffmpeg_lib_names = os.listdir(ffmpeg.LIB_DIR) if os.path.isdir(ffmpeg.LIB_DIR) else []
ffmpeg_shared = any(
n.startswith('libavcodec.so') or (n.startswith('libavcodec') and n.endswith('.dylib'))
for n in _ffmpeg_lib_names
)
ffmpeg_libs = ['avformat', 'avcodec', 'swresample', 'avutil']
if not ffmpeg_shared:
ffmpeg_libs += ['x264', 'z']
if arch != "Darwin":
ffmpeg_libs += ['va', 'va-drm', 'drm']
acados_include_dirs = [ acados_include_dirs = [
acados.INCLUDE_DIR, acados.INCLUDE_DIR,
os.path.join(acados.INCLUDE_DIR, "blasfeo", "include"), os.path.join(acados.INCLUDE_DIR, "blasfeo", "include"),
@@ -121,7 +91,7 @@ def _libflags(target, source, env, for_signature):
env = Environment( env = Environment(
ENV={ ENV={
"PATH": os.environ['PATH'], "PATH": os.environ['PATH'],
"PYTHONPATH": os.pathsep.join(submodule_python_paths), "PYTHONPATH": Dir("#").abspath,
"ACADOS_SOURCE_DIR": acados.DIR, "ACADOS_SOURCE_DIR": acados.DIR,
"ACADOS_PYTHON_INTERFACE_PATH": acados.TEMPLATE_DIR, "ACADOS_PYTHON_INTERFACE_PATH": acados.TEMPLATE_DIR,
"TERA_PATH": acados.TERA_PATH "TERA_PATH": acados.TERA_PATH
@@ -142,27 +112,22 @@ env = Environment(
CFLAGS=["-std=gnu11"], CFLAGS=["-std=gnu11"],
CXXFLAGS=["-std=c++1z"], CXXFLAGS=["-std=c++1z"],
CPPPATH=[ CPPPATH=[
"#openpilot", "#",
"#msgq_repo", # #include "msgq/..." "#msgq",
"#opendbc_repo", # #include "opendbc/..."
"#rednose_repo", # #include "rednose/..."
"#rednose_repo/rednose", # #include "logger/..." (rednose package root)
"#openpilot/cereal/gen/cpp",
acados_include_dirs, acados_include_dirs,
[x.INCLUDE_DIR for x in pkgs], [x.INCLUDE_DIR for x in pkgs],
"#",
], ],
LIBPATH=[ LIBPATH=[
"#openpilot/common", "#common",
"#msgq_repo", "#msgq_repo",
"#openpilot/selfdrive/pandad", "#selfdrive/pandad",
"#rednose_repo/rednose/helpers", "#rednose/helpers",
[x.LIB_DIR for x in pkgs], [x.LIB_DIR for x in pkgs],
], ],
RPATH=[ffmpeg.LIB_DIR] if ffmpeg_shared else [], RPATH=[],
CYTHONCFILESUFFIX=".cpp", CYTHONCFILESUFFIX=".cpp",
COMPILATIONDB_USE_ABSPATH=True, COMPILATIONDB_USE_ABSPATH=True,
REDNOSE_ROOT="#rednose_repo", REDNOSE_ROOT="#",
tools=["default", "cython", "compilation_db", "rednose_filter"], tools=["default", "cython", "compilation_db", "rednose_filter"],
toolpath=["#site_scons/site_tools", "#rednose_repo/site_scons/site_tools"], toolpath=["#site_scons/site_tools", "#rednose_repo/site_scons/site_tools"],
) )
@@ -225,7 +190,7 @@ else:
np_version = SCons.Script.Value(np.__version__) np_version = SCons.Script.Value(np.__version__)
Export('envCython', 'np_version') Export('envCython', 'np_version')
Export('env', 'arch', 'acados', 'release', 'ffmpeg_libs') Export('env', 'arch', 'acados', 'release')
# Setup cache dir # Setup cache dir
default_cache_dir = '/data/scons_cache' if arch == "larch64" else '/tmp/scons_cache' default_cache_dir = '/data/scons_cache' if arch == "larch64" else '/tmp/scons_cache'
@@ -246,7 +211,7 @@ def prune_cache_dir(target=None, source=None, env=None):
# ********** start building stuff ********** # ********** start building stuff **********
# Build common module # Build common module
SConscript(['openpilot/common/SConscript']) SConscript(['common/SConscript'])
Import('_common') Import('_common')
common = [_common, 'json11', 'zmq'] common = [_common, 'json11', 'zmq']
Export('common') Export('common')
@@ -257,7 +222,7 @@ env_swaglog = env.Clone()
env_swaglog['CXXFLAGS'].append('-DSWAGLOG="\\"common/swaglog.h\\""') env_swaglog['CXXFLAGS'].append('-DSWAGLOG="\\"common/swaglog.h\\""')
SConscript(['msgq_repo/SConscript'], exports={'env': env_swaglog}) SConscript(['msgq_repo/SConscript'], exports={'env': env_swaglog})
SConscript(['openpilot/cereal/SConscript']) SConscript(['cereal/SConscript'])
Import('socketmaster', 'msgq') Import('socketmaster', 'msgq')
messaging = [socketmaster, msgq, 'capnp', 'kj',] messaging = [socketmaster, msgq, 'capnp', 'kj',]
@@ -268,33 +233,34 @@ Export('messaging')
SConscript(['panda/SConscript']) SConscript(['panda/SConscript'])
# Build rednose library # Build rednose library
SConscript(['rednose_repo/rednose/SConscript']) SConscript(['rednose/SConscript'])
# Build system services # Build system services
SConscript([ SConscript([
'openpilot/system/loggerd/SConscript', 'system/loggerd/SConscript',
]) ])
if arch == "larch64": if arch == "larch64":
SConscript(['openpilot/system/camerad/SConscript']) SConscript(['system/camerad/SConscript'])
# Build selfdrive # Build selfdrive
SConscript([ SConscript([
'openpilot/selfdrive/pandad/SConscript', 'selfdrive/pandad/SConscript',
'openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript', 'selfdrive/controls/lib/lateral_mpc_lib/SConscript',
'openpilot/selfdrive/locationd/SConscript', 'selfdrive/controls/lib/longitudinal_mpc_lib/SConscript',
'openpilot/selfdrive/modeld/SConscript', 'selfdrive/locationd/SConscript',
'openpilot/selfdrive/ui/SConscript', 'selfdrive/modeld/SConscript',
'selfdrive/ui/SConscript',
]) ])
SConscript(['openpilot/sunnypilot/SConscript']) SConscript(['sunnypilot/SConscript'])
# Build desktop-only tools # Build desktop-only tools
if GetOption('extras') and arch != "larch64": if GetOption('extras') and arch != "larch64":
SConscript([ SConscript([
'openpilot/tools/replay/SConscript', 'tools/replay/SConscript',
'openpilot/tools/cabana/SConscript', 'tools/cabana/SConscript',
'openpilot/tools/jotpluggler/SConscript', 'tools/jotpluggler/SConscript',
]) ])
@@ -310,8 +276,6 @@ def count_scons_nodes(nodes):
if node in seen: if node in seen:
continue continue
seen.add(node) seen.add(node)
if hasattr(node, 'has_builder') and node.has_builder():
build_product_nodes.add(node)
executor = node.get_executor() executor = node.get_executor()
if executor is not None: if executor is not None:
stack += executor.get_all_prerequisites() + executor.get_all_children() stack += executor.get_all_prerequisites() + executor.get_all_children()
@@ -320,7 +284,6 @@ def count_scons_nodes(nodes):
progress_interval = 5 progress_interval = 5
progress_count = 0 progress_count = 0
build_product_nodes = set()
progress_total = max(1, count_scons_nodes(env.arg2nodes(BUILD_TARGETS or [Dir('.')], env.fs.Entry))) progress_total = max(1, count_scons_nodes(env.arg2nodes(BUILD_TARGETS or [Dir('.')], env.fs.Entry)))
def progress_function(node): def progress_function(node):
@@ -336,11 +299,3 @@ def progress_function(node):
Progress(progress_function, interval=progress_interval) Progress(progress_function, interval=progress_interval)
AddPostAction(BUILD_TARGETS or [Dir('.')], prune_cache_dir) AddPostAction(BUILD_TARGETS or [Dir('.')], prune_cache_dir)
def check_build_product_size(target, source, env):
limit = 50 * 1024 * 1024 # GitHub max size
for t in target:
if hasattr(t, 'isfile') and t.isfile() and (size := os.path.getsize(t.abspath)) > limit:
raise SCons.Errors.UserError(f"{t} is {size / (1024 * 1024):.1f} MiB, exceeding the {limit / (1024 * 1024):.1f} MiB limit")
if not GetOption('extras'):
AddPostAction(list(build_product_nodes), Action(check_build_product_size, None))
@@ -24,17 +24,17 @@ things are not. Read more details [here](https://capnproto.org/language.html).
### Custom forks ### Custom forks
Forks of [openpilot](https://github.com/commaai/openpilot) might want to add things to the messaging Forks of [openpilot](https://github.com/commaai/openpilot) might want to add things to the messaging
spec, however this could conflict with future changes made in mainline openpilot's cereal spec. Rebasing against mainline openpilot spec, however this could conflict with future changes made in mainline cereal/openpilot. Rebasing against mainline openpilot
then means breaking backwards-compatibility with all old logs of your fork. So we added reserved events in then means breaking backwards-compatibility with all old logs of your fork. So we added reserved events in
[custom.capnp](custom.capnp) that we will leave empty in mainline openpilot's cereal spec. **If you only modify those, you can ensure your [custom.capnp](custom.capnp) that we will leave empty in mainline cereal/openpilot. **If you only modify those, you can ensure your
fork will remain backwards-compatible with all versions of mainline openpilot and your fork.** fork will remain backwards-compatible with all versions of mainline openpilot and your fork.**
An example of compatible changes: An example of compatible changes:
```diff ```diff
diff --git a/openpilot/cereal/custom.capnp b/openpilot/cereal/custom.capnp diff --git a/cereal/custom.capnp b/cereal/custom.capnp
index 3348e859e..3365c7b98 100644 index 3348e859e..3365c7b98 100644
--- a/openpilot/cereal/custom.capnp --- a/cereal/custom.capnp
+++ b/openpilot/cereal/custom.capnp +++ b/cereal/custom.capnp
@@ -10,7 +10,11 @@ $Cxx.namespace("cereal"); @@ -10,7 +10,11 @@ $Cxx.namespace("cereal");
# DO rename the structs # DO rename the structs
# DON'T change the identifier (e.g. @0x81c2f05a394cf4af) # DON'T change the identifier (e.g. @0x81c2f05a394cf4af)
@@ -48,10 +48,10 @@ index 3348e859e..3365c7b98 100644
} }
struct CustomReserved1 @0xaedffd8f31e7b55d { struct CustomReserved1 @0xaedffd8f31e7b55d {
diff --git a/openpilot/cereal/log.capnp b/openpilot/cereal/log.capnp diff --git a/cereal/log.capnp b/cereal/log.capnp
index 1209f3fd9..b189f58b6 100644 index 1209f3fd9..b189f58b6 100644
--- a/openpilot/cereal/log.capnp --- a/cereal/log.capnp
+++ b/openpilot/cereal/log.capnp +++ b/cereal/log.capnp
@@ -2558,14 +2558,14 @@ struct Event { @@ -2558,14 +2558,14 @@ struct Event {
# DO change the name of the field # DO change the name of the field
@@ -76,7 +76,7 @@ index 1209f3fd9..b189f58b6 100644
Example Example
--- ---
```python ```python
import openpilot.cereal.messaging as messaging import cereal.messaging as messaging
# in subscriber # in subscriber
sm = messaging.SubMaster(['sensorEvents']) sm = messaging.SubMaster(['sensorEvents'])
+20
View File
@@ -0,0 +1,20 @@
Import('env', 'common', 'msgq')
cereal_dir = Dir('.')
gen_dir = Dir('gen')
# Build cereal
schema_files = ['log.capnp', 'car.capnp', 'deprecated.capnp', 'custom.capnp']
env.Command([f'gen/cpp/{s}.c++' for s in schema_files] + [f'gen/cpp/{s}.h' for s in schema_files],
schema_files,
f"capnpc --src-prefix={cereal_dir.path} $SOURCES -o c++:{gen_dir.path}/cpp/")
cereal = env.Library('cereal', [f'gen/cpp/{s}.c++' for s in schema_files])
# Build messaging
services_h = env.Command(['services.h'], ['services.py'], 'python3 ' + cereal_dir.path + '/services.py > $TARGET')
env.Program('messaging/bridge', ['messaging/bridge.cc', 'messaging/msgq_to_zmq.cc', 'messaging/bridge_zmq.cc'], LIBS=[msgq, common, 'pthread'])
socketmaster = env.Library('socketmaster', ['messaging/socketmaster.cc'])
Export('cereal', 'socketmaster')
+11
View File
@@ -0,0 +1,11 @@
import os
import capnp
from importlib.resources import as_file, files
capnp.remove_import_hook()
with as_file(files("cereal")) as fspath:
CEREAL_PATH = fspath.as_posix()
log = capnp.load(os.path.join(CEREAL_PATH, "log.capnp"))
car = capnp.load(os.path.join(CEREAL_PATH, "car.capnp"))
custom = capnp.load(os.path.join(CEREAL_PATH, "custom.capnp"))
+1
View File
@@ -0,0 +1 @@
../opendbc_repo/opendbc/car/car.capnp
@@ -1,4 +1,4 @@
using Cxx = import "/include/c++.capnp"; using Cxx = import "./include/c++.capnp";
$Cxx.namespace("cereal"); $Cxx.namespace("cereal");
@0xb526ba661d550a59; @0xb526ba661d550a59;
@@ -1,4 +1,4 @@
using Cxx = import "/include/c++.capnp"; using Cxx = import "./include/c++.capnp";
$Cxx.namespace("cereal"); $Cxx.namespace("cereal");
@0x80ef1ec4889c2a63; @0x80ef1ec4889c2a63;
@@ -760,6 +760,18 @@ struct LateralLQRState @0x9024e2d790c82ade {
steeringAngleDesiredDeg @6 :Float32; steeringAngleDesiredDeg @6 :Float32;
} }
struct LateralCurvatureState @0xad9d8095c06f7c61 {
active @0 :Bool;
actualCurvature @1 :Float32;
desiredCurvature @2 :Float32;
error @3 :Float32;
p @4 :Float32;
i @5 :Float32;
f @6 :Float32;
output @7 :Float32;
saturated @8 :Bool;
}
struct LateralPlannerSolution @0x84caeca5a6b4acfe { struct LateralPlannerSolution @0x84caeca5a6b4acfe {
x @0 :List(Float32); x @0 :List(Float32);
y @1 :List(Float32); y @1 :List(Float32);
+30 -90
View File
@@ -1,7 +1,7 @@
using Cxx = import "/include/c++.capnp"; using Cxx = import "./include/c++.capnp";
$Cxx.namespace("cereal"); $Cxx.namespace("cereal");
using Car = import "/car.capnp"; using Car = import "car.capnp";
using Deprecated = import "deprecated.capnp"; using Deprecated = import "deprecated.capnp";
using Custom = import "custom.capnp"; using Custom = import "custom.capnp";
@@ -414,10 +414,6 @@ struct CanData {
struct DeviceState @0xa4d8b5af2aa492eb { struct DeviceState @0xa4d8b5af2aa492eb {
deviceType @45 :InitData.DeviceType; deviceType @45 :InitData.DeviceType;
# usb
chestnutPresent @51 :Bool;
usbState @52 :UsbState;
networkType @22 :NetworkType; networkType @22 :NetworkType;
networkInfo @31 :NetworkInfo; networkInfo @31 :NetworkInfo;
networkStrength @24 :NetworkStrength; networkStrength @24 :NetworkStrength;
@@ -688,47 +684,33 @@ struct PeripheralState {
} }
} }
struct UsbState {
devices @0 :List(Device);
struct Device {
busnum @0 :UInt8;
devnum @1 :UInt8;
vendorId @2 :UInt16;
productId @3 :UInt16;
speedMbps @4 :UInt16;
manufacturer @6 :Text;
product @5 :Text;
linkErrorCount @7 :UInt16;
}
}
struct RadarState @0x9a185389d6fdd05f { struct RadarState @0x9a185389d6fdd05f {
mdMonoTime @6 :UInt64; # for debugging mdMonoTime @6 :UInt64;
carStateMonoTime @11 :UInt64;
radarErrors @13 :Car.RadarData.Error; radarErrors @13 :Car.RadarData.Error;
leadOne @3 :LeadData; leadOne @3 :LeadData;
leadTwo @4 :LeadData; leadTwo @4 :LeadData;
struct LeadData { struct LeadData {
dRel @0 :Float32; # m from the front bumper of the car dRel @0 :Float32;
yRel @1 :Float32; # m in car frame, left positive yRel @1 :Float32;
vRel @2 :Float32; # m/s relative longitudinal speed vRel @2 :Float32;
vLead @4 :Float32; # m/s absolute lead speed aRel @3 :Float32;
vLeadK @8 :Float32; # kalman-filtered lead speed vLead @4 :Float32;
aLeadK @9 :Float32; # kalman-filtered lead accel dPath @6 :Float32;
present @11 :Bool; # true if a lead is present vLat @7 :Float32;
aLeadTau @12 :Float32; # lead accel time constant vLeadK @8 :Float32;
modelProb @13 :Float32; # vision model lead probability aLeadK @9 :Float32;
radar @14 :Bool; # true if lead is radar-matched (vs vision-only) fcw @10 :Bool;
radarTrackId @15 :Int32 = -1; # for debugging status @11 :Bool;
aLeadTau @12 :Float32;
modelProb @13 :Float32;
radar @14 :Bool;
radarTrackId @15 :Int32 = -1;
deprecated :group { deprecated :group {
aRel @3 :Float32;
aLead @5 :Float32; aLead @5 :Float32;
dPath @6 :Float32;
vLat @7 :Float32;
fcw @10 :Bool;
} }
} }
@@ -741,7 +723,6 @@ struct RadarState @0x9a185389d6fdd05f {
calPerc @9 :Int8; calPerc @9 :Int8;
canMonoTimes @10 :List(UInt64); canMonoTimes @10 :List(UInt64);
cumLagMs @5 :Float32; cumLagMs @5 :Float32;
carStateMonoTime @11 :UInt64;
radarErrors @12 :List(Car.RadarData.ErrorDEPRECATED); radarErrors @12 :List(Car.RadarData.ErrorDEPRECATED);
} }
} }
@@ -790,30 +771,13 @@ struct SelfdriveState {
alertStatus @5 :AlertStatus; alertStatus @5 :AlertStatus;
alertSize @6 :AlertSize; alertSize @6 :AlertSize;
alertType @7 :Text; alertType @7 :Text;
alertSound @13 :AudibleAlert; alertSound @8 :Car.CarControl.HUDControl.AudibleAlert;
alertHudVisual @12 :Car.CarControl.HUDControl.VisualAlert; alertHudVisual @12 :Car.CarControl.HUDControl.VisualAlert;
# configurable driving settings # configurable driving settings
experimentalMode @10 :Bool; experimentalMode @10 :Bool;
personality @11 :LongitudinalPersonality; personality @11 :LongitudinalPersonality;
enum AudibleAlert {
none @0;
engage @1;
disengage @2;
refuse @3;
warningSoft @4;
warningImmediate @5;
prompt @6;
promptRepeat @7;
promptDistracted @8;
preAlert @9;
}
enum OpenpilotState @0xdbe58b96d2d1ac61 { enum OpenpilotState @0xdbe58b96d2d1ac61 {
disabled @0; disabled @0;
preEnabled @1; preEnabled @1;
@@ -834,10 +798,6 @@ struct SelfdriveState {
mid @2; mid @2;
full @3; full @3;
} }
deprecated :group {
alertSound @8 :Car.CarControl.HUDControl.AudibleAlert;
}
} }
struct ControlsState @0x97ff69c53601abf1 { struct ControlsState @0x97ff69c53601abf1 {
@@ -858,7 +818,7 @@ struct ControlsState @0x97ff69c53601abf1 {
debugState @59 :LateralDebugState; debugState @59 :LateralDebugState;
torqueState @60 :LateralTorqueState; torqueState @60 :LateralTorqueState;
curvatureState @65 :LateralCurvatureState; curvatureStateDEPRECATED @65 :Deprecated.LateralCurvatureState;
lqrStateDEPRECATED @55 :Deprecated.LateralLQRState; lqrStateDEPRECATED @55 :Deprecated.LateralLQRState;
indiStateDEPRECATED @52 :Deprecated.LateralINDIState; indiStateDEPRECATED @52 :Deprecated.LateralINDIState;
} }
@@ -907,18 +867,6 @@ struct ControlsState @0x97ff69c53601abf1 {
saturated @3 :Bool; saturated @3 :Bool;
} }
struct LateralCurvatureState @0xad9d8095c06f7c61 {
active @0 :Bool;
actualCurvature @1 :Float32;
desiredCurvature @2 :Float32;
error @3 :Float32;
p @4 :Float32;
i @5 :Float32;
f @6 :Float32;
output @7 :Float32;
saturated @8 :Bool;
}
deprecated :group { deprecated :group {
vEgo @0 :Float32; vEgo @0 :Float32;
vEgoRaw @32 :Float32; vEgoRaw @32 :Float32;
@@ -958,7 +906,7 @@ struct ControlsState @0x97ff69c53601abf1 {
alertStatus @38 :SelfdriveState.AlertStatus; alertStatus @38 :SelfdriveState.AlertStatus;
alertSize @39 :SelfdriveState.AlertSize; alertSize @39 :SelfdriveState.AlertSize;
alertType @44 :Text; alertType @44 :Text;
alertSound2 @56 :SelfdriveState.AudibleAlert; alertSound2 @56 :Car.CarControl.HUDControl.AudibleAlert;
engageable @41 :Bool; # can OP be engaged? engageable @41 :Bool; # can OP be engaged?
state @31 :SelfdriveState.OpenpilotState; state @31 :SelfdriveState.OpenpilotState;
enabled @19 :Bool; enabled @19 :Bool;
@@ -1041,6 +989,7 @@ struct ModelDataV2 {
roadEdgeStds @14 :List(Float32); roadEdgeStds @14 :List(Float32);
# predicted lead cars # predicted lead cars
leads @11 :List(LeadDataV2);
leadsV3 @18 :List(LeadDataV3); leadsV3 @18 :List(LeadDataV3);
meta @12 :MetaData; meta @12 :MetaData;
@@ -1050,9 +999,8 @@ struct ModelDataV2 {
action @26: Action; action @26: Action;
lateralPlannerSolutionDEPRECATED @25: Deprecated.LateralPlannerSolution; lateralPlannerSolutionDEPRECATED @25: Deprecated.LateralPlannerSolution;
leadsDEPRECATED @11 :List(LeadDataV2DEPRECATED);
struct LeadDataV2DEPRECATED { struct LeadDataV2 {
prob @0 :Float32; # probability that car is your lead at time t prob @0 :Float32; # probability that car is your lead at time t
t @1 :Float32; t @1 :Float32;
@@ -1172,7 +1120,7 @@ struct EncodeIndex {
} }
} }
struct OperatingSystemLogEntry { struct AndroidLogEntry {
id @0 :UInt8; id @0 :UInt8;
ts @1 :UInt64; ts @1 :UInt64;
priority @2 :UInt8; priority @2 :UInt8;
@@ -1310,7 +1258,7 @@ struct LateralPlan @0xe1e9318e2ae8b51e {
struct LiveLocationKalman { struct LiveLocationKalman {
# More info on reference frames: # More info on reference frames:
# https://github.com/commaai/openpilot/tree/master/openpilot/common/transformations # https://github.com/commaai/openpilot/tree/master/common/transformations
positionECEF @0 : Measurement; positionECEF @0 : Measurement;
positionGeodetic @1 : Measurement; positionGeodetic @1 : Measurement;
@@ -1367,7 +1315,7 @@ struct LiveLocationKalman {
struct LivePose { struct LivePose {
# More info on reference frames: # More info on reference frames:
# https://github.com/commaai/openpilot/tree/master/openpilot/common/transformations # https://github.com/commaai/openpilot/tree/master/common/transformations
orientationNED @0 :XYZMeasurement; orientationNED @0 :XYZMeasurement;
velocityDevice @1 :XYZMeasurement; velocityDevice @1 :XYZMeasurement;
accelerationDevice @2 :XYZMeasurement; accelerationDevice @2 :XYZMeasurement;
@@ -2160,10 +2108,8 @@ struct DriverMonitoringStateDEPRECATED @0xb83cda094a1da284 {
struct DriverMonitoringState { struct DriverMonitoringState {
lockout @0 :Bool; lockout @0 :Bool;
lockoutRecoveryPercent @11 :Int8; alertCountLockoutPercent @1 :Int8;
alert3Count @12 :Int8; alertTimeLockoutPercent @2 :Int8;
noResponseCount @13 :Int8;
noResponseForceDecel @14 :Bool;
alwaysOn @3 :Bool; alwaysOn @3 :Bool;
alwaysOnLockout @4 :Bool; alwaysOnLockout @4 :Bool;
@@ -2227,11 +2173,6 @@ struct DriverMonitoringState {
calibratedPercent @0 :Int8; calibratedPercent @0 :Int8;
offset @1 :Float32; offset @1 :Float32;
} }
deprecated :group {
alertCountLockoutPercent @1 :Int8;
alertTimeLockoutPercent @2 :Int8;
}
} }
struct Boot { struct Boot {
@@ -2306,7 +2247,6 @@ struct LiveDelayData {
lateralDelayEstimateStd @5 :Float32; lateralDelayEstimateStd @5 :Float32;
points @4 :List(Float32); points @4 :List(Float32);
calPerc @6 :Int8; calPerc @6 :Int8;
version @7 :Int32;
enum Status { enum Status {
unestimated @0; unestimated @0;
@@ -2564,7 +2504,7 @@ struct Event {
rawAudioData @147 :AudioData; rawAudioData @147 :AudioData;
# systems stuff # systems stuff
operatingSystemLog @20 :OperatingSystemLogEntry; androidLog @20 :AndroidLogEntry;
managerState @78 :ManagerState; managerState @78 :ManagerState;
procLog @33 :ProcLog; procLog @33 :ProcLog;
clocks @35 :Clocks; clocks @35 :Clocks;
@@ -9,8 +9,8 @@ import time
from typing import Optional, List, Union, Dict from typing import Optional, List, Union, Dict
from openpilot.cereal import log from cereal import log
from openpilot.cereal.services import SERVICE_LIST from cereal.services import SERVICE_LIST
from openpilot.common.utils import MovingAverage from openpilot.common.utils import MovingAverage
NO_TRAVERSAL_LIMIT = 2**64-1 NO_TRAVERSAL_LIMIT = 2**64-1
@@ -1,7 +1,7 @@
#include <cassert> #include <cassert>
#include "openpilot/cereal/messaging/msgq_to_zmq.h" #include "cereal/messaging/msgq_to_zmq.h"
#include "openpilot/cereal/services.h" #include "cereal/services.h"
#include "common/util.h" #include "common/util.h"
ExitHandler do_exit; ExitHandler do_exit;
@@ -1,4 +1,4 @@
#include "openpilot/cereal/messaging/bridge_zmq.h" #include "cereal/messaging/bridge_zmq.h"
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
@@ -8,7 +8,7 @@
#include <capnp/serialize.h> #include <capnp/serialize.h>
#include "openpilot/cereal/gen/cpp/log.capnp.h" #include "cereal/gen/cpp/log.capnp.h"
#include "common/timing.h" #include "common/timing.h"
#include "msgq/ipc.h" #include "msgq/ipc.h"
@@ -1,8 +1,8 @@
#include "openpilot/cereal/messaging/msgq_to_zmq.h" #include "cereal/messaging/msgq_to_zmq.h"
#include <cassert> #include <cassert>
#include "openpilot/cereal/services.h" #include "cereal/services.h"
#include "common/util.h" #include "common/util.h"
extern ExitHandler do_exit; extern ExitHandler do_exit;
@@ -8,7 +8,7 @@
#include <vector> #include <vector>
#include "msgq/impl_msgq.h" #include "msgq/impl_msgq.h"
#include "openpilot/cereal/messaging/bridge_zmq.h" #include "cereal/messaging/bridge_zmq.h"
class MsgqToZmq { class MsgqToZmq {
public: public:
@@ -3,8 +3,8 @@
#include <string> #include <string>
#include <mutex> #include <mutex>
#include "openpilot/cereal/services.h" #include "cereal/services.h"
#include "openpilot/cereal/messaging/messaging.h" #include "cereal/messaging/messaging.h"
const bool SIMULATION = (getenv("SIMULATION") != nullptr) && (std::string(getenv("SIMULATION")) == "1"); const bool SIMULATION = (getenv("SIMULATION") != nullptr) && (std::string(getenv("SIMULATION")) == "1");
@@ -8,10 +8,9 @@ import time
from openpilot.common.parameterized import parameterized from openpilot.common.parameterized import parameterized
import pytest import pytest
from openpilot.cereal import log from cereal import log, car
from opendbc.car.structs import car import cereal.messaging as messaging
import openpilot.cereal.messaging as messaging from cereal.services import SERVICE_LIST
from openpilot.cereal.services import SERVICE_LIST
events = [evt for evt in log.Event.schema.union_fields if evt in SERVICE_LIST.keys()] events = [evt for evt in log.Event.schema.union_fields if evt in SERVICE_LIST.keys()]
@@ -2,11 +2,11 @@ import random
import time import time
from typing import Sized, cast from typing import Sized, cast
import openpilot.cereal.messaging as messaging import cereal.messaging as messaging
from openpilot.cereal.messaging.tests.test_messaging import events, random_sock, random_socks, \ from cereal.messaging.tests.test_messaging import events, random_sock, random_socks, \
random_bytes, random_carstate, assert_carstate, \ random_bytes, random_carstate, assert_carstate, \
zmq_sleep zmq_sleep
from openpilot.cereal.services import SERVICE_LIST from cereal.services import SERVICE_LIST
class TestSubMaster: class TestSubMaster:
@@ -1,10 +1,10 @@
import subprocess import os
import tempfile import tempfile
from typing import Dict
from openpilot.common.parameterized import parameterized from openpilot.common.parameterized import parameterized
import openpilot.cereal.services as services import cereal.services as services
from openpilot.cereal.services import SERVICE_LIST from cereal.services import SERVICE_LIST
class TestServices: class TestServices:
@@ -17,5 +17,5 @@ class TestServices:
def test_generated_header(self): def test_generated_header(self):
with tempfile.NamedTemporaryFile(suffix=".h") as f: with tempfile.NamedTemporaryFile(suffix=".h") as f:
ret = subprocess.run(f"python3 {services.__file__} > {f.name} && clang++ {f.name} -std=c++11", shell=True).returncode ret = os.system(f"python3 {services.__file__} > {f.name} && clang++ {f.name} -std=c++11")
assert ret == 0, "generated services header is not valid C" assert ret == 0, "generated services header is not valid C"
@@ -41,7 +41,7 @@ _services: dict[str, tuple] = {
"liveCalibration": (True, 4., 4), "liveCalibration": (True, 4., 4),
"liveTorqueParameters": (True, 4., 1), "liveTorqueParameters": (True, 4., 1),
"liveDelay": (True, 4., 1), "liveDelay": (True, 4., 1),
"operatingSystemLog": (True, 0.), "androidLog": (True, 0.),
"carState": (True, 100., 10), "carState": (True, 100., 10),
"carControl": (True, 100., 10), "carControl": (True, 100., 10),
"carOutput": (True, 100., 10), "carOutput": (True, 100., 10),
@@ -5,7 +5,6 @@ common_libs = [
'swaglog.cc', 'swaglog.cc',
'util.cc', 'util.cc',
'ratekeeper.cc', 'ratekeeper.cc',
'yuv.cc',
] ]
_common = env.Library('common', common_libs, LIBS="json11") _common = env.Library('common', common_libs, LIBS="json11")
@@ -13,7 +12,7 @@ Export('_common')
if GetOption('extras'): if GetOption('extras'):
env.Program('tests/test_common', env.Program('tests/test_common',
['tests/test_runner.cc', 'tests/test_util.cc', 'tests/test_swaglog.cc'], ['tests/test_runner.cc', 'tests/test_params.cc', 'tests/test_util.cc', 'tests/test_swaglog.cc'],
LIBS=[_common, 'json11', 'zmq', 'pthread']) LIBS=[_common, 'json11', 'zmq', 'pthread'])
# Cython bindings # Cython bindings
@@ -3,8 +3,8 @@ import os
import requests import requests
import unicodedata import unicodedata
from datetime import datetime, timedelta, UTC from datetime import datetime, timedelta, UTC
from openpilot.common.hardware.hw import Paths from openpilot.system.hardware.hw import Paths
from openpilot.common.version import get_version from openpilot.system.version import get_version
# name: jwt signature algorithm # name: jwt signature algorithm
KEYS = {"id_rsa": "RS256", KEYS = {"id_rsa": "RS256",
@@ -1,4 +1,4 @@
import os import os
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../..")) BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))
@@ -1,5 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import io
import sys import sys
import math import math
import os import os
@@ -22,12 +21,13 @@ def get_chunk_targets(path, file_size):
def chunk_file(path, targets): def chunk_file(path, targets):
manifest_path, *chunk_paths = targets manifest_path, *chunk_paths = targets
actual_num_chunks = max(1, math.ceil(os.path.getsize(path) / CHUNK_SIZE))
assert len(chunk_paths) >= actual_num_chunks, f"Allowed {len(chunk_paths)} chunks but needs at least {actual_num_chunks}, for path {path}"
with open(path, 'rb') as f: with open(path, 'rb') as f:
for chunk_path in chunk_paths: data = f.read()
with open(chunk_path, 'wb') as out: actual_num_chunks = max(1, math.ceil(len(data) / CHUNK_SIZE))
out.write(f.read(CHUNK_SIZE)) assert len(chunk_paths) >= actual_num_chunks, f"Allowed {len(chunk_paths)} chunks but needs at least {actual_num_chunks}, for path {path}"
for i, chunk_path in enumerate(chunk_paths):
with open(chunk_path, 'wb') as f:
f.write(data[i * CHUNK_SIZE:(i + 1) * CHUNK_SIZE])
Path(manifest_path).write_text(str(len(chunk_paths))) Path(manifest_path).write_text(str(len(chunk_paths)))
os.remove(path) os.remove(path)
@@ -39,40 +39,14 @@ def get_existing_chunks(path):
return _chunk_paths(path, num_chunks) return _chunk_paths(path, num_chunks)
raise FileNotFoundError(path) raise FileNotFoundError(path)
class ChunkStream(io.RawIOBase): def read_file_chunked(path):
def __init__(self, paths):
self._paths = iter(paths)
self._buf = memoryview(b'')
def readable(self):
return True
def readinto(self, b):
n = 0
while n < len(b):
if not self._buf:
p = next(self._paths, None)
if p is None:
break
with open(p, 'rb') as f:
self._buf = memoryview(f.read())
continue
take = min(len(b) - n, len(self._buf))
b[n:n + take] = self._buf[:take]
self._buf = self._buf[take:]
n += take
return n
def open_file_chunked(path):
manifest_path = get_manifest_path(path) manifest_path = get_manifest_path(path)
if os.path.isfile(manifest_path): if os.path.isfile(manifest_path):
num_chunks = int(Path(manifest_path).read_text().strip()) num_chunks = int(Path(manifest_path).read_text().strip())
paths = [get_chunk_name(path, i, num_chunks) for i in range(num_chunks)] return b''.join(Path(get_chunk_name(path, i, num_chunks)).read_bytes() for i in range(num_chunks))
elif os.path.isfile(path): if os.path.isfile(path):
paths = [path] return Path(path).read_bytes()
else: raise FileNotFoundError(path)
raise FileNotFoundError(path)
return io.BufferedReader(ChunkStream(paths))
if __name__ == "__main__": if __name__ == "__main__":
@@ -1,13 +1,13 @@
""" """
Utilities for generating mock messages for testing. Utilities for generating mock messages for testing.
example in openpilot/common/tests/test_mock.py example in common/tests/test_mock.py
""" """
import functools import functools
import threading import threading
from openpilot.cereal.messaging import PubMaster from cereal.messaging import PubMaster
from openpilot.cereal.services import SERVICE_LIST from cereal.services import SERVICE_LIST
from openpilot.common.mock.generators import generate_livePose from openpilot.common.mock.generators import generate_livePose
from openpilot.common.realtime import Ratekeeper from openpilot.common.realtime import Ratekeeper
@@ -1,4 +1,4 @@
from openpilot.cereal import messaging from cereal import messaging
def generate_livePose(): def generate_livePose():
@@ -12,7 +12,7 @@
#include "common/queue.h" #include "common/queue.h"
#include "common/swaglog.h" #include "common/swaglog.h"
#include "common/util.h" #include "common/util.h"
#include "common/hardware/hw.h" #include "system/hardware/hw.h"
namespace { namespace {
@@ -3,7 +3,7 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include "openpilot/cereal/gen/cpp/log.capnp.h" #include "cereal/gen/cpp/log.capnp.h"
inline static std::unordered_map<std::string, ParamKeyAttributes> keys = { inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"AccessToken", {CLEAR_ON_MANAGER_START | DONT_LOG, STRING}}, {"AccessToken", {CLEAR_ON_MANAGER_START | DONT_LOG, STRING}},
@@ -58,11 +58,12 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"IsDriverViewEnabled", {CLEAR_ON_MANAGER_START, BOOL}}, {"IsDriverViewEnabled", {CLEAR_ON_MANAGER_START, BOOL}},
{"IsEngaged", {PERSISTENT, BOOL}}, {"IsEngaged", {PERSISTENT, BOOL}},
{"IsLdwEnabled", {PERSISTENT | BACKUP, BOOL}}, {"IsLdwEnabled", {PERSISTENT | BACKUP, BOOL}},
{"IsLiveStreaming", {CLEAR_ON_MANAGER_START, BOOL}},
{"IsMetric", {PERSISTENT | BACKUP, BOOL}}, {"IsMetric", {PERSISTENT | BACKUP, BOOL}},
{"IsOffroad", {CLEAR_ON_MANAGER_START, BOOL}}, {"IsOffroad", {CLEAR_ON_MANAGER_START, BOOL}},
{"IsOnroad", {PERSISTENT, BOOL}},
{"IsRhdDetected", {PERSISTENT, BOOL}}, {"IsRhdDetected", {PERSISTENT, BOOL}},
{"IsReleaseBranch", {CLEAR_ON_MANAGER_START, BOOL}}, {"IsReleaseBranch", {CLEAR_ON_MANAGER_START, BOOL}},
{"IsTakingSnapshot", {CLEAR_ON_MANAGER_START, BOOL}},
{"IsTestedBranch", {CLEAR_ON_MANAGER_START, BOOL}}, {"IsTestedBranch", {CLEAR_ON_MANAGER_START, BOOL}},
{"JoystickDebugMode", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION, BOOL}}, {"JoystickDebugMode", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION, BOOL}},
{"LanguageSetting", {PERSISTENT | BACKUP, STRING, "en"}}, {"LanguageSetting", {PERSISTENT | BACKUP, STRING, "en"}},
@@ -80,7 +81,6 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"LiveParameters", {PERSISTENT, JSON}}, {"LiveParameters", {PERSISTENT, JSON}},
{"LiveParametersV2", {PERSISTENT, BYTES}}, {"LiveParametersV2", {PERSISTENT, BYTES}},
{"LivestreamEncoderBitrate", {CLEAR_ON_MANAGER_START | DONT_LOG, INT}}, {"LivestreamEncoderBitrate", {CLEAR_ON_MANAGER_START | DONT_LOG, INT}},
{"LivestreamRequestKeyframe", {CLEAR_ON_MANAGER_START | DONT_LOG, BOOL}},
{"LiveTorqueParameters", {PERSISTENT | DONT_LOG, BYTES}}, {"LiveTorqueParameters", {PERSISTENT | DONT_LOG, BYTES}},
{"LocationFilterInitialState", {PERSISTENT, BYTES}}, {"LocationFilterInitialState", {PERSISTENT, BYTES}},
{"LateralManeuverMode", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION, BOOL}}, {"LateralManeuverMode", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION, BOOL}},
@@ -93,6 +93,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"Offroad_ConnectivityNeeded", {CLEAR_ON_MANAGER_START, JSON}}, {"Offroad_ConnectivityNeeded", {CLEAR_ON_MANAGER_START, JSON}},
{"Offroad_ConnectivityNeededPrompt", {CLEAR_ON_MANAGER_START, JSON}}, {"Offroad_ConnectivityNeededPrompt", {CLEAR_ON_MANAGER_START, JSON}},
{"Offroad_ExcessiveActuation", {PERSISTENT, JSON}}, {"Offroad_ExcessiveActuation", {PERSISTENT, JSON}},
{"Offroad_IsTakingSnapshot", {CLEAR_ON_MANAGER_START, JSON}},
{"Offroad_NeosUpdate", {CLEAR_ON_MANAGER_START, JSON}}, {"Offroad_NeosUpdate", {CLEAR_ON_MANAGER_START, JSON}},
{"Offroad_NoFirmware", {CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION, JSON}}, {"Offroad_NoFirmware", {CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION, JSON}},
{"Offroad_Recalibration", {CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION, JSON}}, {"Offroad_Recalibration", {CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION, JSON}},
@@ -5,7 +5,7 @@
#include "common/params.h" #include "common/params.h"
#include "common/util.h" #include "common/util.h"
#include "common/hardware/hw.h" #include "system/hardware/hw.h"
class OpenpilotPrefix { class OpenpilotPrefix {
public: public:
@@ -5,9 +5,9 @@ import uuid
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.common.hardware import PC from openpilot.system.hardware import PC
from openpilot.common.hardware.hw import Paths from openpilot.system.hardware.hw import Paths
from openpilot.common.hardware.hw import DEFAULT_DOWNLOAD_CACHE_ROOT from openpilot.system.hardware.hw import DEFAULT_DOWNLOAD_CACHE_ROOT
class OpenpilotPrefix: class OpenpilotPrefix:
def __init__(self, prefix: str | None = None, create_dirs_on_enter: bool = True, clean_dirs_on_exit: bool = True, shared_download_cache: bool = False): def __init__(self, prefix: str | None = None, create_dirs_on_enter: bool = True, clean_dirs_on_exit: bool = True, shared_download_cache: bool = False):
@@ -7,7 +7,7 @@ import time
from setproctitle import getproctitle from setproctitle import getproctitle
from openpilot.common.utils import MovingAverage from openpilot.common.utils import MovingAverage
from openpilot.common.hardware import PC from openpilot.system.hardware import PC
# time step for each process # time step for each process
@@ -8,7 +8,7 @@ class Spinner:
try: try:
self.spinner_proc = subprocess.Popen(["./spinner.py"], self.spinner_proc = subprocess.Popen(["./spinner.py"],
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
cwd=os.path.join(BASEDIR, "openpilot/system", "ui"), cwd=os.path.join(BASEDIR, "system", "ui"),
close_fds=True) close_fds=True)
except OSError: except OSError:
self.spinner_proc = None self.spinner_proc = None
@@ -13,7 +13,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "json11/json11.hpp" #include "json11/json11.hpp"
#include "common/version.h" #include "common/version.h"
#include "common/hardware/hw.h" #include "system/hardware/hw.h"
#include "sunnypilot/common/version.h" #include "sunnypilot/common/version.h"
@@ -8,7 +8,7 @@ from logging.handlers import BaseRotatingHandler
import zmq import zmq
from openpilot.common.logging_extra import SwagLogger, SwagFormatter, SwagLogFileFormatter from openpilot.common.logging_extra import SwagLogger, SwagFormatter, SwagLogFileFormatter
from openpilot.common.hardware.hw import Paths from openpilot.system.hardware.hw import Paths
def get_file_handler(): def get_file_handler():
+27
View File
@@ -0,0 +1,27 @@
#include "catch2/catch.hpp"
#define private public
#include "common/params.h"
#include "common/util.h"
TEST_CASE("params_nonblocking_put") {
char tmp_path[] = "/tmp/asyncWriter_XXXXXX";
const std::string param_path = mkdtemp(tmp_path);
auto param_names = {"CarParams", "IsMetric"};
{
Params params(param_path);
for (const auto &name : param_names) {
params.putNonBlocking(name, "1");
// param is empty
REQUIRE(params.get(name).empty());
}
// check if thread is running
REQUIRE(params.future.valid());
REQUIRE(params.future.wait_for(std::chrono::milliseconds(0)) == std::future_status::timeout);
}
// check results
Params p(param_path);
for (const auto &name : param_names) {
REQUIRE(p.get(name) == "1");
}
}
@@ -6,7 +6,7 @@
#include "common/swaglog.h" #include "common/swaglog.h"
#include "common/util.h" #include "common/util.h"
#include "common/version.h" #include "common/version.h"
#include "common/hardware/hw.h" #include "system/hardware/hw.h"
#include "json11/json11.hpp" #include "json11/json11.hpp"
#include "sunnypilot/common/version.h" #include "sunnypilot/common/version.h"
@@ -10,7 +10,7 @@ class TextWindow:
try: try:
self.text_proc = subprocess.Popen(["./text.py", text], self.text_proc = subprocess.Popen(["./text.py", text],
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
cwd=os.path.join(BASEDIR, "openpilot/system", "ui"), cwd=os.path.join(BASEDIR, "system", "ui"),
close_fds=True) close_fds=True)
except OSError: except OSError:
self.text_proc = None self.text_proc = None

Some files were not shown because too many files have changed in this diff Show More