diff --git a/.github/labeler.yaml b/.github/labeler.yaml index 63d41d5b7..2481a112c 100644 --- a/.github/labeler.yaml +++ b/.github/labeler.yaml @@ -4,24 +4,24 @@ CI / testing: car: - changed-files: - - any-glob-to-all-files: '{selfdrive/car/**,opendbc_repo}' + - any-glob-to-all-files: '{openpilot/selfdrive/car/**,opendbc_repo}' simulation: - changed-files: - - any-glob-to-all-files: 'tools/sim/**' + - any-glob-to-all-files: 'openpilot/tools/sim/**' ui: - changed-files: - - any-glob-to-all-files: '{selfdrive/assets/**,selfdrive/ui/**,system/ui/**}' + - any-glob-to-all-files: '{openpilot/selfdrive/assets/**,openpilot/selfdrive/ui/**,openpilot/system/ui/**}' tools: - changed-files: - - any-glob-to-all-files: 'tools/**' + - any-glob-to-all-files: 'openpilot/tools/**' multilanguage: - changed-files: - - any-glob-to-all-files: 'selfdrive/ui/translations/**' + - any-glob-to-all-files: 'openpilot/selfdrive/ui/translations/**' autonomy: - changed-files: - - any-glob-to-all-files: "{selfdrive/modeld/models/**,selfdrive/test/process_replay/model_replay_ref_commit}" + - any-glob-to-all-files: "{openpilot/selfdrive/modeld/models/**,openpilot/selfdrive/test/process_replay/model_replay_ref_commit}" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 2b4a5ed48..b98627309 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -44,8 +44,8 @@ Explain how you tested this bug fix. **Checklist** -- [ ] 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/selfdrive/car/tests/routes.py) +- [ ] added entry to CAR in openpilot/selfdrive/car/*/values.py and ran `openpilot/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) - [ ] route with openpilot: - [ ] route with stock system: - [ ] car harness used (if comma doesn't sell it, put N/A): diff --git a/.github/workflows/model_review.yaml b/.github/workflows/model_review.yaml index 2775dbc57..66f0398d0 100644 --- a/.github/workflows/model_review.yaml +++ b/.github/workflows/model_review.yaml @@ -4,7 +4,7 @@ on: pull_request: types: [opened, reopened, synchronize] paths: - - 'selfdrive/modeld/models/*.onnx' + - 'openpilot/selfdrive/modeld/models/*.onnx' workflow_dispatch: jobs: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a90f064b8..ae6a2655a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,6 +26,6 @@ jobs: with: submodules: true fetch-depth: 0 - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: Push master-ci run: BRANCH=__nightly release/build_stripped.sh diff --git a/.github/workflows/repo-maintenance.yaml b/.github/workflows/repo-maintenance.yaml index f829415f4..14c613fbe 100644 --- a/.github/workflows/repo-maintenance.yaml +++ b/.github/workflows/repo-maintenance.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: uv lock run: uv lock --upgrade - name: uv pip tree @@ -46,7 +46,7 @@ jobs: git add . - name: update car docs run: | - python selfdrive/car/docs.py + python openpilot/selfdrive/car/docs.py git add docs/CARS.md - name: Create Pull Request uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index bccc6b572..3ed0829a2 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -47,11 +47,11 @@ jobs: - name: Build devel timeout-minutes: 1 run: TARGET_DIR=$STRIPPED_DIR release/build_stripped.sh - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: Build openpilot and run checks timeout-minutes: 30 working-directory: ${{ env.STRIPPED_DIR }} - run: python3 system/manager/build.py + run: python3 openpilot/system/manager/build.py - name: Run tests timeout-minutes: 1 working-directory: ${{ env.STRIPPED_DIR }} @@ -72,7 +72,7 @@ jobs: run: | FILTERED=$(echo "$PATH" | tr ':' '\n' | grep -v '/opt/homebrew' | tr '\n' ':') echo "PATH=${FILTERED}/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" >> $GITHUB_ENV - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: Building openpilot run: scons @@ -88,7 +88,7 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: Static analysis timeout-minutes: 1 run: scripts/lint/lint.sh @@ -105,13 +105,13 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: Build openpilot run: scons - name: Run unit tests timeout-minutes: ${{ contains(runner.name, 'nsc') && 2 || 20 }} run: | - source selfdrive/test/setup_xvfb.sh + source openpilot/selfdrive/test/setup_xvfb.sh # Pre-compile Python bytecode so each pytest worker doesn't need to $PYTEST --collect-only -m 'not slow' -qq MAX_EXAMPLES=1 $PYTEST -m 'not slow' @@ -128,33 +128,33 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: Build openpilot run: scons - name: Run replay timeout-minutes: ${{ contains(runner.name, 'nsc') && 2 || 20 }} continue-on-error: ${{ github.ref == 'refs/heads/master' }} - run: selfdrive/test/process_replay/test_processes.py -j$(nproc) + run: openpilot/selfdrive/test/process_replay/test_processes.py -j$(nproc) - name: Print diff id: print-diff if: always() - run: cat selfdrive/test/process_replay/diff.txt + run: cat openpilot/selfdrive/test/process_replay/diff.txt - name: Print diff report if: always() - run: cat selfdrive/test/process_replay/diff_report.txt + run: cat openpilot/selfdrive/test/process_replay/diff_report.txt - uses: actions/upload-artifact@v6 if: always() continue-on-error: true with: name: process_replay_diff.txt - path: selfdrive/test/process_replay/diff.txt + path: openpilot/selfdrive/test/process_replay/diff.txt - name: Upload diff report uses: actions/upload-artifact@v6 if: always() && github.event_name == 'pull_request' continue-on-error: true with: name: diff_report_${{ github.event.number }} - path: selfdrive/test/process_replay/diff_report.txt + path: openpilot/selfdrive/test/process_replay/diff_report.txt - name: Checkout ci-artifacts if: github.repository == 'commaai/openpilot' && github.ref == 'refs/heads/master' uses: actions/checkout@v4 @@ -170,7 +170,7 @@ jobs: git config user.email "<>" git fetch origin process-replay || true git checkout process-replay 2>/dev/null || git checkout --orphan process-replay - cp ${{ github.workspace }}/selfdrive/test/process_replay/fakedata/*.zst . + cp ${{ github.workspace }}/openpilot/selfdrive/test/process_replay/fakedata/*.zst . echo "${{ github.sha }}" > ref_commit git add . git commit -m "process-replay refs for ${{ github.repository }}@${{ github.sha }}" || echo "No changes to commit" @@ -186,7 +186,7 @@ jobs: timeout-minutes: 4 env: ONNXCPU: 1 - run: $PYTEST selfdrive/test/process_replay/test_regen.py + run: $PYTEST openpilot/selfdrive/test/process_replay/test_regen.py simulator_driving: name: simulator driving @@ -201,14 +201,14 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: Build openpilot run: scons - name: Driving test timeout-minutes: 2 run: | - source selfdrive/test/setup_xvfb.sh - pytest -s tools/sim/tests/test_metadrive_bridge.py + source openpilot/selfdrive/test/setup_xvfb.sh + pytest -s openpilot/tools/sim/tests/test_metadrive_bridge.py create_ui_report: name: Create UI Report @@ -222,16 +222,16 @@ jobs: - uses: actions/checkout@v6 with: submodules: true - - run: ./tools/op.sh setup + - run: ./openpilot/tools/op.sh setup - name: Build openpilot run: scons - name: Create UI Report run: | - source selfdrive/test/setup_xvfb.sh - python3 selfdrive/ui/tests/diff/replay.py - python3 selfdrive/ui/tests/diff/replay.py --big + source openpilot/selfdrive/test/setup_xvfb.sh + python3 openpilot/selfdrive/ui/tests/diff/replay.py + python3 openpilot/selfdrive/ui/tests/diff/replay.py --big - name: Upload UI Report uses: actions/upload-artifact@v6 with: name: ui-report-${{ inputs.run_number || '1' }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 'master' || github.event.number }} - path: selfdrive/ui/tests/diff/report + path: openpilot/selfdrive/ui/tests/diff/report diff --git a/.github/workflows/ui_preview.yaml b/.github/workflows/ui_preview.yaml index 72ced4985..7bfaea63a 100644 --- a/.github/workflows/ui_preview.yaml +++ b/.github/workflows/ui_preview.yaml @@ -8,9 +8,9 @@ on: branches: - 'master' paths: - - 'selfdrive/assets/**' - - 'selfdrive/ui/**' - - 'system/ui/**' + - 'openpilot/selfdrive/assets/**' + - 'openpilot/selfdrive/ui/**' + - 'openpilot/system/ui/**' workflow_dispatch: env: @@ -115,13 +115,13 @@ jobs: cp "${{ github.workspace }}/master_${name}/${video}.mp4" "${{ github.workspace }}/pr_ui/${video}_master.mp4" diff_exit_code=0 - python3 ${{ github.workspace }}/selfdrive/ui/tests/diff/diff.py \ + python3 ${{ github.workspace }}/openpilot/selfdrive/ui/tests/diff/diff.py \ "${{ github.workspace }}/pr_ui/${video}_master.mp4" \ "${{ github.workspace }}/pr_ui/${video}_proposed.mp4" \ "${diff_name}.html" --basedir "$baseurl" --no-open || diff_exit_code=$? - cp "${{ github.workspace }}/selfdrive/ui/tests/diff/report/${diff_name}.html" "${{ github.workspace }}/pr_ui/" - cp "${{ github.workspace }}/selfdrive/ui/tests/diff/report/${diff_name}.mp4" "${{ github.workspace }}/pr_ui/" + cp "${{ github.workspace }}/openpilot/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/" REPORT_URL="https://commaai.github.io/ci-artifacts/${diff_name}_pr_${{ github.event.number }}.html" if [ $diff_exit_code -eq 0 ]; then @@ -156,7 +156,7 @@ jobs: for variant in $VARIANTS; do IFS=':' read -r name _ _ <<< "$variant" diff_name="${name}_diff" - cp "${{ github.workspace }}/selfdrive/ui/tests/diff/report/${diff_name}.html" "${diff_name}_pr_${{ github.event.number }}.html" + cp "${{ github.workspace }}/openpilot/selfdrive/ui/tests/diff/report/${diff_name}.html" "${diff_name}_pr_${{ github.event.number }}.html" git add "${diff_name}_pr_${{ github.event.number }}.html" done git commit -m "ui diff reports for PR #${{ github.event.number }}" || echo "No changes to commit" diff --git a/Jenkinsfile b/Jenkinsfile index 90f86b196..c06674a5c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -93,7 +93,7 @@ def deviceStage(String stageName, String deviceType, List extra_env, def steps) retry (3) { def date = sh(script: 'date', returnStdout: true).trim(); device(device_ip, "set time", "date -s '" + date + "'") - device(device_ip, "git checkout", extra + "\n" + readFile("selfdrive/test/setup_device_ci.sh")) + device(device_ip, "git checkout", extra + "\n" + readFile("openpilot/selfdrive/test/setup_device_ci.sh")) } steps.each { item -> def name = item[0] @@ -202,51 +202,51 @@ node { parallel ( 'onroad tests': { deviceStage("onroad", "tizi-needs-can", ["UNSAFE=1"], [ - step("build openpilot", "cd system/manager && ./build.py"), + step("build openpilot", "cd openpilot/system/manager && ./build.py"), step("check dirty", "release/check-dirty.sh"), - step("onroad tests", "pytest selfdrive/test/test_onroad.py -s", [timeout: 60]), + step("onroad tests", "pytest openpilot/selfdrive/test/test_onroad.py -s", [timeout: 60]), ]) }, 'HW + Unit Tests': { deviceStage("tizi-hardware", "tizi-common", ["UNSAFE=1"], [ - step("build", "cd system/manager && ./build.py"), - step("test power draw", "pytest -s selfdrive/test//test_power_draw.py"), - step("test encoder", "LD_LIBRARY_PATH=/usr/local/lib pytest system/loggerd/tests/test_encoder.py", [diffPaths: ["system/loggerd/"]]), - step("test manager", "pytest system/manager/test/test_manager.py"), + step("build", "cd openpilot/system/manager && ./build.py"), + step("test power draw", "pytest -s openpilot/selfdrive/test//test_power_draw.py"), + step("test encoder", "LD_LIBRARY_PATH=/usr/local/lib pytest openpilot/system/loggerd/tests/test_encoder.py", [diffPaths: ["openpilot/system/loggerd/"]]), + step("test manager", "pytest openpilot/system/manager/test/test_manager.py"), ]) }, 'camerad OX03C10': { deviceStage("OX03C10", "tizi-ox03c10", ["UNSAFE=1"], [ - step("build", "cd system/manager && ./build.py"), - step("test pandad", "pytest selfdrive/pandad/tests/test_pandad.py"), - step("test camerad", "pytest system/camerad/test/test_camerad.py", [timeout: 90]), + step("build", "cd openpilot/system/manager && ./build.py"), + step("test pandad", "pytest openpilot/selfdrive/pandad/tests/test_pandad.py"), + step("test camerad", "pytest openpilot/system/camerad/test/test_camerad.py", [timeout: 90]), ]) }, 'camerad OS04C10': { deviceStage("OS04C10", "tici-os04c10", ["UNSAFE=1"], [ - step("build", "cd system/manager && ./build.py"), - step("test pandad", "pytest selfdrive/pandad/tests/test_pandad.py"), - step("test camerad", "pytest system/camerad/test/test_camerad.py", [timeout: 90]), + step("build", "cd openpilot/system/manager && ./build.py"), + step("test pandad", "pytest openpilot/selfdrive/pandad/tests/test_pandad.py"), + step("test camerad", "pytest openpilot/system/camerad/test/test_camerad.py", [timeout: 90]), ]) }, 'sensord': { deviceStage("LSM + MMC", "tizi-lsmc", ["UNSAFE=1"], [ - step("build", "cd system/manager && ./build.py"), - step("test sensord", "pytest system/sensord/tests/test_sensord.py"), + step("build", "cd openpilot/system/manager && ./build.py"), + step("test sensord", "pytest openpilot/system/sensord/tests/test_sensord.py"), ]) }, 'replay': { deviceStage("model-replay", "tizi-replay", ["UNSAFE=1"], [ - step("build", "cd system/manager && ./build.py", [diffPaths: ["selfdrive/modeld/", "tinygrad_repo", "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"]]), + step("build", "cd openpilot/system/manager && ./build.py", [diffPaths: ["openpilot/selfdrive/modeld/", "tinygrad_repo", "openpilot/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"]]), ]) }, 'tizi': { deviceStage("tizi", "tizi", ["UNSAFE=1"], [ - step("build openpilot", "cd system/manager && ./build.py"), - step("test pandad loopback", "pytest selfdrive/pandad/tests/test_pandad_loopback.py"), - step("test pandad spi", "pytest selfdrive/pandad/tests/test_pandad_spi.py"), - step("test amp", "pytest common/hardware/tici/tests/test_amplifier.py"), + step("build openpilot", "cd openpilot/system/manager && ./build.py"), + step("test pandad loopback", "pytest openpilot/selfdrive/pandad/tests/test_pandad_loopback.py"), + step("test pandad spi", "pytest openpilot/selfdrive/pandad/tests/test_pandad_spi.py"), + step("test amp", "pytest openpilot/common/hardware/tici/tests/test_amplifier.py"), ]) }, diff --git a/README.md b/README.md index 480b14003..0f248cf35 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ openpilot is developed by [comma](https://comma.ai/) and by users like you. We w * Join the [community Discord](https://discord.comma.ai) * Check out [the contributing docs](docs/CONTRIBUTING.md) -* Check out the [openpilot tools](tools/) +* Check out the [openpilot tools](openpilot/tools/) * Code documentation lives at https://docs.comma.ai * Information about running openpilot lives on the [community wiki](https://github.com/commaai/openpilot/wiki) diff --git a/SConstruct b/SConstruct index 41bc5d7d0..2e4002f1f 100644 --- a/SConstruct +++ b/SConstruct @@ -113,15 +113,16 @@ env = Environment( CXXFLAGS=["-std=c++1z"], CPPPATH=[ "#", + "#openpilot", "#msgq", "#openpilot/cereal/gen/cpp", acados_include_dirs, [x.INCLUDE_DIR for x in pkgs], ], LIBPATH=[ - "#common", + "#openpilot/common", "#msgq_repo", - "#selfdrive/pandad", + "#openpilot/selfdrive/pandad", "#rednose/helpers", [x.LIB_DIR for x in pkgs], ], @@ -211,7 +212,7 @@ def prune_cache_dir(target=None, source=None, env=None): # ********** start building stuff ********** # Build common module -SConscript(['common/SConscript']) +SConscript(['openpilot/common/SConscript']) Import('_common') common = [_common, 'json11', 'zmq'] Export('common') @@ -237,28 +238,28 @@ SConscript(['rednose/SConscript']) # Build system services SConscript([ - 'system/loggerd/SConscript', + 'openpilot/system/loggerd/SConscript', ]) if arch == "larch64": - SConscript(['system/camerad/SConscript']) + SConscript(['openpilot/system/camerad/SConscript']) # Build selfdrive SConscript([ - 'selfdrive/pandad/SConscript', - 'selfdrive/controls/lib/lateral_mpc_lib/SConscript', - 'selfdrive/controls/lib/longitudinal_mpc_lib/SConscript', - 'selfdrive/locationd/SConscript', - 'selfdrive/modeld/SConscript', - 'selfdrive/ui/SConscript', + 'openpilot/selfdrive/pandad/SConscript', + 'openpilot/selfdrive/controls/lib/lateral_mpc_lib/SConscript', + 'openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript', + 'openpilot/selfdrive/locationd/SConscript', + 'openpilot/selfdrive/modeld/SConscript', + 'openpilot/selfdrive/ui/SConscript', ]) # Build desktop-only tools if GetOption('extras') and arch != "larch64": SConscript([ - 'tools/replay/SConscript', - 'tools/cabana/SConscript', - 'tools/jotpluggler/SConscript', + 'openpilot/tools/replay/SConscript', + 'openpilot/tools/cabana/SConscript', + 'openpilot/tools/jotpluggler/SConscript', ]) diff --git a/common/hardware/tici/agnos.py b/common/hardware/tici/agnos.py index c5ca7efb4..0210821a0 100755 --- a/common/hardware/tici/agnos.py +++ b/common/hardware/tici/agnos.py @@ -12,7 +12,7 @@ import requests SPARSE_CHUNK_FMT = struct.Struct('H2xI4x') -AGNOS_MANIFEST_FILE = "system/hardware/tici/agnos.json" +AGNOS_MANIFEST_FILE = "openpilot/system/hardware/tici/agnos.json" class StreamingDecompressor: diff --git a/common/mock/__init__.py b/common/mock/__init__.py index 673513fdd..ff4dd32b9 100644 --- a/common/mock/__init__.py +++ b/common/mock/__init__.py @@ -1,6 +1,6 @@ """ Utilities for generating mock messages for testing. -example in common/tests/test_mock.py +example in openpilot/common/tests/test_mock.py """ diff --git a/common/spinner.py b/common/spinner.py index 12a816eaf..f15228513 100755 --- a/common/spinner.py +++ b/common/spinner.py @@ -8,7 +8,7 @@ class Spinner: try: self.spinner_proc = subprocess.Popen(["./spinner.py"], stdin=subprocess.PIPE, - cwd=os.path.join(BASEDIR, "system", "ui"), + cwd=os.path.join(BASEDIR, "openpilot/system", "ui"), close_fds=True) except OSError: self.spinner_proc = None diff --git a/common/text_window.py b/common/text_window.py index 358243d1f..94cfa7811 100755 --- a/common/text_window.py +++ b/common/text_window.py @@ -10,7 +10,7 @@ class TextWindow: try: self.text_proc = subprocess.Popen(["./text.py", text], stdin=subprocess.PIPE, - cwd=os.path.join(BASEDIR, "system", "ui"), + cwd=os.path.join(BASEDIR, "openpilot/system", "ui"), close_fds=True) except OSError: self.text_proc = None diff --git a/common/version.py b/common/version.py index 0cea616d2..011161b99 100755 --- a/common/version.py +++ b/common/version.py @@ -20,7 +20,7 @@ terms_version: str = "2" def get_version(path: str = BASEDIR) -> str: - with open(os.path.join(path, "common", "version.h")) as _versionf: + with open(os.path.join(path, "openpilot", "common", "version.h")) as _versionf: version = _versionf.read().split('"')[1] return version diff --git a/conftest.py b/conftest.py index 6307f8304..48d42aed8 100644 --- a/conftest.py +++ b/conftest.py @@ -9,10 +9,10 @@ from openpilot.common.hardware import TICI, HARDWARE # these are heavy CI-only tests, invoked explicitly in .github/workflows/tests.yaml collect_ignore = [ - "selfdrive/test/process_replay/test_processes.py", - "selfdrive/test/process_replay/test_regen.py", + "openpilot/selfdrive/test/process_replay/test_processes.py", + "openpilot/selfdrive/test/process_replay/test_regen.py", - "tools/sim/", + "openpilot/tools/sim/", ] diff --git a/docs/CARS.md b/docs/CARS.md index 1f86abb4f..b0891b836 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -1,4 +1,4 @@ - + # Supported Cars diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index cbeb5f6d3..393819830 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -6,7 +6,7 @@ Development is coordinated through [Discord](https://discord.comma.ai) and GitHu ### Getting Started -* Set up your [development environment](/tools/) +* Set up your [development environment](/openpilot/tools/) * Join our [Discord](https://discord.comma.ai) * Docs are at https://docs.comma.ai and https://blog.comma.ai diff --git a/docs/SAFETY.md b/docs/SAFETY.md index 0a662ac6c..5857c6d5b 100644 --- a/docs/SAFETY.md +++ b/docs/SAFETY.md @@ -35,8 +35,8 @@ For additional safety implementation details, refer to [panda safety model](http ### Forks of openpilot -* Do not disable or nerf [driver monitoring](https://github.com/commaai/openpilot/tree/master/selfdrive/monitoring) -* Do not disable or nerf [excessive actuation checks](https://github.com/commaai/openpilot/tree/master/selfdrive/selfdrived/helpers.py) +* Do not disable or nerf [driver monitoring](https://github.com/commaai/openpilot/tree/master/openpilot/selfdrive/monitoring) +* Do not disable or nerf [excessive actuation checks](https://github.com/commaai/openpilot/tree/master/openpilot/selfdrive/selfdrived/helpers.py) * If your fork modifies any of the code in `opendbc/safety/`: * your fork cannot use the openpilot trademark * your fork must preserve the full [safety test suite](https://github.com/commaai/opendbc/tree/master/opendbc/safety/tests) and all tests must pass, including any new coverage required by the fork's changes diff --git a/docs/concepts/logs.md b/docs/concepts/logs.md index 4fa720ddd..8ba2486ab 100644 --- a/docs/concepts/logs.md +++ b/docs/concepts/logs.md @@ -2,7 +2,7 @@ openpilot records routes in one minute chunks called segments. A route starts on the rising edge of ignition and ends on the falling edge. -Check out our [Python library](https://github.com/commaai/openpilot/blob/master/tools/lib/logreader.py) for reading openpilot logs. Also checkout our [tools](https://github.com/commaai/openpilot/tree/master/tools) to replay and view your data. These are the same tools we use to debug and develop openpilot. +Check out our [Python library](https://github.com/commaai/openpilot/blob/master/openpilot/tools/lib/logreader.py) for reading openpilot logs. Also checkout our [tools](https://github.com/commaai/openpilot/tree/master/tools) to replay and view your data. These are the same tools we use to debug and develop openpilot. For each segment, openpilot records the following log types: diff --git a/docs/how-to/car-port.md b/docs/how-to/car-port.md index ca565e53f..c4106f91a 100644 --- a/docs/how-to/car-port.md +++ b/docs/how-to/car-port.md @@ -30,7 +30,7 @@ Each car brand is supported by a standard interface structure in `opendbc/car/[b For historical reasons, openpilot still contains a small amount of car-specific logic. This will eventually be migrated to opendbc or otherwise removed. -* `selfdrive/car/car_specific.py`: Brand-specific event logic +* `openpilot/selfdrive/car/car_specific.py`: Brand-specific event logic # How do I port car? diff --git a/docs/how-to/replay-a-drive.md b/docs/how-to/replay-a-drive.md index a11b29dcc..129e7b830 100644 --- a/docs/how-to/replay-a-drive.md +++ b/docs/how-to/replay-a-drive.md @@ -5,7 +5,7 @@ Replaying is a critical tool for openpilot development and debugging. ## Replaying a route *Hardware required: none* -Just run `tools/replay/replay --demo`. +Just run `openpilot/tools/replay/replay --demo`. ## Replaying CAN data *Hardware required: jungle and comma four* diff --git a/docs/how-to/turn-the-speed-blue.md b/docs/how-to/turn-the-speed-blue.md index b5692daff..5cfa8e176 100644 --- a/docs/how-to/turn-the-speed-blue.md +++ b/docs/how-to/turn-the-speed-blue.md @@ -28,10 +28,10 @@ scons We'll run the `replay` tool with the demo route to get data streaming for testing our UI changes. ```bash # in terminal 1 -tools/replay/replay --demo +openpilot/tools/replay/replay --demo # in terminal 2 -./selfdrive/ui/ui.py +./openpilot/selfdrive/ui/ui.py ``` The openpilot UI should launch and show a replay of the demo route. @@ -45,10 +45,10 @@ Now let’s update the speed display color in the UI. Search for the function responsible for rendering the current speed: ```bash -git grep "_draw_current_speed" selfdrive/ui/onroad/hud_renderer.py +git grep "_draw_current_speed" openpilot/selfdrive/ui/onroad/hud_renderer.py ``` -You'll find the relevant code inside `selfdrive/ui/onroad/hud_renderer.py`, in this function: +You'll find the relevant code inside `openpilot/selfdrive/ui/onroad/hud_renderer.py`, in this function: ```python def _draw_current_speed(self, rect: rl.Rectangle) -> None: @@ -72,7 +72,7 @@ Change `COLORS.white` to make it **blue** instead of white. A nice soft blue is After making changes, re-run the UI to see your new UI: ```bash -./selfdrive/ui/ui.py +./openpilot/selfdrive/ui/ui.py ``` ![](https://blog.comma.ai/img/blue_speed_ui.png) diff --git a/launch_chffrplus.sh b/launch_chffrplus.sh index 46b0a5d07..17a765e07 100755 --- a/launch_chffrplus.sh +++ b/launch_chffrplus.sh @@ -19,12 +19,12 @@ function agnos_init { # Check if AGNOS update is required if [ $(< /VERSION) != "$AGNOS_VERSION" ]; then - AGNOS_PY="$DIR/common/hardware/tici/agnos.py" - MANIFEST="$DIR/system/hardware/tici/agnos.json" + AGNOS_PY="$DIR/openpilot/common/hardware/tici/agnos.py" + MANIFEST="$DIR/openpilot/system/hardware/tici/agnos.json" if $AGNOS_PY --verify $MANIFEST; then sudo reboot fi - $DIR/common/hardware/tici/updater $AGNOS_PY $MANIFEST + $DIR/openpilot/common/hardware/tici/updater $AGNOS_PY $MANIFEST fi } @@ -79,7 +79,7 @@ function launch { tmux capture-pane -pq -S-1000 > /tmp/launch_log # start manager - cd system/manager + cd openpilot/system/manager if [ ! -f $DIR/prebuilt ]; then ./build.py fi diff --git a/openpilot/cereal/README.md b/openpilot/cereal/README.md index 419d38088..17f27fd74 100644 --- a/openpilot/cereal/README.md +++ b/openpilot/cereal/README.md @@ -24,17 +24,17 @@ things are not. Read more details [here](https://capnproto.org/language.html). ### Custom forks 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 cereal/openpilot. Rebasing against mainline openpilot +spec, however this could conflict with future changes made in mainline openpilot's cereal spec. Rebasing against mainline openpilot 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 cereal/openpilot. **If you only modify those, you can ensure your +[custom.capnp](custom.capnp) that we will leave empty in mainline openpilot's cereal spec. **If you only modify those, you can ensure your fork will remain backwards-compatible with all versions of mainline openpilot and your fork.** An example of compatible changes: ```diff -diff --git a/cereal/custom.capnp b/cereal/custom.capnp +diff --git a/openpilot/cereal/custom.capnp b/openpilot/cereal/custom.capnp index 3348e859e..3365c7b98 100644 ---- a/cereal/custom.capnp -+++ b/cereal/custom.capnp +--- a/openpilot/cereal/custom.capnp ++++ b/openpilot/cereal/custom.capnp @@ -10,7 +10,11 @@ $Cxx.namespace("cereal"); # DO rename the structs # DON'T change the identifier (e.g. @0x81c2f05a394cf4af) @@ -48,10 +48,10 @@ index 3348e859e..3365c7b98 100644 } struct CustomReserved1 @0xaedffd8f31e7b55d { -diff --git a/cereal/log.capnp b/cereal/log.capnp +diff --git a/openpilot/cereal/log.capnp b/openpilot/cereal/log.capnp index 1209f3fd9..b189f58b6 100644 ---- a/cereal/log.capnp -+++ b/cereal/log.capnp +--- a/openpilot/cereal/log.capnp ++++ b/openpilot/cereal/log.capnp @@ -2558,14 +2558,14 @@ struct Event { # DO change the name of the field diff --git a/openpilot/cereal/log.capnp b/openpilot/cereal/log.capnp index 02536e46b..beb71c8da 100644 --- a/openpilot/cereal/log.capnp +++ b/openpilot/cereal/log.capnp @@ -1270,7 +1270,7 @@ struct LateralPlan @0xe1e9318e2ae8b51e { struct LiveLocationKalman { # More info on reference frames: - # https://github.com/commaai/openpilot/tree/master/common/transformations + # https://github.com/commaai/openpilot/tree/master/openpilot/common/transformations positionECEF @0 : Measurement; positionGeodetic @1 : Measurement; @@ -1327,7 +1327,7 @@ struct LiveLocationKalman { struct LivePose { # More info on reference frames: - # https://github.com/commaai/openpilot/tree/master/common/transformations + # https://github.com/commaai/openpilot/tree/master/openpilot/common/transformations orientationNED @0 :XYZMeasurement; velocityDevice @1 :XYZMeasurement; accelerationDevice @2 :XYZMeasurement; diff --git a/pyproject.toml b/pyproject.toml index 53a237a22..8cff68a17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,9 +128,9 @@ allow-direct-references = true [tool.pytest.ini_options] minversion = "6.0" -addopts = "--ignore=openpilot/common --ignore=openpilot/selfdrive --ignore=openpilot/system --ignore=openpilot/tools --ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ --ignore=teleoprtc_repo/ --ignore=msgq/ --ignore=selfdrive/modeld -Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup" +addopts = "-Werror --strict-config --strict-markers --durations=10 -n auto --dist=loadgroup" cpp_files = "test_*" -cpp_harness = "selfdrive/test/cpp_harness.py" +cpp_harness = "openpilot/selfdrive/test/cpp_harness.py" python_files = "test_*.py" markers = [ "slow: tests that take awhile to run and can be skipped with -m 'not slow'", @@ -141,11 +141,7 @@ markers = [ "xdist_group_class_property: group tests by a property of the class that contains them", ] testpaths = [ - "common", - "selfdrive", - "system", - "tools", - "openpilot/cereal", + "openpilot", ] [tool.codespell] @@ -153,7 +149,7 @@ quiet-level = 3 # if you've got a short variable name that's getting flagged, add it here ignore-words-list = "bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn,ws,uint,grey,deque,stdio,amin,BA,LITE,atEnd,UIs,errorString,arange,FocusIn,od,tim,relA,hist,copyable,jupyter,thead,TGE,abl,lite,ser" builtin = "clear,rare,informal,code,names,en-GB_to_en-US" -skip = "../tinygrad/*, ./tinygrad_repo/*, ./msgq/*, ./panda/*, ./opendbc/*, ./opendbc_repo/*, ./rednose/*, ./rednose_repo/*, ./teleoprtc/*, ./teleoprtc_repo/*, *.po, uv.lock, *.onnx, *.pem, ./openpilot/cereal/gen/*, */c_generated_code/*, docs/assets/*, tools/plotjuggler/layouts/*, selfdrive/assets/offroad/mici_fcc.html" +skip = "*.po, uv.lock, *.onnx, *.pem, */c_generated_code/*, docs/assets/*, tools/plotjuggler/layouts/*, openpilot/tools/plotjuggler/layouts/*, selfdrive/assets/offroad/mici_fcc.html, openpilot/selfdrive/assets/offroad/mici_fcc.html" # https://docs.astral.sh/ruff/configuration/#using-pyprojecttoml [tool.ruff] @@ -180,13 +176,6 @@ lint.ignore = [ line-length = 160 exclude = [ "openpilot/cereal", - "panda", - "opendbc", - "opendbc_repo", - "rednose_repo", - "tinygrad_repo", - "teleoprtc", - "teleoprtc_repo", "*.ipynb", "generated", ] @@ -211,21 +200,6 @@ lint.flake8-implicit-str-concat.allow-multiline = false [tool.ruff.format] quote-style = "preserve" -[tool.ty.src] -exclude = [ - "msgq/", - "msgq_repo/", - "opendbc/", - "opendbc_repo/", - "panda/", - "rednose/", - "rednose_repo/", - "tinygrad/", - "tinygrad_repo/", - "teleoprtc/", - "teleoprtc_repo/", -] - [tool.ty.rules] unresolved-import = "ignore" # Cython-compiled modules (.pyx) unresolved-attribute = "ignore" # many from capnp and Cython modules diff --git a/release/README.md b/release/README.md index 7aeea9fe4..f3dcefd58 100644 --- a/release/README.md +++ b/release/README.md @@ -12,7 +12,7 @@ - [ ] push to staging: - [ ] make sure you are on the newly created release master branch (`zerotentwo`) - [ ] run `BRANCH=devel-staging release/build_stripped.sh`. Jenkins will then automatically build staging on device, run `test_onroad` and update the staging branch -- [ ] bump version on master: `common/version.h` and `RELEASES.md` +- [ ] bump version on master: `openpilot/common/version.h` and `RELEASES.md` - [ ] post on Discord, tag `@release crew` ### Go to release diff --git a/release/build_release.sh b/release/build_release.sh index cec6f4ecd..4f609aea3 100755 --- a/release/build_release.sh +++ b/release/build_release.sh @@ -41,7 +41,7 @@ cd $BUILD_DIR rm -f panda/board/obj/panda.bin.signed rm -f panda/board/obj/panda_h7.bin.signed -VERSION=$(cat common/version.h | awk -F[\"-] '{print $2}') +VERSION=$(cat openpilot/common/version.h | awk -F[\"-] '{print $2}') echo "[-] committing version $VERSION T=$SECONDS" git add -f . git commit -a -m "openpilot v$VERSION release" @@ -74,7 +74,7 @@ find . -name '*.pyc' -delete find . -name 'moc_*' -delete find . -name '__pycache__' -delete rm -rf .sconsign.dblite Jenkinsfile release/ -rm -f selfdrive/modeld/models/*.onnx* +rm -f openpilot/selfdrive/modeld/models/*.onnx* # Mark as prebuilt release touch prebuilt @@ -85,8 +85,8 @@ git commit --amend -m "openpilot v$VERSION" # Run tests cd $BUILD_DIR -RELEASE=1 pytest -n0 -s selfdrive/test/test_onroad.py -#pytest selfdrive/car/tests/test_car_interfaces.py +RELEASE=1 pytest -n0 -s openpilot/selfdrive/test/test_onroad.py +#pytest openpilot/selfdrive/car/tests/test_car_interfaces.py echo "[-] pushing release T=$SECONDS" REFS=() diff --git a/release/build_stripped.sh b/release/build_stripped.sh index 91c94b44a..ea74aac85 100755 --- a/release/build_stripped.sh +++ b/release/build_stripped.sh @@ -45,13 +45,13 @@ cd $TARGET_DIR rm -rf .git/modules/ rm -f panda/board/obj/panda.bin.signed -find selfdrive/modeld/models -name '*.onnx' -size +95M -exec ./common/file_chunker.py {} \; +find openpilot/selfdrive/modeld/models -name '*.onnx' -size +95M -exec ./openpilot/common/file_chunker.py {} \; # include source commit hash and build date in commit GIT_HASH=$(git --git-dir=$SOURCE_DIR/.git rev-parse HEAD) GIT_COMMIT_DATE=$(git --git-dir=$SOURCE_DIR/.git show --no-patch --format='%ct %ci' HEAD) DATETIME=$(date '+%Y-%m-%dT%H:%M:%S') -VERSION=$(cat $SOURCE_DIR/common/version.h | awk -F\" '{print $2}') +VERSION=$(cat $SOURCE_DIR/openpilot/common/version.h | awk -F\" '{print $2}') echo -n "$GIT_HASH" > git_src_commit echo -n "$GIT_COMMIT_DATE" > git_src_commit_date diff --git a/release/pack.py b/release/pack.py index dd29de425..f29ea034d 100755 --- a/release/pack.py +++ b/release/pack.py @@ -13,7 +13,7 @@ from openpilot.common.basedir import BASEDIR DIRS = ['openpilot'] EXTS = ['.png', '.py', '.ttf', '.capnp', '.json', '.fnt', '.mo', '.po'] -EXCLUDE = ['selfdrive/assets/training'] +EXCLUDE = ['openpilot/selfdrive/assets/training'] INTERPRETER = '/usr/bin/env python3' diff --git a/scripts/lint/lint.sh b/scripts/lint/lint.sh index 0f236377e..77d29e709 100755 --- a/scripts/lint/lint.sh +++ b/scripts/lint/lint.sh @@ -13,9 +13,6 @@ cd $ROOT FAILED=0 -IGNORED_FILES="uv\.lock|docs\/CARS.md" -IGNORED_DIRS="^msgq.*|^msgq_repo.*|^opendbc.*|^opendbc_repo.*|^cereal.*|^openpilot\/cereal.*|^panda.*|^rednose.*|^rednose_repo.*|^tinygrad.*|^tinygrad_repo.*|^teleoprtc.*|^teleoprtc_repo.*" - function run() { shopt -s extglob case $1 in @@ -48,14 +45,14 @@ function run_tests() { ALL_FILES=$1 PYTHON_FILES=$2 - run "ruff" ruff check $ROOT --quiet + run "ruff" ruff check openpilot --quiet run "check_added_large_files" python3 -m pre_commit_hooks.check_added_large_files --enforce-all $ALL_FILES --maxkb=120 run "check_shebang_scripts_are_executable" python3 -m pre_commit_hooks.check_shebang_scripts_are_executable $ALL_FILES run "check_shebang_format" $DIR/check_shebang_format.sh $ALL_FILES run "check_nomerge_comments" $DIR/check_nomerge_comments.sh $ALL_FILES if [[ -z "$FAST" ]]; then - run "ty" ty check + run "ty" ty check openpilot run "codespell" codespell $ALL_FILES fi @@ -105,7 +102,7 @@ done RUN=$([ -z "$RUN" ] && echo "" || echo "!($(echo $RUN | sed 's/ /|/g'))") SKIP="@($(echo $SKIP | sed 's/ /|/g'))" -GIT_FILES="$(git ls-files | sed -E "s/$IGNORED_FILES|$IGNORED_DIRS//g")" +GIT_FILES="$(git ls-files openpilot common selfdrive system tools)" ALL_FILES="" for f in $GIT_FILES; do if [[ -f $f ]]; then diff --git a/scripts/post-commit b/scripts/post-commit index f9964639d..399b73c52 100755 --- a/scripts/post-commit +++ b/scripts/post-commit @@ -3,5 +3,5 @@ set -e if [[ -f .git/hooks/post-commit.d/post-commit ]]; then .git/hooks/post-commit.d/post-commit fi -tools/op.sh lint --fast +openpilot/tools/op.sh lint --fast echo "" diff --git a/scripts/reporter.py b/scripts/reporter.py index 199f1fae5..5de552183 100755 --- a/scripts/reporter.py +++ b/scripts/reporter.py @@ -7,7 +7,7 @@ from tinygrad.nn.onnx import OnnxPBParser BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")) MASTER_PATH = os.getenv("MASTER_PATH", BASEDIR) -MODEL_PATH = "/selfdrive/modeld/models/" +MODEL_PATH = "/openpilot/selfdrive/modeld/models/" class MetadataOnnxPBParser(OnnxPBParser): diff --git a/scripts/waste.c b/scripts/waste.c index 2e492916a..fc230846f 100644 --- a/scripts/waste.c +++ b/scripts/waste.c @@ -11,7 +11,7 @@ #include #include #include -#include "../common/timing.h" +#include "../openpilot/common/timing.h" int get_nprocs(void); double *ttime, *oout; @@ -86,4 +86,3 @@ int main() { sleep(1); } } - diff --git a/selfdrive/car/CARS_template.md b/selfdrive/car/CARS_template.md index bc335b6bd..35804ff1f 100644 --- a/selfdrive/car/CARS_template.md +++ b/selfdrive/car/CARS_template.md @@ -6,7 +6,7 @@ {% set hardware_col_name = 'Hardware Needed' %} {% set wide_hardware_col_name = width_tag|format(hardware_col_name) -%} - + # Supported Cars diff --git a/selfdrive/car/docs.py b/selfdrive/car/docs.py index f807fc320..ea7a70688 100755 --- a/selfdrive/car/docs.py +++ b/selfdrive/car/docs.py @@ -6,7 +6,7 @@ from openpilot.common.basedir import BASEDIR from opendbc.car.docs import get_all_car_docs, generate_cars_md CARS_MD_OUT = os.path.join(BASEDIR, "docs", "CARS.md") -CARS_MD_TEMPLATE = os.path.join(BASEDIR, "selfdrive", "car", "CARS_template.md") +CARS_MD_TEMPLATE = os.path.join(BASEDIR, "openpilot/selfdrive", "car", "CARS_template.md") if __name__ == "__main__": parser = argparse.ArgumentParser(description="Auto generates supported cars documentation", diff --git a/selfdrive/car/tests/big_cars_test.sh b/selfdrive/car/tests/big_cars_test.sh index bb6e82dd0..1c3da2e9e 100755 --- a/selfdrive/car/tests/big_cars_test.sh +++ b/selfdrive/car/tests/big_cars_test.sh @@ -6,6 +6,6 @@ cd $BASEDIR export MAX_EXAMPLES=300 export INTERNAL_SEG_CNT=300 -export INTERNAL_SEG_LIST=selfdrive/car/tests/test_models_segs.txt +export INTERNAL_SEG_LIST=openpilot/selfdrive/car/tests/test_models_segs.txt -cd selfdrive/car/tests && pytest test_models.py test_car_interfaces.py +cd openpilot/selfdrive/car/tests && pytest test_models.py test_car_interfaces.py diff --git a/selfdrive/controls/lib/lateral_mpc_lib/SConscript b/selfdrive/controls/lib/lateral_mpc_lib/SConscript index 5ff526ae8..575e5c1af 100644 --- a/selfdrive/controls/lib/lateral_mpc_lib/SConscript +++ b/selfdrive/controls/lib/lateral_mpc_lib/SConscript @@ -49,7 +49,7 @@ acados_include_dir = Dir(acados.INCLUDE_DIR) acados_template_dir = Dir(acados.TEMPLATE_DIR) source_list = ['lat_mpc.py', - '#selfdrive/modeld/constants.py', + '#openpilot/selfdrive/modeld/constants.py', acados_include_dir.File('acados_c/ocp_nlp_interface.h'), acados_template_dir.File('c_templates_tera/acados_solver.in.c'), ] diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript b/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript index a3218e9f3..636ef0fb2 100644 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript +++ b/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript @@ -55,7 +55,7 @@ acados_include_dir = Dir(acados.INCLUDE_DIR) acados_template_dir = Dir(acados.TEMPLATE_DIR) source_list = ['long_mpc.py', - '#selfdrive/modeld/constants.py', + '#openpilot/selfdrive/modeld/constants.py', acados_include_dir.File('acados_c/ocp_nlp_interface.h'), acados_template_dir.File('c_templates_tera/acados_solver.in.c'), ] diff --git a/selfdrive/locationd/calibrationd.py b/selfdrive/locationd/calibrationd.py index 4e3eb7b0f..b9616bf63 100755 --- a/selfdrive/locationd/calibrationd.py +++ b/selfdrive/locationd/calibrationd.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ''' This process finds calibration values. More info on what these calibration values -are can be found here https://github.com/commaai/openpilot/tree/master/common/transformations +are can be found here https://github.com/commaai/openpilot/tree/master/openpilot/common/transformations While the roll calibration is a real value that can be estimated, here we assume it's zero, and the image input into the neural network is not corrected for roll. ''' diff --git a/selfdrive/modeld/SConscript b/selfdrive/modeld/SConscript index 4a4017362..5f6281556 100644 --- a/selfdrive/modeld/SConscript +++ b/selfdrive/modeld/SConscript @@ -16,7 +16,7 @@ CAMERA_CONFIGS = [ ] Import('env', 'arch') -chunker_file = File("#common/file_chunker.py") +chunker_file = File("#openpilot/common/file_chunker.py") lenv = env.Clone() tinygrad_root = env.Dir("#").abspath @@ -45,11 +45,11 @@ else: tg_flags = f'DEV=CPU' if arch == 'Darwin' else 'DEV=CPU:LLVM' tg_devices = { # which device to put jit inputs to at runtime - 'selfdrive.modeld.modeld': { + 'openpilot.selfdrive.modeld.modeld': { 'default': {'WARP_DEV': tg_backend, 'QUEUE_DEV': tg_backend}, 'usbgpu': {'WARP_DEV': tg_backend, 'QUEUE_DEV': 'AMD'} }, - 'selfdrive.modeld.dmonitoringmodeld': { + 'openpilot.selfdrive.modeld.dmonitoringmodeld': { 'default': {'DEV': tg_backend} }, } @@ -74,12 +74,12 @@ tg_devices_node = lenv.Command( # tinygrad calls brew which needs a $HOME in the env mac_brew_string = f'HOME={os.path.expanduser("~")}' if arch == 'Darwin' else '' -modeld_dir = Dir("#selfdrive/modeld").abspath +modeld_dir = Dir("#openpilot/selfdrive/modeld").abspath compile_modeld_script = [ File(f"{modeld_dir}/compile_modeld.py"), File(f"{modeld_dir}/get_model_metadata.py"), - File("#system/camerad/cameras/nv12_info.py"), - File("#common/hardware/hw.py"), + File("#openpilot/system/camerad/cameras/nv12_info.py"), + File("#openpilot/common/hardware/hw.py"), ] model_w, model_h = MEDMODEL_INPUT_SIZE frame_skip = ModelConstants.MODEL_RUN_FREQ // ModelConstants.MODEL_CONTEXT_FREQ @@ -109,8 +109,8 @@ for usbgpu in [False, True] if USBGPU else [False]: # get model metadata fn = File(f"models/dmonitoring_model").abspath -script_files = [File(Dir("#selfdrive/modeld").File("get_model_metadata.py").abspath)] -cmd = f'{tg_flags} {mac_brew_string} python3 {Dir("#selfdrive/modeld").abspath}/get_model_metadata.py {fn}.onnx' +script_files = [File(Dir("#openpilot/selfdrive/modeld").File("get_model_metadata.py").abspath)] +cmd = f'{tg_flags} {mac_brew_string} python3 {Dir("#openpilot/selfdrive/modeld").abspath}/get_model_metadata.py {fn}.onnx' lenv.Command(fn + "_metadata.pkl", [fn + ".onnx"] + tinygrad_files + script_files + [tg_devices_node], cmd) dm_w, dm_h = DM_INPUT_SIZE diff --git a/selfdrive/modeld/dmonitoringmodeld.py b/selfdrive/modeld/dmonitoringmodeld.py index a022e3c3c..2c659d9ac 100755 --- a/selfdrive/modeld/dmonitoringmodeld.py +++ b/selfdrive/modeld/dmonitoringmodeld.py @@ -17,7 +17,7 @@ from openpilot.system.camerad.cameras.nv12_info import get_nv12_info from openpilot.common.file_chunker import read_file_chunked from openpilot.selfdrive.modeld.parse_model_outputs import sigmoid, safe_exp -PROCESS_NAME = "selfdrive.modeld.dmonitoringmodeld" +PROCESS_NAME = "openpilot.selfdrive.modeld.dmonitoringmodeld" SEND_RAW_PRED = os.getenv('SEND_RAW_PRED') MODEL_PKL_PATH = MODELS_DIR / 'dmonitoring_model_tinygrad.pkl' METADATA_PATH = MODELS_DIR / 'dmonitoring_model_metadata.pkl' diff --git a/selfdrive/modeld/modeld.py b/selfdrive/modeld/modeld.py index 590d0f103..9722538b3 100755 --- a/selfdrive/modeld/modeld.py +++ b/selfdrive/modeld/modeld.py @@ -27,7 +27,7 @@ from openpilot.common.file_chunker import read_file_chunked, get_manifest_path from openpilot.selfdrive.modeld.constants import ModelConstants, Plan from openpilot.selfdrive.modeld.helpers import usbgpu_present, modeld_pkl_path, get_tg_input_devices -PROCESS_NAME = "selfdrive.modeld.modeld" +PROCESS_NAME = "openpilot.selfdrive.modeld.modeld" SEND_RAW_PRED = os.getenv('SEND_RAW_PRED') LAT_SMOOTH_SECONDS = 0.0 diff --git a/selfdrive/modeld/models/README.md b/selfdrive/modeld/models/README.md index 04b69c61c..ce84b1e28 100644 --- a/selfdrive/modeld/models/README.md +++ b/selfdrive/modeld/models/README.md @@ -43,7 +43,7 @@ Refer to **slice_outputs** and **parse_vision_outputs/parse_policy_outputs** in * camera calibration angles (roll, pitch, yaw) from liveCalibration: 3 x float32 inputs ### output format -* 84 x float32 outputs = 2 + 41 * 2 ([parsing example](https://github.com/commaai/openpilot/blob/22ce4e17ba0d3bfcf37f8255a4dd1dc683fe0c38/selfdrive/modeld/models/dmonitoring.cc#L33)) +* 84 x float32 outputs = 2 + 41 * 2 ([parsing example](https://github.com/commaai/openpilot/blob/22ce4e17ba0d3bfcf37f8255a4dd1dc683fe0c38/openpilot/selfdrive/modeld/models/dmonitoring.cc#L33)) * for each person in the front seats (2 * 41) * face pose: 12 = 6 + 6 * face orientation [pitch, yaw, roll] in camera frame: 3 diff --git a/selfdrive/pandad/pandad.py b/selfdrive/pandad/pandad.py index 443c25a7e..6dbb398ee 100755 --- a/selfdrive/pandad/pandad.py +++ b/selfdrive/pandad/pandad.py @@ -99,7 +99,7 @@ def main() -> None: # run real pandad os.environ['MANAGER_DAEMON'] = 'pandad' - process = subprocess.Popen(["./pandad"], cwd=os.path.join(BASEDIR, "selfdrive/pandad")) + process = subprocess.Popen(["./pandad"], cwd=os.path.join(BASEDIR, "openpilot/selfdrive/pandad")) process.wait() # TODO: wrap all panda exceptions in a base panda exception except (usb1.USBErrorNoDevice, usb1.USBErrorPipe): diff --git a/selfdrive/selfdrived/alertmanager.py b/selfdrive/selfdrived/alertmanager.py index c166ff591..7ba3d8034 100644 --- a/selfdrive/selfdrived/alertmanager.py +++ b/selfdrive/selfdrived/alertmanager.py @@ -9,7 +9,7 @@ from openpilot.common.params import Params from openpilot.selfdrive.selfdrived.events import Alert, EmptyAlert -with open(os.path.join(BASEDIR, "selfdrive/selfdrived/alerts_offroad.json")) as f: +with open(os.path.join(BASEDIR, "openpilot/selfdrive/selfdrived/alerts_offroad.json")) as f: OFFROAD_ALERTS = json.load(f) diff --git a/selfdrive/selfdrived/tests/test_alerts.py b/selfdrive/selfdrived/tests/test_alerts.py index 38db9981f..276de2a6a 100644 --- a/selfdrive/selfdrived/tests/test_alerts.py +++ b/selfdrive/selfdrived/tests/test_alerts.py @@ -15,7 +15,7 @@ from openpilot.selfdrive.test.process_replay.process_replay import CONFIGS AlertSize = log.SelfdriveState.AlertSize -OFFROAD_ALERTS_PATH = os.path.join(BASEDIR, "selfdrive/selfdrived/alerts_offroad.json") +OFFROAD_ALERTS_PATH = os.path.join(BASEDIR, "openpilot/selfdrive/selfdrived/alerts_offroad.json") # TODO: add callback alerts ALERTS = [] @@ -48,7 +48,7 @@ class TestAlerts: # ensure alert text doesn't exceed allowed width def test_alert_text_length(self): - font_path = os.path.join(BASEDIR, "selfdrive/assets/fonts") + font_path = os.path.join(BASEDIR, "openpilot/selfdrive/assets/fonts") regular_font_path = os.path.join(font_path, "Inter-SemiBold.ttf") bold_font_path = os.path.join(font_path, "Inter-Bold.ttf") semibold_font_path = os.path.join(font_path, "Inter-SemiBold.ttf") diff --git a/selfdrive/test/test_onroad.py b/selfdrive/test/test_onroad.py index f64bc3b02..56ea9dbd0 100644 --- a/selfdrive/test/test_onroad.py +++ b/selfdrive/test/test_onroad.py @@ -35,39 +35,39 @@ LOG_OFFSET = 8 MAX_TOTAL_CPU = 350. # total for all 8 cores PROCS = { # Baseline CPU usage by process - "selfdrive.controls.controlsd": 16.0, - "selfdrive.selfdrived.selfdrived": 16.0, - "selfdrive.car.card": 26.0, + "openpilot.selfdrive.controls.controlsd": 16.0, + "openpilot.selfdrive.selfdrived.selfdrived": 16.0, + "openpilot.selfdrive.car.card": 26.0, "./loggerd": 14.0, "./encoderd": 13.0, "./camerad": 10.0, - "selfdrive.controls.plannerd": 8.0, - "selfdrive.ui.ui": 40.0, - "system.sensord.sensord": 13.0, - "selfdrive.controls.radard": 2.0, - "selfdrive.modeld.modeld": 22.0, - "selfdrive.modeld.dmonitoringmodeld": 18.0, - "system.hardware.hardwared": 4.0, - "selfdrive.locationd.calibrationd": 2.0, - "selfdrive.locationd.torqued": 5.0, - "selfdrive.locationd.locationd": 25.0, - "selfdrive.locationd.paramsd": 9.0, - "selfdrive.locationd.lagd": 11.0, - "selfdrive.ui.soundd": 3.0, - "selfdrive.ui.feedback.feedbackd": 1.0, - "selfdrive.monitoring.dmonitoringd": 4.0, - "system.proclogd": 7.0, - "system.logmessaged": 1.0, - "system.tombstoned": 0, - "system.journald": 1.0, - "system.micd": 5.0, - "system.timed": 0, - "selfdrive.pandad.pandad": 0, - "system.loggerd.uploader": 15.0, - "system.loggerd.deleter": 1.0, + "openpilot.selfdrive.controls.plannerd": 8.0, + "openpilot.selfdrive.ui.ui": 40.0, + "openpilot.system.sensord.sensord": 13.0, + "openpilot.selfdrive.controls.radard": 2.0, + "openpilot.selfdrive.modeld.modeld": 22.0, + "openpilot.selfdrive.modeld.dmonitoringmodeld": 18.0, + "openpilot.system.hardware.hardwared": 4.0, + "openpilot.selfdrive.locationd.calibrationd": 2.0, + "openpilot.selfdrive.locationd.torqued": 5.0, + "openpilot.selfdrive.locationd.locationd": 25.0, + "openpilot.selfdrive.locationd.paramsd": 9.0, + "openpilot.selfdrive.locationd.lagd": 11.0, + "openpilot.selfdrive.ui.soundd": 3.0, + "openpilot.selfdrive.ui.feedback.feedbackd": 1.0, + "openpilot.selfdrive.monitoring.dmonitoringd": 4.0, + "openpilot.system.proclogd": 7.0, + "openpilot.system.logmessaged": 1.0, + "openpilot.system.tombstoned": 0, + "openpilot.system.journald": 1.0, + "openpilot.system.micd": 5.0, + "openpilot.system.timed": 0, + "openpilot.selfdrive.pandad.pandad": 0, + "openpilot.system.loggerd.uploader": 15.0, + "openpilot.system.loggerd.deleter": 1.0, "./pandad": 19.0, - "system.qcomgpsd.qcomgpsd": 1.0, - "common.hardware.tici.modem": 10.0, + "openpilot.system.qcomgpsd.qcomgpsd": 1.0, + "openpilot.common.hardware.tici.modem": 10.0, } TIMINGS = { @@ -129,7 +129,7 @@ class TestOnroad: # start manager and run openpilot for TEST_DURATION proc = None try: - manager_path = os.path.join(BASEDIR, "system/manager/manager.py") + manager_path = os.path.join(BASEDIR, "openpilot/system/manager/manager.py") cls.manager_st = time.monotonic() proc = subprocess.Popen(["python", manager_path]) diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index 3d668aef8..d187b4ca3 100644 --- a/selfdrive/ui/SConscript +++ b/selfdrive/ui/SConscript @@ -4,8 +4,8 @@ import importlib.util Import('env', 'arch', 'common') # build the fonts -generator = File("#selfdrive/assets/fonts/process.py") -source_files = Glob("#selfdrive/assets/fonts/*.ttf") + Glob("#selfdrive/assets/fonts/*.otf") +generator = File("#openpilot/selfdrive/assets/fonts/process.py") +source_files = Glob("#openpilot/selfdrive/assets/fonts/*.ttf") + Glob("#openpilot/selfdrive/assets/fonts/*.otf") output_files = [ (f"#{Path(f.path).with_suffix('.fnt')}", f"#{Path(f.path).with_suffix('.png')}") for f in source_files diff --git a/selfdrive/ui/layouts/onboarding.py b/selfdrive/ui/layouts/onboarding.py index 4ef9c13f2..97ca89b50 100644 --- a/selfdrive/ui/layouts/onboarding.py +++ b/selfdrive/ui/layouts/onboarding.py @@ -50,9 +50,9 @@ class TrainingGuide(Widget): threading.Thread(target=self._preload_thread, daemon=True).start() def _load_image_paths(self): - paths = [fn for fn in os.listdir(os.path.join(BASEDIR, "selfdrive/assets/training")) if re.match(r'^step\d*\.png$', fn)] + paths = [fn for fn in os.listdir(os.path.join(BASEDIR, "openpilot/selfdrive/assets/training")) if re.match(r'^step\d*\.png$', fn)] paths = sorted(paths, key=lambda x: int(re.search(r'\d+', x).group())) - self._image_paths = [os.path.join(BASEDIR, "selfdrive/assets/training", fn) for fn in paths] + self._image_paths = [os.path.join(BASEDIR, "openpilot/selfdrive/assets/training", fn) for fn in paths] def _preload_thread(self): # PNG loading is slow in raylib, so we preload in a thread and upload to GPU in main thread diff --git a/selfdrive/ui/layouts/settings/device.py b/selfdrive/ui/layouts/settings/device.py index 0930616e1..aa15899ac 100644 --- a/selfdrive/ui/layouts/settings/device.py +++ b/selfdrive/ui/layouts/settings/device.py @@ -185,7 +185,7 @@ class DeviceLayout(Widget): def _on_regulatory(self): if not self._fcc_dialog: - self._fcc_dialog = HtmlModal(os.path.join(BASEDIR, "selfdrive/assets/offroad/fcc.html")) + self._fcc_dialog = HtmlModal(os.path.join(BASEDIR, "openpilot/selfdrive/assets/offroad/fcc.html")) gui_app.push_widget(self._fcc_dialog) def _on_review_training_guide(self): diff --git a/selfdrive/ui/layouts/settings/software.py b/selfdrive/ui/layouts/settings/software.py index 3bf271052..3b05eef54 100644 --- a/selfdrive/ui/layouts/settings/software.py +++ b/selfdrive/ui/layouts/settings/software.py @@ -158,12 +158,12 @@ class SoftwareLayout(Widget): # Start checking for updates self._waiting_for_updater = True self._waiting_start_ts = time.monotonic() - os.system("pkill -SIGUSR1 -f system.updated.updated") + os.system("pkill -SIGUSR1 -f openpilot.system.updated.updated") else: # Start downloading self._waiting_for_updater = True self._waiting_start_ts = time.monotonic() - os.system("pkill -SIGHUP -f system.updated.updated") + os.system("pkill -SIGHUP -f openpilot.system.updated.updated") def _on_uninstall(self): def handle_uninstall_confirmation(result: DialogResult): @@ -197,7 +197,7 @@ class SoftwareLayout(Widget): selection = self._branch_dialog.selection ui_state.params.put("UpdaterTargetBranch", selection, block=True) self._branch_btn.action_item.set_value(selection) - os.system("pkill -SIGUSR1 -f system.updated.updated") + os.system("pkill -SIGUSR1 -f openpilot.system.updated.updated") self._branch_dialog = None self._branch_dialog = MultiOptionDialog(tr("Select a branch"), branches, current_target, callback=handle_selection) diff --git a/selfdrive/ui/mici/layouts/settings/device.py b/selfdrive/ui/mici/layouts/settings/device.py index fd8bacf44..0adcf5375 100644 --- a/selfdrive/ui/mici/layouts/settings/device.py +++ b/selfdrive/ui/mici/layouts/settings/device.py @@ -215,5 +215,5 @@ class DeviceLayoutMici(NavScroller): def _on_regulatory(self): if not self._fcc_dialog: - self._fcc_dialog = MiciFccModal(os.path.join(BASEDIR, "selfdrive/assets/offroad/mici_fcc.html")) + self._fcc_dialog = MiciFccModal(os.path.join(BASEDIR, "openpilot/selfdrive/assets/offroad/mici_fcc.html")) gui_app.push_widget(self._fcc_dialog) diff --git a/selfdrive/ui/mici/layouts/settings/software.py b/selfdrive/ui/mici/layouts/settings/software.py index 32f20256f..115b560cc 100644 --- a/selfdrive/ui/mici/layouts/settings/software.py +++ b/selfdrive/ui/mici/layouts/settings/software.py @@ -103,9 +103,9 @@ class CheckUpdateButton(BigButton): def run(): if self.get_value() == "download update": - os.system("pkill -SIGHUP -f system.updated.updated") + os.system("pkill -SIGHUP -f openpilot.system.updated.updated") else: - os.system("pkill -SIGUSR1 -f system.updated.updated") + os.system("pkill -SIGUSR1 -f openpilot.system.updated.updated") threading.Thread(target=run, daemon=True).start() @@ -251,7 +251,7 @@ class TargetBranchButton(BigButton): def _on_select(self, branch: str): ui_state.params.put("UpdaterTargetBranch", branch, block=True) self.set_value(branch) - os.system("pkill -SIGUSR1 -f system.updated.updated") + os.system("pkill -SIGUSR1 -f openpilot.system.updated.updated") class SoftwareLayoutMici(NavScroller): diff --git a/selfdrive/ui/soundd.py b/selfdrive/ui/soundd.py index f8c364e2c..901e2b56c 100644 --- a/selfdrive/ui/soundd.py +++ b/selfdrive/ui/soundd.py @@ -85,7 +85,7 @@ class Soundd: for sound in sound_list: filename, play_count, volume = sound_list[sound] - with wave.open(BASEDIR + "/selfdrive/assets/sounds/" + filename, 'r') as wavefile: + with wave.open(BASEDIR + "/openpilot/selfdrive/assets/sounds/" + filename, 'r') as wavefile: assert wavefile.getnchannels() == 1 assert wavefile.getsampwidth() == 2 assert wavefile.getframerate() == SAMPLE_RATE diff --git a/selfdrive/ui/tests/cycle_offroad_alerts.py b/selfdrive/ui/tests/cycle_offroad_alerts.py index fcb4a72c7..c2690edf7 100755 --- a/selfdrive/ui/tests/cycle_offroad_alerts.py +++ b/selfdrive/ui/tests/cycle_offroad_alerts.py @@ -12,7 +12,7 @@ from openpilot.system.updated.updated import parse_release_notes if __name__ == "__main__": params = Params() - with open(os.path.join(BASEDIR, "selfdrive/selfdrived/alerts_offroad.json")) as f: + with open(os.path.join(BASEDIR, "openpilot/selfdrive/selfdrived/alerts_offroad.json")) as f: offroad_alerts = json.load(f) t = 10 if len(sys.argv) < 2 else int(sys.argv[1]) diff --git a/selfdrive/ui/tests/diff/diff.py b/selfdrive/ui/tests/diff/diff.py index b861d848e..9dd7c3bc0 100755 --- a/selfdrive/ui/tests/diff/diff.py +++ b/selfdrive/ui/tests/diff/diff.py @@ -8,7 +8,7 @@ from concurrent.futures import ThreadPoolExecutor from pathlib import Path from openpilot.common.basedir import BASEDIR -DIFF_OUT_DIR = Path(BASEDIR) / "selfdrive" / "ui" / "tests" / "diff" / "report" +DIFF_OUT_DIR = Path(BASEDIR) / "openpilot" / "selfdrive" / "ui" / "tests" / "diff" / "report" HTML_TEMPLATE_PATH = Path(__file__).with_name("diff_template.html") diff --git a/selfdrive/ui/translations/app.pot b/selfdrive/ui/translations/app.pot index 0872ed538..3f9f86af8 100644 --- a/selfdrive/ui/translations/app.pot +++ b/selfdrive/ui/translations/app.pot @@ -3,141 +3,141 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" #: openpilot/selfdrive/ui/layouts/sidebar.py -#: system/ui/widgets/confirm_dialog.py -#: system/ui/widgets/html_render.py +#: openpilot/system/ui/widgets/confirm_dialog.py +#: openpilot/system/ui/widgets/html_render.py msgid "OK" msgstr "" -#: system/ui/widgets/confirm_dialog.py -#: system/ui/widgets/keyboard.py -#: system/ui/widgets/network.py -#: system/ui/widgets/option_dialog.py +#: openpilot/system/ui/widgets/confirm_dialog.py +#: openpilot/system/ui/widgets/keyboard.py +#: openpilot/system/ui/widgets/network.py +#: openpilot/system/ui/widgets/option_dialog.py msgid "Cancel" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Advanced" msgstr "" #: openpilot/selfdrive/ui/layouts/onboarding.py -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Back" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Enter APN" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "leave blank for automatic configuration" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Enter SSID" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Enter new tethering password" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Enable Tethering" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "EDIT" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Tethering Password" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Enable Roaming" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Cellular Metered" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "APN Setting" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Wi-Fi Network Metered" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Enter password" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Scanning Wi-Fi networks..." msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "CONNECTING..." msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Forget" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Prevent large data uploads when on a metered cellular connection" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "default" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "metered" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "unmetered" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Prevent large data uploads when on a metered Wi-Fi connection" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "IP Address" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Hidden Network" msgstr "" #: openpilot/selfdrive/ui/layouts/sidebar.py -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "CONNECT" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Wrong password" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "FORGETTING..." msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "for \"{}\"" msgstr "" -#: system/ui/widgets/network.py +#: openpilot/system/ui/widgets/network.py msgid "Forget Wi-Fi Network \"{}\"?" msgstr "" -#: system/ui/widgets/list_view.py +#: openpilot/system/ui/widgets/list_view.py msgid "Error" msgstr "" -#: system/ui/widgets/option_dialog.py +#: openpilot/system/ui/widgets/option_dialog.py msgid "Select" msgstr "" diff --git a/selfdrive/ui/translations/auto_translate.sh b/selfdrive/ui/translations/auto_translate.sh index 03a207ca3..7238426c7 100755 --- a/selfdrive/ui/translations/auto_translate.sh +++ b/selfdrive/ui/translations/auto_translate.sh @@ -15,7 +15,7 @@ command -v codex >/dev/null || { } codex exec --cd "$ROOT" -c 'model_reasoning_effort="low"' --dangerously-bypass-approvals-and-sandbox "$(cat < int: diff --git a/system/camerad/webcam/README.md b/system/camerad/webcam/README.md index 2c0ce6a8a..17d7ee6d8 100644 --- a/system/camerad/webcam/README.md +++ b/system/camerad/webcam/README.md @@ -10,7 +10,7 @@ ## GO ``` -USE_WEBCAM=1 system/manager/manager.py +USE_WEBCAM=1 openpilot/system/manager/manager.py ``` - Start the car, then the UI should show the road webcam's view - Adjust and secure the webcam @@ -20,5 +20,5 @@ USE_WEBCAM=1 system/manager/manager.py Use the `ROAD_CAM` (default 0) and optional `DRIVER_CAM`, `WIDE_CAM` environment variables to specify which camera is which (ie. `ROAD_CAM=1` uses `/dev/video1`, on Ubuntu, for the road camera): ``` -USE_WEBCAM=1 ROAD_CAM=1 system/manager/manager.py +USE_WEBCAM=1 ROAD_CAM=1 openpilot/system/manager/manager.py ``` diff --git a/system/loggerd/tests/test_loggerd.py b/system/loggerd/tests/test_loggerd.py index 7a6a741aa..5d8f635d9 100644 --- a/system/loggerd/tests/test_loggerd.py +++ b/system/loggerd/tests/test_loggerd.py @@ -54,7 +54,7 @@ class TestLoggerd: def _gen_bootlog(self): with Timeout(5): - out = subprocess.check_output("./bootlog", cwd=os.path.join(BASEDIR, "system/loggerd"), encoding='utf-8') + out = subprocess.check_output("./bootlog", cwd=os.path.join(BASEDIR, "openpilot/system/loggerd"), encoding='utf-8') log_fn = self._get_log_fn(out) diff --git a/system/manager/helpers.py b/system/manager/helpers.py index b07aec0c8..453e13184 100644 --- a/system/manager/helpers.py +++ b/system/manager/helpers.py @@ -54,7 +54,7 @@ def save_bootlog(): def fn(tmpdir): env = os.environ.copy() env['PARAMS_COPY_PATH'] = tmpdir - subprocess.call("./bootlog", cwd=os.path.join(BASEDIR, "system/loggerd"), env=env) + subprocess.call("./bootlog", cwd=os.path.join(BASEDIR, "openpilot/system/loggerd"), env=env) shutil.rmtree(tmpdir) t = threading.Thread(target=fn, args=(tmp, )) t.daemon = True diff --git a/system/manager/process_config.py b/system/manager/process_config.py index 0bf11b4b5..655d1c4e2 100644 --- a/system/manager/process_config.py +++ b/system/manager/process_config.py @@ -71,57 +71,57 @@ def not_(*fns): return lambda *args: operator.not_(*(fn(*args) for fn in fns)) procs = [ - DaemonProcess("manage_athenad", "system.athena.manage_athenad", "AthenadPid"), + DaemonProcess("manage_athenad", "openpilot.system.athena.manage_athenad", "AthenadPid"), - NativeProcess("loggerd", "system/loggerd", ["./loggerd"], logging), - NativeProcess("encoderd", "system/loggerd", ["./encoderd"], only_onroad), - NativeProcess("stream_encoderd", "system/loggerd", ["./encoderd", "--stream"], or_(and_(livestream, not_(iscar)), notcar)), - PythonProcess("logmessaged", "system.logmessaged", always_run), + NativeProcess("loggerd", "openpilot/system/loggerd", ["./loggerd"], logging), + NativeProcess("encoderd", "openpilot/system/loggerd", ["./encoderd"], only_onroad), + NativeProcess("stream_encoderd", "openpilot/system/loggerd", ["./encoderd", "--stream"], or_(and_(livestream, not_(iscar)), notcar)), + PythonProcess("logmessaged", "openpilot.system.logmessaged", always_run), - NativeProcess("camerad", "system/camerad", ["./camerad"], or_(driverview, livestream), enabled=not WEBCAM), - PythonProcess("webcamerad", "system.camerad.webcam.camerad", driverview, enabled=WEBCAM), - PythonProcess("proclogd", "system.proclogd", only_onroad, enabled=platform.system() != "Darwin"), - PythonProcess("journald", "system.journald", only_onroad, platform.system() != "Darwin"), - PythonProcess("micd", "system.micd", iscar), - PythonProcess("timed", "system.timed", always_run, enabled=not PC), + NativeProcess("camerad", "openpilot/system/camerad", ["./camerad"], or_(driverview, livestream), enabled=not WEBCAM), + PythonProcess("webcamerad", "openpilot.system.camerad.webcam.camerad", driverview, enabled=WEBCAM), + PythonProcess("proclogd", "openpilot.system.proclogd", only_onroad, enabled=platform.system() != "Darwin"), + PythonProcess("journald", "openpilot.system.journald", only_onroad, platform.system() != "Darwin"), + PythonProcess("micd", "openpilot.system.micd", iscar), + PythonProcess("timed", "openpilot.system.timed", always_run, enabled=not PC), - PythonProcess("modeld", "selfdrive.modeld.modeld", only_onroad), - PythonProcess("dmonitoringmodeld", "selfdrive.modeld.dmonitoringmodeld", driverview, enabled=(WEBCAM or not PC)), + PythonProcess("modeld", "openpilot.selfdrive.modeld.modeld", only_onroad), + PythonProcess("dmonitoringmodeld", "openpilot.selfdrive.modeld.dmonitoringmodeld", driverview, enabled=(WEBCAM or not PC)), - PythonProcess("sensord", "system.sensord.sensord", only_onroad, enabled=not PC), - PythonProcess("ui", "selfdrive.ui.ui", always_run, restart_if_crash=True), - PythonProcess("soundd", "selfdrive.ui.soundd", driverview), - PythonProcess("locationd", "selfdrive.locationd.locationd", only_onroad), - NativeProcess("_pandad", "selfdrive/pandad", ["./pandad"], always_run, enabled=False), - PythonProcess("calibrationd", "selfdrive.locationd.calibrationd", only_onroad), - PythonProcess("torqued", "selfdrive.locationd.torqued", only_onroad), - PythonProcess("controlsd", "selfdrive.controls.controlsd", and_(not_joystick, iscar)), - PythonProcess("joystickd", "tools.joystick.joystickd", or_(joystick, notcar)), - PythonProcess("selfdrived", "selfdrive.selfdrived.selfdrived", only_onroad), - PythonProcess("card", "selfdrive.car.card", only_onroad), - PythonProcess("deleter", "system.loggerd.deleter", always_run), - PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", driverview, enabled=(WEBCAM or not PC)), - PythonProcess("qcomgpsd", "system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI), - PythonProcess("pandad", "selfdrive.pandad.pandad", always_run), - PythonProcess("paramsd", "selfdrive.locationd.paramsd", only_onroad), - PythonProcess("lagd", "selfdrive.locationd.lagd", only_onroad), - PythonProcess("ubloxd", "system.ubloxd.ubloxd", ublox, enabled=TICI), - PythonProcess("pigeond", "system.ubloxd.pigeond", ublox, enabled=TICI), - PythonProcess("plannerd", "selfdrive.controls.plannerd", not_long_maneuver), - PythonProcess("maneuversd", "tools.longitudinal_maneuvers.maneuversd", long_maneuver), - PythonProcess("lateral_maneuversd", "tools.lateral_maneuvers.lateral_maneuversd", lat_maneuver), - PythonProcess("radard", "selfdrive.controls.radard", only_onroad), - PythonProcess("hardwared", "system.hardware.hardwared", always_run), - PythonProcess("modem", "common.hardware.tici.modem", always_run, enabled=TICI), - PythonProcess("tombstoned", "system.tombstoned", always_run, enabled=not PC), - PythonProcess("updated", "system.updated.updated", only_offroad, enabled=not PC), - PythonProcess("uploader", "system.loggerd.uploader", always_run), - PythonProcess("feedbackd", "selfdrive.ui.feedback.feedbackd", only_onroad), + PythonProcess("sensord", "openpilot.system.sensord.sensord", only_onroad, enabled=not PC), + PythonProcess("ui", "openpilot.selfdrive.ui.ui", always_run, restart_if_crash=True), + PythonProcess("soundd", "openpilot.selfdrive.ui.soundd", driverview), + PythonProcess("locationd", "openpilot.selfdrive.locationd.locationd", only_onroad), + NativeProcess("_pandad", "openpilot/selfdrive/pandad", ["./pandad"], always_run, enabled=False), + PythonProcess("calibrationd", "openpilot.selfdrive.locationd.calibrationd", only_onroad), + PythonProcess("torqued", "openpilot.selfdrive.locationd.torqued", only_onroad), + PythonProcess("controlsd", "openpilot.selfdrive.controls.controlsd", and_(not_joystick, iscar)), + PythonProcess("joystickd", "openpilot.tools.joystick.joystickd", or_(joystick, notcar)), + PythonProcess("selfdrived", "openpilot.selfdrive.selfdrived.selfdrived", only_onroad), + PythonProcess("card", "openpilot.selfdrive.car.card", only_onroad), + PythonProcess("deleter", "openpilot.system.loggerd.deleter", always_run), + PythonProcess("dmonitoringd", "openpilot.selfdrive.monitoring.dmonitoringd", driverview, enabled=(WEBCAM or not PC)), + PythonProcess("qcomgpsd", "openpilot.system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI), + PythonProcess("pandad", "openpilot.selfdrive.pandad.pandad", always_run), + PythonProcess("paramsd", "openpilot.selfdrive.locationd.paramsd", only_onroad), + PythonProcess("lagd", "openpilot.selfdrive.locationd.lagd", only_onroad), + PythonProcess("ubloxd", "openpilot.system.ubloxd.ubloxd", ublox, enabled=TICI), + PythonProcess("pigeond", "openpilot.system.ubloxd.pigeond", ublox, enabled=TICI), + PythonProcess("plannerd", "openpilot.selfdrive.controls.plannerd", not_long_maneuver), + PythonProcess("maneuversd", "openpilot.tools.longitudinal_maneuvers.maneuversd", long_maneuver), + PythonProcess("lateral_maneuversd", "openpilot.tools.lateral_maneuvers.lateral_maneuversd", lat_maneuver), + PythonProcess("radard", "openpilot.selfdrive.controls.radard", only_onroad), + PythonProcess("hardwared", "openpilot.system.hardware.hardwared", always_run), + PythonProcess("modem", "openpilot.common.hardware.tici.modem", always_run, enabled=TICI), + PythonProcess("tombstoned", "openpilot.system.tombstoned", always_run, enabled=not PC), + PythonProcess("updated", "openpilot.system.updated.updated", only_offroad, enabled=not PC), + PythonProcess("uploader", "openpilot.system.loggerd.uploader", always_run), + PythonProcess("feedbackd", "openpilot.selfdrive.ui.feedback.feedbackd", only_onroad), # debug procs NativeProcess("bridge", "openpilot/cereal/messaging", ["./bridge"], notcar), - PythonProcess("webrtcd", "system.webrtc.webrtcd", or_(and_(livestream, not_(iscar)), notcar)), - PythonProcess("joystick", "tools.joystick.joystick_control", and_(joystick, iscar)), + PythonProcess("webrtcd", "openpilot.system.webrtc.webrtcd", or_(and_(livestream, not_(iscar)), notcar)), + PythonProcess("joystick", "openpilot.tools.joystick.joystick_control", and_(joystick, iscar)), ] managed_processes = {p.name: p for p in procs} diff --git a/system/tombstoned.py b/system/tombstoned.py index 349a71cc1..7741a923c 100755 --- a/system/tombstoned.py +++ b/system/tombstoned.py @@ -104,7 +104,7 @@ def report_tombstone_apport(fn): # Try to find first entry in openpilot, fall back to first line for line in stacktrace_s: - if "at selfdrive/" in line: + if "at openpilot/selfdrive/" in line or "at selfdrive/" in line: crash_function = line found = True break diff --git a/system/ui/README.md b/system/ui/README.md index 79a4dd32e..3624c8d1c 100644 --- a/system/ui/README.md +++ b/system/ui/README.md @@ -15,6 +15,6 @@ Quick start: * https://electronstudio.github.io/raylib-python-cffi/README.html#quickstart Style guide: -* All graphical elements should subclass [`Widget`](/system/ui/widgets/__init__.py). +* All graphical elements should subclass [`Widget`](/openpilot/system/ui/widgets/__init__.py). * Prefer a stateful widget over a function for easy migration from QT * All internal class variables and functions should be prefixed with `_` diff --git a/system/ui/lib/multilang.py b/system/ui/lib/multilang.py index 06c54f6e9..230540467 100644 --- a/system/ui/lib/multilang.py +++ b/system/ui/lib/multilang.py @@ -10,7 +10,7 @@ try: except ImportError: Params = None -SYSTEM_UI_DIR = os.path.join(BASEDIR, "system", "ui") +SYSTEM_UI_DIR = os.path.join(BASEDIR, "openpilot/system", "ui") UI_DIR = files("openpilot.selfdrive.ui") TRANSLATIONS_DIR = UI_DIR.joinpath("translations") LANGUAGES_FILE = TRANSLATIONS_DIR.joinpath("languages.json") diff --git a/system/updated/updated.py b/system/updated/updated.py index affacd0f2..c8f45fdb5 100755 --- a/system/updated/updated.py +++ b/system/updated/updated.py @@ -220,7 +220,7 @@ def handle_agnos_update() -> None: cloudlog.info(f"Beginning background installation for AGNOS {updated_version}") set_offroad_alert("Offroad_NeosUpdate", True) - manifest_path = os.path.join(OVERLAY_MERGED, "system/hardware/tici/agnos.json") + manifest_path = os.path.join(OVERLAY_MERGED, "openpilot/system/hardware/tici/agnos.json") target_slot_number = get_target_slot_number() flash_agnos_update(manifest_path, target_slot_number, cloudlog) set_offroad_alert("Offroad_NeosUpdate", False) @@ -309,7 +309,7 @@ class Updater: try: branch = self.get_branch(basedir) commit = self.get_commit_hash(basedir)[:7] - with open(os.path.join(basedir, "common", "version.h")) as f: + with open(os.path.join(basedir, "openpilot", "common", "version.h")) as f: version = f.read().split('"')[1] commit_unix_ts = run(["git", "show", "-s", "--format=%ct", "HEAD"], basedir).rstrip() diff --git a/tools/CTF.md b/tools/CTF.md index 609c82ad5..b8acc46fe 100644 --- a/tools/CTF.md +++ b/tools/CTF.md @@ -6,15 +6,15 @@ Welcome to the first part of the comma CTF! * everything you'll need to find the flags is in the openpilot repo * grep is also your friend * first, [setup](https://github.com/commaai/openpilot/tree/master/tools#setup-your-pc) your PC - * read the docs & checkout out the tools in tools/ + * read the docs & checkout out the tools in openpilot/tools/ * tip: once you get the replay and UI up, start by familiarizing yourself with seeking in replay getting started ```bash # start the route replay -cd tools/replay +cd openpilot/tools/replay ./replay '0c7f0c7f0c7f0c7f|2021-10-13--13-00-00' --dcam --ecam # start the UI in another terminal -selfdrive/ui/ui +openpilot/selfdrive/ui/ui ``` diff --git a/tools/README.md b/tools/README.md index 1ea42bbe1..522bb3886 100644 --- a/tools/README.md +++ b/tools/README.md @@ -18,7 +18,7 @@ git clone https://github.com/commaai/openpilot.git **2. Run the setup script** ``` bash cd openpilot -tools/op.sh setup +openpilot/tools/op.sh setup ``` **3. Activate a Python shell** @@ -41,7 +41,7 @@ Follow [these instructions](https://docs.microsoft.com/en-us/windows/wsl/install **NOTE**: If you are running WSL 2 and experiencing performance issues with the UI or simulator, you may need to explicitly enable hardware acceleration by setting `GALLIUM_DRIVER=d3d12` before commands. Add `export GALLIUM_DRIVER=d3d12` to your `~/.bashrc` file to make it automatic for future sessions. ## CTF -Learn about the openpilot ecosystem and tools by playing our [CTF](/tools/CTF.md). +Learn about the openpilot ecosystem and tools by playing our [CTF](/openpilot/tools/CTF.md). ## Directory Structure diff --git a/tools/cabana/SConscript b/tools/cabana/SConscript index 2bc867533..92e95d3cc 100644 --- a/tools/cabana/SConscript +++ b/tools/cabana/SConscript @@ -60,7 +60,7 @@ qt_flags = [ "-DQT_MESSAGELOGCONTEXT", ] qt_env['CXXFLAGS'] += qt_flags -qt_env['LIBPATH'] += ['#selfdrive/ui', ] +qt_env['LIBPATH'] += ['#openpilot/selfdrive/ui', ] qt_env['LIBS'] = qt_libs base_frameworks = qt_env['FRAMEWORKS'] @@ -112,8 +112,8 @@ cabana_env.Program('_cabana', ['cabana.cc', cabana_lib, assets], LIBS=cabana_lib if GetOption('extras'): cabana_env.Program('tests/test_cabana', ['tests/test_runner.cc', 'tests/test_cabana.cc', cabana_lib], LIBS=[cabana_libs]) -output_json_file = 'tools/cabana/dbc/car_fingerprint_to_dbc.json' +output_json_file = 'openpilot/tools/cabana/dbc/car_fingerprint_to_dbc.json' generate_dbc = cabana_env.Command('#' + output_json_file, ['dbc/generate_dbc_json.py'], - "python3 tools/cabana/dbc/generate_dbc_json.py --out " + output_json_file) -cabana_env.Depends(generate_dbc, ["#common", '#opendbc_repo', "#openpilot/cereal", "#msgq_repo"]) + "python3 openpilot/tools/cabana/dbc/generate_dbc_json.py --out " + output_json_file) +cabana_env.Depends(generate_dbc, ["#openpilot/common", '#opendbc_repo', "#openpilot/cereal", "#msgq_repo"]) diff --git a/tools/cabana/cabana b/tools/cabana/cabana index e17563353..a51b39509 100755 --- a/tools/cabana/cabana +++ b/tools/cabana/cabana @@ -33,6 +33,6 @@ fi # Build _cabana cd "$ROOT" -scons tools/cabana/_cabana openpilot/cereal/messaging/bridge +scons openpilot/tools/cabana/_cabana openpilot/cereal/messaging/bridge exec "$DIR/_cabana" "$@" diff --git a/tools/cabana/streams/replaystream.cc b/tools/cabana/streams/replaystream.cc index f42bf2601..b00c6e52c 100644 --- a/tools/cabana/streams/replaystream.cc +++ b/tools/cabana/streams/replaystream.cc @@ -68,7 +68,7 @@ bool ReplayStream::loadRoute(const std::string &route, const std::string &data_d QString message; if (auth_content.empty()) { message = "Authentication Required. Please run the following command to authenticate:\n\n" - "python3 tools/lib/auth.py\n\n" + "python3 openpilot/tools/lib/auth.py\n\n" "This will grant access to routes from your comma account."; } else { message = tr("Access Denied. You do not have permission to access route:\n\n%1\n\n" diff --git a/tools/cabana/streams/routes.cc b/tools/cabana/streams/routes.cc index 1e69a45ce..e3e5cb1b6 100644 --- a/tools/cabana/streams/routes.cc +++ b/tools/cabana/streams/routes.cc @@ -88,7 +88,7 @@ void RoutesDialog::parseDeviceList(const QString &json, bool success, int error_ device_list_->addItem(dongle_id, dongle_id); } } else { - QMessageBox::warning(this, tr("Error"), error_code == 401 ? tr("Unauthorized. Authenticate with tools/lib/auth.py") : tr("Network error")); + QMessageBox::warning(this, tr("Error"), error_code == 401 ? tr("Unauthorized. Authenticate with openpilot/tools/lib/auth.py") : tr("Network error")); reject(); } } diff --git a/tools/car_porting/README.md b/tools/car_porting/README.md index 77492035c..3766978e9 100644 --- a/tools/car_porting/README.md +++ b/tools/car_porting/README.md @@ -1,4 +1,4 @@ -# tools/car_porting +# openpilot/tools/car_porting Check out [this blog post](https://blog.comma.ai/how-to-write-a-car-port-for-openpilot/) for a high-level overview of porting a car. @@ -6,46 +6,46 @@ Check out [this blog post](https://blog.comma.ai/how-to-write-a-car-port-for-ope Testing car ports in your car is very time-consuming. Check out these utilities to do basic checks on your work before running it in your car. -### [Cabana](/tools/cabana/README.md) +### [Cabana](/openpilot/tools/cabana/README.md) View your car's CAN signals through DBC files, which openpilot uses to parse and create messages that talk to the car. Example: ```bash -> tools/cabana/cabana '1bbe6bf2d62f58a8|2022-07-14--17-11-43' +> openpilot/tools/cabana/cabana '1bbe6bf2d62f58a8|2022-07-14--17-11-43' ``` -### [tools/car_porting/auto_fingerprint.py](/tools/car_porting/auto_fingerprint.py) +### [openpilot/tools/car_porting/auto_fingerprint.py](/openpilot/tools/car_porting/auto_fingerprint.py) Given a route and platform, automatically inserts FW fingerprints from the platform into the correct place in fingerprints.py Example: ```bash -> python3 tools/car_porting/auto_fingerprint.py '1bbe6bf2d62f58a8|2022-07-14--17-11-43' 'OUTBACK' +> python3 openpilot/tools/car_porting/auto_fingerprint.py '1bbe6bf2d62f58a8|2022-07-14--17-11-43' 'OUTBACK' Attempting to add fw version for: OUTBACK ``` -### [selfdrive/car/tests/test_car_interfaces.py](/selfdrive/car/tests/test_car_interfaces.py) +### [openpilot/selfdrive/car/tests/test_car_interfaces.py](/openpilot/selfdrive/car/tests/test_car_interfaces.py) Finds common bugs for car interfaces, without even requiring a route. #### Example: Typo in signal name ```bash -> pytest selfdrive/car/tests/test_car_interfaces.py -k subaru # replace with the brand you are working on +> pytest openpilot/selfdrive/car/tests/test_car_interfaces.py -k subaru # replace with the brand you are working on ===================================================================== -FAILED selfdrive/car/tests/test_car_interfaces.py::TestCarInterfaces::test_car_interfaces_165_SUBARU_LEGACY_7TH_GEN - KeyError: 'CruiseControlOOPS' +FAILED openpilot/selfdrive/car/tests/test_car_interfaces.py::TestCarInterfaces::test_car_interfaces_165_SUBARU_LEGACY_7TH_GEN - KeyError: 'CruiseControlOOPS' ``` -### [tools/car_porting/test_car_model.py](/tools/car_porting/test_car_model.py) +### [openpilot/tools/car_porting/test_car_model.py](/openpilot/tools/car_porting/test_car_model.py) Given a route, runs most of the car interface to check for common errors like missing signals, blocked panda messages, and safety mismatches. #### Example: panda safety mismatch for gasPressed ```bash -> python3 tools/car_porting/test_car_model.py '4822a427b188122a|2023-08-14--16-22-21' +> python3 openpilot/tools/car_porting/test_car_model.py '4822a427b188122a|2023-08-14--16-22-21' ===================================================================== FAIL: test_panda_safety_carstate (__main__.CarModelTestCase.test_panda_safety_carstate) @@ -59,7 +59,7 @@ AssertionError: 1 is not false : panda safety doesn't agree with openpilot: {'ga ## Jupyter notebooks -To use these notebooks, install Jupyter within your [openpilot virtual environment](/tools/README.md). +To use these notebooks, install Jupyter within your [openpilot virtual environment](/openpilot/tools/README.md). ```bash uv pip install jupyter ipykernel @@ -71,7 +71,7 @@ Launching: jupyter notebook ``` -### [examples/subaru_steer_temp_fault.ipynb](/tools/car_porting/examples/subaru_steer_temp_fault.ipynb) +### [examples/subaru_steer_temp_fault.ipynb](/openpilot/tools/car_porting/examples/subaru_steer_temp_fault.ipynb) An example of searching through a database of segments for a specific condition, and plotting the results. @@ -79,7 +79,7 @@ An example of searching through a database of segments for a specific condition, *a plot of the steer_warning vs steering angle, where we can see it is clearly caused by a large steering angle change* -### [examples/subaru_long_accel.ipynb](/tools/car_porting/examples/subaru_long_accel.ipynb) +### [examples/subaru_long_accel.ipynb](/openpilot/tools/car_porting/examples/subaru_long_accel.ipynb) An example of plotting the response of an actuator when it is active. @@ -87,7 +87,7 @@ An example of plotting the response of an actuator when it is active. *a plot of the brake_pressure vs acceleration, where we can see it is a fairly linear response.* -### [examples/ford_vin_fingerprint.ipynb](/tools/car_porting/examples/ford_vin_fingerprint.ipynb) +### [examples/ford_vin_fingerprint.ipynb](/openpilot/tools/car_porting/examples/ford_vin_fingerprint.ipynb) In this example, we use the public comma car segments database to check if vin fingerprinting is feasible for ford. @@ -109,7 +109,7 @@ vin: 3FTTW8E31PRXXXXXX real platform: FORD MAVERICK 1ST GEN determi vin: 3FTTW8E99NRXXXXXX real platform: FORD MAVERICK 1ST GEN determined platform: mock correct: False ``` -### [examples/find_segments_with_message.ipynb](/tools/car_porting/examples/find_segments_with_message.ipynb) +### [examples/find_segments_with_message.ipynb](/openpilot/tools/car_porting/examples/find_segments_with_message.ipynb) Searches for segments where a set of given CAN message IDs are present. In the example, we search for all messages used for CAN-based ignition detection. diff --git a/tools/car_porting/test_car_model.py b/tools/car_porting/test_car_model.py index 78784a429..20e7d136e 100755 --- a/tools/car_porting/test_car_model.py +++ b/tools/car_porting/test_car_model.py @@ -19,7 +19,7 @@ def create_test_models_suite(routes: list[CarTestRoute]) -> unittest.TestSuite: if __name__ == "__main__": parser = argparse.ArgumentParser(description="Test any route against common issues with a new car port. " + - "Uses selfdrive/car/tests/test_models.py") + "Uses openpilot/selfdrive/car/tests/test_models.py") parser.add_argument("route_or_segment_name", help="Specify route to run tests on") parser.add_argument("--car", help="Specify car model for test route") args = parser.parse_args() diff --git a/tools/jotpluggler/SConscript b/tools/jotpluggler/SConscript index 36d709621..3e235bb07 100644 --- a/tools/jotpluggler/SConscript +++ b/tools/jotpluggler/SConscript @@ -83,7 +83,7 @@ def write_car_fingerprint_to_dbc_header(target, source, env): def generate_event_extractors(target, source, env): subprocess.check_call([ "python3", - "tools/jotpluggler/generate_event_extractors.py", + "openpilot/tools/jotpluggler/generate_event_extractors.py", os.path.realpath(BASEDIR), str(target[0]), ]) diff --git a/tools/jotpluggler/generate_event_extractors.py b/tools/jotpluggler/generate_event_extractors.py index 25f121f0b..be9bd4900 100644 --- a/tools/jotpluggler/generate_event_extractors.py +++ b/tools/jotpluggler/generate_event_extractors.py @@ -275,7 +275,7 @@ class Generator: def generate(self): self.lines = [] - self.emit(0, "// Generated by tools/jotpluggler/generate_event_extractors.py; do not edit.") + self.emit(0, "// Generated by openpilot/tools/jotpluggler/generate_event_extractors.py; do not edit.") self.emit(0, "") self.emit(0, "const std::vector &static_event_fixed_paths() {") self.emit(2, "static const std::vector paths = {") diff --git a/tools/joystick/README.md b/tools/joystick/README.md index bc0968809..3ce308927 100644 --- a/tools/joystick/README.md +++ b/tools/joystick/README.md @@ -14,7 +14,7 @@ The car must be off, and openpilot must be offroad before starting `joystick_con SSH into your comma device and start joystick_control with the following command: ```shell -tools/joystick/joystick_control.py --keyboard +openpilot/tools/joystick/joystick_control.py --keyboard ``` The available buttons and axes will print showing their key mappings. In general, the WASD keys control gas and brakes and steering torque in 5% increments. @@ -42,7 +42,7 @@ In order to use a joystick over the network, we need to run joystick_control loc ```shell # on your laptop export ZMQ=1 - tools/joystick/joystick_control.py + openpilot/tools/joystick/joystick_control.py ``` --- diff --git a/tools/lateral_maneuvers/README.md b/tools/lateral_maneuvers/README.md index 3a54bc740..7a4c381b1 100644 --- a/tools/lateral_maneuvers/README.md +++ b/tools/lateral_maneuvers/README.md @@ -28,7 +28,7 @@ Test your vehicle's lateral control tuning with this tool. The tool will test th 8. Gather the route ID and then run the report generator. The file will be exported to the same directory: ```sh - $ python tools/lateral_maneuvers/generate_report.py 98395b7c5b27882e/000001cc--5a73bde686 + $ python openpilot/tools/lateral_maneuvers/generate_report.py 98395b7c5b27882e/000001cc--5a73bde686 processing report for KIA_EV6 plotting maneuver: step right 20mph, runs: 3 diff --git a/tools/lib/README.md b/tools/lib/README.md index af1ad0de2..17e24816e 100644 --- a/tools/lib/README.md +++ b/tools/lib/README.md @@ -1,6 +1,6 @@ ## LogReader -Route is a class for conveniently accessing all the [logs](/system/loggerd/) from your routes. The LogReader class reads the non-video logs, i.e. rlog.bz2 and qlog.bz2. There's also a matching FrameReader class for reading the videos. +Route is a class for conveniently accessing all the [logs](/openpilot/system/loggerd/) from your routes. The LogReader class reads the non-video logs, i.e. rlog.bz2 and qlog.bz2. There's also a matching FrameReader class for reading the videos. ```python from openpilot.tools.lib.route import Route diff --git a/tools/lib/api.py b/tools/lib/api.py index f84fe7586..7fca9b320 100644 --- a/tools/lib/api.py +++ b/tools/lib/api.py @@ -20,7 +20,7 @@ class CommaApi: resp_json = resp.json() if isinstance(resp_json, dict) and resp_json.get('error'): if resp.status_code in [401, 403]: - raise UnauthorizedError('Unauthorized. Authenticate with tools/lib/auth.py') + raise UnauthorizedError('Unauthorized. Authenticate with openpilot/tools/lib/auth.py') e = APIError(str(resp.status_code) + ":" + resp_json.get('description', str(resp_json['error']))) e.status_code = resp.status_code diff --git a/tools/longitudinal_maneuvers/README.md b/tools/longitudinal_maneuvers/README.md index 643af7fd8..96b989b55 100644 --- a/tools/longitudinal_maneuvers/README.md +++ b/tools/longitudinal_maneuvers/README.md @@ -35,7 +35,7 @@ Test your vehicle's longitudinal control tuning with this tool. The tool will te 8. Gather the route ID and then run the report generator. The file will be exported to the same directory: ```sh - $ python tools/longitudinal_maneuvers/generate_report.py 57048cfce01d9625/0000010e--5b26bc3be7 'pcm accel compensation' + $ python openpilot/tools/longitudinal_maneuvers/generate_report.py 57048cfce01d9625/0000010e--5b26bc3be7 'pcm accel compensation' processing report for LEXUS_ES_TSS2 plotting maneuver: start from stop, runs: 4 diff --git a/tools/op.sh b/tools/op.sh index ecef240b5..3b766b61e 100755 --- a/tools/op.sh +++ b/tools/op.sh @@ -116,7 +116,7 @@ function op_check_git() { fi echo "Checking for git lfs files..." - if [[ $(file -b $OPENPILOT_ROOT/selfdrive/modeld/models/dmonitoring_model.onnx) == "data" ]]; then + if [[ $(file -b $OPENPILOT_ROOT/openpilot/selfdrive/modeld/models/dmonitoring_model.onnx) == "data" ]]; then echo -e " ↳ [${GREEN}✔${NC}] git lfs files found." else echo -e " ↳ [${RED}✗${NC}] git lfs files not found! Run 'git lfs pull'" @@ -201,7 +201,7 @@ function op_setup() { echo "Installing dependencies..." st="$(date +%s)" - SETUP_SCRIPT="tools/setup_dependencies.sh" + SETUP_SCRIPT="openpilot/tools/setup_dependencies.sh" if ! $OPENPILOT_ROOT/$SETUP_SCRIPT; then echo -e " ↳ [${RED}✗${NC}] Dependencies installation failed!" return 1 @@ -234,7 +234,7 @@ function op_setup() { function op_auth() { op_before_cmd - op_run_command tools/lib/auth.py "$@" + op_run_command openpilot/tools/lib/auth.py "$@" } function op_activate_venv() { @@ -269,12 +269,12 @@ function op_venv() { function op_adb() { op_before_cmd - op_run_command tools/scripts/adb_ssh.sh "$@" + op_run_command openpilot/tools/scripts/adb_ssh.sh "$@" } function op_ssh() { op_before_cmd - op_run_command tools/scripts/ssh.py "$@" + op_run_command openpilot/tools/scripts/ssh.py "$@" } function op_script() { @@ -298,7 +298,7 @@ function op_check() { function op_esim() { op_before_cmd - op_run_command common/esim/esim.py "$@" + op_run_command openpilot/common/esim/esim.py "$@" } function op_build() { @@ -307,7 +307,7 @@ function op_build() { cd "$CDIR" if [[ -f "/AGNOS" ]]; then # needed on AGNOS to not run out of memory - op_run_command system/manager/build.py + op_run_command openpilot/system/manager/build.py else # scons is fine on PC op_run_command scons "$@" @@ -316,7 +316,7 @@ function op_build() { function op_juggle() { op_before_cmd - op_run_command tools/plotjuggler/juggle.py "$@" + op_run_command openpilot/tools/plotjuggler/juggle.py "$@" } function op_lint() { @@ -331,23 +331,23 @@ function op_test() { function op_replay() { op_before_cmd - op_run_command tools/replay/replay "$@" + op_run_command openpilot/tools/replay/replay "$@" } function op_cabana() { op_before_cmd - op_run_command tools/cabana/cabana "$@" + op_run_command openpilot/tools/cabana/cabana "$@" } function op_sim() { op_before_cmd - op_run_command exec tools/sim/run_bridge.py & - op_run_command exec tools/sim/launch_openpilot.sh + op_run_command exec openpilot/tools/sim/run_bridge.py & + op_run_command exec openpilot/tools/sim/launch_openpilot.sh } function op_clip() { op_before_cmd - op_run_command tools/clip/run.py "$@" + op_run_command openpilot/tools/clip/run.py "$@" } function op_switch() { diff --git a/tools/plotjuggler/README.md b/tools/plotjuggler/README.md index 9a40ac798..efccbdc0b 100644 --- a/tools/plotjuggler/README.md +++ b/tools/plotjuggler/README.md @@ -6,7 +6,7 @@ Once you've [set up the openpilot environment](../README.md), this command will download PlotJuggler and install our plugins: -`cd tools/plotjuggler && ./juggle.py --install` +`cd openpilot/tools/plotjuggler && ./juggle.py --install` ## Usage diff --git a/tools/plotjuggler/juggle.py b/tools/plotjuggler/juggle.py index e1143a3cd..593192ed3 100755 --- a/tools/plotjuggler/juggle.py +++ b/tools/plotjuggler/juggle.py @@ -33,7 +33,7 @@ def print_jotpluggler_banner(): reset = "\033[0m" if purple else "" print(f"{purple}+-------------------------------------------------------------+{reset}") print(f"{purple}|{reset} JotPluggler is the future! Try it like this: {purple}|{reset}") - print(f"{purple}|{reset} ./tools/jotpluggler/jotpluggler --demo --layout tuning {purple}|{reset}") + print(f"{purple}|{reset} ./openpilot/tools/jotpluggler/jotpluggler --demo --layout tuning {purple}|{reset}") print(f"{purple}|{reset} {purple}|{reset}") print(f"{purple}|{reset} PlotJuggler will be deleted soon. {purple}|{reset}") print(f"{purple}|{reset} Missing a feature? Open an issue or post in #dev-openpilot. {purple}|{reset}") diff --git a/tools/plotjuggler/test_plotjuggler.py b/tools/plotjuggler/test_plotjuggler.py index 26bad25c3..d55aafe9b 100644 --- a/tools/plotjuggler/test_plotjuggler.py +++ b/tools/plotjuggler/test_plotjuggler.py @@ -11,7 +11,7 @@ from openpilot.common.basedir import BASEDIR from openpilot.common.timeout import Timeout from openpilot.tools.plotjuggler.juggle import DEMO_ROUTE, install -PJ_DIR = os.path.join(BASEDIR, "tools/plotjuggler") +PJ_DIR = os.path.join(BASEDIR, "openpilot/tools/plotjuggler") class TestPlotJuggler: diff --git a/tools/replay/README.md b/tools/replay/README.md index d2beda994..108df0893 100644 --- a/tools/replay/README.md +++ b/tools/replay/README.md @@ -8,7 +8,7 @@ Before starting a replay, you need to authenticate with your comma account using ```bash # Authenticate to access routes from your comma account: -python3 tools/lib/auth.py +python3 openpilot/tools/lib/auth.py ``` ## Replay a Remote Route @@ -16,13 +16,13 @@ You can replay a route from your comma account by specifying the route name. ```bash # Start a replay with a specific route: -tools/replay/replay +openpilot/tools/replay/replay # Example: -tools/replay/replay '5beb9b58bd12b691/0000010a--a51155e496' +openpilot/tools/replay/replay '5beb9b58bd12b691/0000010a--a51155e496' # Replay the default demo route: -tools/replay/replay --demo +openpilot/tools/replay/replay --demo ``` ## Replay a Local Route @@ -30,14 +30,14 @@ To replay a route stored locally on your machine, specify the route name and pro ```bash # Replay a local route -tools/replay/replay --data_dir="/path_to/route" +openpilot/tools/replay/replay --data_dir="/path_to/route" # Example: # If you have a local route stored at /path_to_routes with segments like: # 5beb9b58bd12b691/0000010a--a51155e496--0 # 5beb9b58bd12b691/0000010a--a51155e496--1 # You can replay it like this: -tools/replay/replay "5beb9b58bd12b691/0000010a--a51155e496" --data_dir="/path_to_routes" +openpilot/tools/replay/replay "5beb9b58bd12b691/0000010a--a51155e496" --data_dir="/path_to_routes" ``` ## Send Messages via ZMQ @@ -45,15 +45,15 @@ By default, replay sends messages via MSGQ. To switch to ZMQ, set the ZMQ enviro ```bash # Start replay and send messages via ZMQ: -ZMQ=1 tools/replay/replay +ZMQ=1 openpilot/tools/replay/replay ``` ## Usage For more information on available options and arguments, use the help command: ``` bash -$ tools/replay/replay -h -Usage: tools/replay/replay [options] route +$ openpilot/tools/replay/replay -h +Usage: openpilot/tools/replay/replay [options] route Mock openpilot components by publishing logged messages. Options: @@ -87,16 +87,16 @@ Arguments: To visualize the replay within the openpilot UI, run the following commands: ```bash -tools/replay/replay -cd selfdrive/ui && ./ui.py +openpilot/tools/replay/replay +cd openpilot/selfdrive/ui && ./ui.py ``` ## Work with plotjuggler If you want to use replay with plotjuggler, you can stream messages by running: ```bash -tools/replay/replay -tools/plotjuggler/juggle.py --stream +openpilot/tools/replay/replay +openpilot/tools/plotjuggler/juggle.py --stream ``` ## watch3 @@ -107,10 +107,10 @@ simply replay a route using the `--dcam` and `--ecam` flags: ```bash # start a replay -cd tools/replay && ./replay --demo --dcam --ecam +cd openpilot/tools/replay && ./replay --demo --dcam --ecam # then start watch3 -cd selfdrive/ui && ./watch3.py +cd openpilot/selfdrive/ui && ./watch3.py ``` ![](https://i.imgur.com/IeaOdAb.png) diff --git a/tools/replay/route.cc b/tools/replay/route.cc index 1560f1dce..326d28d72 100644 --- a/tools/replay/route.cc +++ b/tools/replay/route.cc @@ -123,7 +123,7 @@ bool Route::loadFromServer() { if (json.is_object() && json["error"].is_string()) { const std::string &error = json["error"].string_value(); if (error == "unauthorized") { - rWarning(">> Unauthorized. Authenticate with tools/lib/auth.py <<"); + rWarning(">> Unauthorized. Authenticate with openpilot/tools/lib/auth.py <<"); err_ = RouteLoadError::Unauthorized; } else if (error == "not_found") { rWarning("The specified route could not be found on the server."); diff --git a/tools/replay/ui.py b/tools/replay/ui.py index 838b7ab15..932b3f9b8 100755 --- a/tools/replay/ui.py +++ b/tools/replay/ui.py @@ -54,7 +54,7 @@ def ui_thread(addr): rl.set_target_fps(60) # Load font - font_path = os.path.join(BASEDIR, "selfdrive/assets/fonts/JetBrainsMono-Medium.ttf") + font_path = os.path.join(BASEDIR, "openpilot/selfdrive/assets/fonts/JetBrainsMono-Medium.ttf") font = rl.load_font_ex(font_path, 32, None, 0) camera_view = CameraView("camerad", VisionStreamType.VISION_STREAM_ROAD) diff --git a/tools/scripts/cpu_usage_stat.py b/tools/scripts/cpu_usage_stat.py index 5b72eacc6..902df1c77 100755 --- a/tools/scripts/cpu_usage_stat.py +++ b/tools/scripts/cpu_usage_stat.py @@ -8,7 +8,7 @@ System tools like top/htop can only show current cpu usage values, so I write th Calculate minumium/maximum/accumulated_average cpu usage as long term inspections. Monitor multiple processes simuteneously. Sample usage: - root@localhost:/data/openpilot$ python tools/scripts/cpu_usage_stat.py pandad,ubloxd + root@localhost:/data/openpilot$ python openpilot/tools/scripts/cpu_usage_stat.py pandad,ubloxd ('Add monitored proc:', './pandad') ('Add monitored proc:', 'python locationd/ubloxd.py') pandad: 1.96%, min: 1.96%, max: 1.96%, acc: 1.96% diff --git a/tools/scripts/get_fingerprint.py b/tools/scripts/get_fingerprint.py index 1cdf8534d..1e5e8eca5 100755 --- a/tools/scripts/get_fingerprint.py +++ b/tools/scripts/get_fingerprint.py @@ -4,7 +4,7 @@ # Instructions: # - connect to a Panda -# - run selfdrive/pandad/pandad +# - run openpilot/selfdrive/pandad/pandad # - launching this script # Note: it's very important that the car is in stock mode, in order to collect a complete fingerprint # - since some messages are published at low frequency, keep this script running for at least 30s, diff --git a/tools/scripts/profiling/snapdragon/README.md b/tools/scripts/profiling/snapdragon/README.md index f56ca182a..383d83ba9 100644 --- a/tools/scripts/profiling/snapdragon/README.md +++ b/tools/scripts/profiling/snapdragon/README.md @@ -4,10 +4,10 @@ snapdragon profiler * download from https://developer.qualcomm.com/software/snapdragon-profiler/tools-archive (need a qc developer account) * choose v2021.5 (verified working with 24.04 dev environment) -* unzip to selfdrive/debug/profiling/snapdragon/SnapdragonProfiler +* unzip to openpilot/selfdrive/debug/profiling/snapdragon/SnapdragonProfiler * run ```./setup-profiler.sh``` * run ```./setup-agnos.sh``` -* run ```selfdrive/debug/adb.sh``` on device +* run ```openpilot/selfdrive/debug/adb.sh``` on device * run the ```adb connect xxx``` command that was given to you on local pc * cd to SnapdragonProfiler and run ```./run_sdp.sh``` * connect to device -> choose device you just setup diff --git a/tools/scripts/ssh.py b/tools/scripts/ssh.py index 33eac4081..86e86c7ee 100755 --- a/tools/scripts/ssh.py +++ b/tools/scripts/ssh.py @@ -14,7 +14,7 @@ if __name__ == "__main__": parser.add_argument("device", help="device name or dongle id") parser.add_argument("--host", help="ssh jump server host", default="ssh.comma.ai") parser.add_argument("--port", help="ssh jump server port", default=22, type=int) - parser.add_argument("--key", help="ssh key", default=os.path.join(BASEDIR, "common/hardware/tici/id_rsa")) + parser.add_argument("--key", help="ssh key", default=os.path.join(BASEDIR, "openpilot/common/hardware/tici/id_rsa")) parser.add_argument("--debug", help="enable debug output", action="store_true") args = parser.parse_args() diff --git a/tools/setup.sh b/tools/setup.sh index dafd466ef..1437a1d68 100755 --- a/tools/setup.sh +++ b/tools/setup.sh @@ -121,10 +121,10 @@ function git_clone() { function install_with_op() { cd $OPENPILOT_ROOT - $OPENPILOT_ROOT/tools/op.sh install - $OPENPILOT_ROOT/tools/op.sh post-commit + $OPENPILOT_ROOT/openpilot/tools/op.sh install + $OPENPILOT_ROOT/openpilot/tools/op.sh post-commit - if ! $OPENPILOT_ROOT/tools/op.sh setup; then + if ! $OPENPILOT_ROOT/openpilot/tools/op.sh setup; then echo -e "\n[${RED}✗${NC}] failed to install openpilot!" return 1 fi diff --git a/tools/setup_dependencies.sh b/tools/setup_dependencies.sh index 6cfd75ce1..80f3ac4e4 100755 --- a/tools/setup_dependencies.sh +++ b/tools/setup_dependencies.sh @@ -2,7 +2,7 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -ROOT="$(cd "$DIR/../" && pwd)" +ROOT="$(git -C "$DIR" rev-parse --show-toplevel)" function retry() { local attempts=$1 diff --git a/tools/sim/README.md b/tools/sim/README.md index f6ddde258..b3e60a119 100644 --- a/tools/sim/README.md +++ b/tools/sim/README.md @@ -7,7 +7,7 @@ openpilot implements a [bridge](run_bridge.py) that allows it to run in the [Met First, start openpilot. ``` bash # Run locally -./tools/sim/launch_openpilot.sh +./openpilot/tools/sim/launch_openpilot.sh ``` ## Bridge usage @@ -44,7 +44,7 @@ options: ## MetaDrive ### Launching Metadrive -Start bridge processes located in tools/sim: +Start bridge processes located in openpilot/tools/sim: ``` bash ./run_bridge.py ``` \ No newline at end of file diff --git a/tools/sim/tests/test_sim_bridge.py b/tools/sim/tests/test_sim_bridge.py index 0b3650e0a..f93cc2ef5 100644 --- a/tools/sim/tests/test_sim_bridge.py +++ b/tools/sim/tests/test_sim_bridge.py @@ -9,7 +9,7 @@ from openpilot.cereal import messaging from openpilot.common.basedir import BASEDIR from openpilot.tools.sim.bridge.common import QueueMessageType -SIM_DIR = os.path.join(BASEDIR, "tools/sim") +SIM_DIR = os.path.join(BASEDIR, "openpilot/tools/sim") class TestSimBridgeBase: @classmethod