Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into forester-2022-PR
Browse files Browse the repository at this point in the history
  • Loading branch information
jnewb1 committed Jul 11, 2023
2 parents 6a6d7fe + e498d01 commit cc4106d
Show file tree
Hide file tree
Showing 83 changed files with 1,573 additions and 583 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: repo

on:
schedule:
- cron: "0 15 * * 2"
workflow_dispatch:

jobs:
pre-commit-autoupdate:
name: pre-commit autoupdate
runs-on: ubuntu-20.04
container:
image: ghcr.io/commaai/opendbc:latest
steps:
- uses: actions/checkout@v3
- name: pre-commit autoupdate
run: |
git config --global --add safe.directory '*'
pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@5b4a9f6a9e2af26e5f02351490b90d01eb8ec1e5
with:
token: ${{ secrets.ACTIONS_CREATE_PR_PAT }}
commit-message: Update pre-commit hook versions
title: 'pre-commit: autoupdate hooks'
branch: pre-commit-updates
base: master
delete-branch: true
63 changes: 43 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,55 @@ name: tests
on: [push, pull_request]

env:
RUN: docker run --shm-size 1G --rm opendbc /bin/sh -c
RUN: docker run -v $GITHUB_WORKSPACE:/project/opendbc -w /project/opendbc -e PYTHONWARNINGS="error,default::DeprecationWarning" --shm-size 1G --rm opendbc /bin/bash -c
BUILD: |
docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile) || true
docker pull ghcr.io/commaai/opendbc:latest || true
docker build --cache-from ghcr.io/commaai/opendbc:latest -t opendbc -f Dockerfile .
PYTHONWARNINGS: error

jobs:
test:
unit-tests:
name: unit tests
runs-on: ubuntu-20.04
#strategy:
# fail-fast: false
# matrix:
# run: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: eval "$BUILD"
- name: Static analysis
run: |
docker run opendbc bash -c "cd opendbc && git init && git add -A && pre-commit run --all"
- name: Generator test
run: |
docker run opendbc bash -c "cd opendbc/generator && ./test_generator.py"
- name: Unit tests
run: |
docker run opendbc bash -c "python -m unittest discover opendbc"
- name: Push to dockerhub
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/opendbc'
run: |
docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
docker tag opendbc ghcr.io/commaai/opendbc:latest
docker push ghcr.io/commaai/opendbc:latest
- uses: actions/checkout@v3
- name: Build Docker image
run: eval "$BUILD"
- name: Build opendbc
run: ${{ env.RUN }} "cd ../ && scons -j$(nproc)"
- name: Unit tests
run: ${{ env.RUN }} "python -m unittest discover ."

static-analysis:
name: static analysis
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: eval "$BUILD"
- name: Build opendbc
run: ${{ env.RUN }} "cd ../ && scons -j$(nproc)"
- name: pre-commit
# TODO: a package pre-commit installs has a warning, remove the unset once that's fixed
run: ${{ env.RUN }} "unset PYTHONWARNINGS && pre-commit run --all"
- name: Generator test
run: ${{ env.RUN }} "generator/test_generator.py"

docker-push:
name: docker push
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/opendbc'
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: eval "$BUILD"
- name: Push to dockerhub
run: |
docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
docker tag opendbc ghcr.io/commaai/opendbc:latest
docker push ghcr.io/commaai/opendbc:latest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.sconsign.dblite

can/*.so
can/*.a
can/build/
can/obj/
can/packer_pyx.cpp
Expand Down
22 changes: 18 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-ast
- id: check-yaml
- id: check-merge-conflict
- id: check-symlinks
- repo: https://github.com/codespell-project/codespell
rev: v2.2.1
rev: v2.2.5
hooks:
- id: codespell
exclude: '\.dbc$'
args:
- --check-hidden
- --builtins clear,rare,informal,usage,code,names,en-GB_to_en-US
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
rev: v1.4.1
hooks:
- id: mypy
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
exclude: 'site_scons/'
Expand All @@ -37,6 +37,20 @@ repos:
exclude: 'site_scons/'
args:
- --disable=C,R,W0613,W0511,W0212,W0201,W0311,W0106,W0603,W0621,W0703,E1136
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.15.0
hooks:
- id: cython-lint
- id: double-quote-cython-strings
- repo: https://github.com/cpplint/cpplint
rev: 1.6.1
hooks:
- id: cpplint
args:
- --quiet
- --counting=detailed
- --linelength=240
- --filter=-legal,-build/include_order,-readability/casting,-whitespace/braces,-whitespace/indent,-whitespace/operators,-build/c++11,-readability/todo,-runtime/explicit,-runtime/int,-whitespace/comments,-readability/braces,-runtime/arrays,-runtime/references
- repo: local
hooks:
- id: cppcheck
Expand Down
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"
RUN pyenv install 3.8.10
RUN pyenv global 3.8.10
RUN pyenv install 3.11.4
RUN pyenv global 3.11.4
RUN pyenv rehash

COPY requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt
RUN pip install --no-cache-dir pre-commit==2.15.0 pylint==2.5.2
RUN pip install --no-cache-dir pre-commit==2.15.0 pylint==2.17.4

ENV PYTHONPATH=/project

RUN git config --global --add safe.directory '*'

WORKDIR /project
# TODO: Add tag to cereal
RUN git clone https://github.com/commaai/cereal.git /project/cereal && cd /project/cereal && git checkout d46f37c314bb92306207db44693b2f58c31f66b9
RUN git clone https://github.com/commaai/cereal.git /project/cereal && \
cd /project/cereal && \
git checkout 959ff79963b80829be9902d146c31fda44dbbd20 && \
rm -rf .git && \
scons -j$(nproc)

COPY SConstruct .
COPY ./site_scons /project/site_scons
COPY . /project/opendbc

RUN rm -rf /project/opendbc/.git && \
rm -rf /project/cereal/.git
RUN scons -c && scons -j$(nproc)
3 changes: 0 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ cereal_dir = Dir('.')
python_path = sysconfig.get_paths()['include']
cpppath = [
'#',
'#cereal',
"#cereal/messaging",
"#opendbc/can",
'/usr/lib/include',
python_path
]
Expand Down
2 changes: 1 addition & 1 deletion acura_ilx_2016_can_generated.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ BO_ 829 LKAS_HUD: 5 ADAS
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
SG_ BOH_2 : 23|2@0+ (1,0) [0|4] "" BDY
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY
Expand Down
2 changes: 1 addition & 1 deletion acura_rdx_2018_can_generated.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ BO_ 829 LKAS_HUD: 5 ADAS
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
SG_ BOH_2 : 23|2@0+ (1,0) [0|4] "" BDY
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY
Expand Down
6 changes: 3 additions & 3 deletions acura_rdx_2020_can_generated.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ BO_ 13274 LKAS_HUD_A: 5 ADAS
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
SG_ BOH_2 : 23|2@0+ (1,0) [0|4] "" BDY
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
SG_ SET_ME_X01 : 20|1@0+ (1,0) [0|1] "" BDY
Expand All @@ -378,7 +378,7 @@ BO_ 13275 LKAS_HUD_B: 8 ADAS
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
SG_ BOH_2 : 23|2@0+ (1,0) [0|4] "" BDY
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
SG_ SET_ME_X01 : 20|1@0+ (1,0) [0|1] "" BDY
Expand Down Expand Up @@ -436,7 +436,7 @@ BO_ 829 LKAS_HUD: 5 ADAS
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
SG_ BOH_2 : 23|2@0+ (1,0) [0|4] "" BDY
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY
Expand Down
26 changes: 16 additions & 10 deletions bmw_e9x_e8x.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ BO_ 170 AccPedal: 8 DME
SG_ CruisePedalInactive : 55|1@0+ (1,0) [0|1] "" XXX
SG_ ThrottlelPressed : 50|1@0+ (1,0) [0|1] "" XXX
SG_ AcceleratorPedalPressed : 52|1@0+ (1,0) [0|7] "" XXX
SG_ AcceleratorPedalPercentage : 16|16@1+ (0.01,0) [0|100] "" XXX
SG_ AcceleratorPedalPercentage : 16|16@1+ (0.04,0) [0|100] "" XXX
SG_ Counter_170 : 8|4@1+ (1,0) [0|15] "" XXX
SG_ EngineSpeed : 32|16@1- (0.25,0) [0|65535] "U/min" XXX
SG_ EngineSpeed : 32|16@1+ (0.25,0) [0|8000] "rpm" XXX
SG_ Checksum_170 : 0|8@1- (1,0) [0|65535] "" XXX

BO_ 404 CruiseControl: 4 SZL
Expand Down Expand Up @@ -98,10 +98,10 @@ BO_ 201 SteeringWheelAngle_DSC: 8 SZL
SG_ SteeringPosition : 0|16@1- (0.0428316886,0) [-600|600] "deg" DSC

BO_ 206 WheelSpeeds: 8 DSC
SG_ Wheel1 : 0|16@1- (0.0643699,0) [0|255] "kph" XXX
SG_ Wheel2 : 16|16@1- (0.0643699,0) [0|255] "kph" XXX
SG_ Wheel4 : 48|16@1- (0.0643699,0) [0|255] "kph" XXX
SG_ Wheel3 : 32|16@1- (0.0643699,0) [0|255] "kph" XXX
SG_ Wheel_FL : 0|16@1- (0.0625,0) [0|255] "kph" XXX
SG_ Wheel_FR : 16|16@1- (0.0625,0) [0|255] "kph" XXX
SG_ Wheel_RL : 32|16@1- (0.0625,0) [0|255] "kph" XXX
SG_ Wheel_RR : 48|16@1- (0.0625,0) [0|255] "kph" XXX

BO_ 884 WheelToleranceAdjustment: 8 DSC

Expand Down Expand Up @@ -141,6 +141,10 @@ BO_ 182 DynamicCruiseControlTorqueDemand: 8 DSC

BO_ 186 TransmissionData: 8 EGS
SG_ Counter_186 : 48|4@1+ (1,0) [0|14] "" XXX
SG_ Shifting : 4|1@1+ (1,0) [0|15] "" XXX
SG_ OutputShaftSpeed : 24|16@1- (0.125,0) [0|255] "rpm" XXX
SG_ GearRatio : 8|8@1+ (0.05,0) [0|255] "" XXX
SG_ GearTar : 0|4@1+ (1,-4) [0|255] "" XXX
SG_ Checksum_186 : 40|8@1+ (1,0) [0|15] "" XXX

BO_ 191 RequestedWheelTorqueDriveTrain: 8 LDM
Expand Down Expand Up @@ -198,6 +202,7 @@ BO_ 408 GearSelectorSwitch: 8 GWS
BO_ 422 DistanceRoute: 8 DSC

BO_ 436 InstrumentClusterStatus_KOMBI: 8 CCC
SG_ HandbrakeActive : 41|1@1+ (1,0) [0|3] "" XXX

BO_ 464 EngineData: 8 DME
SG_ RPM_IDLG_TAR : 56|8@1+ (5,0) [0|1270] "1/min" XXX
Expand All @@ -206,7 +211,7 @@ BO_ 464 EngineData: 8 DME
SG_ AIP_ENG : 24|8@1+ (2,598) [600|1106] "hPa" XXX
SG_ ST_SW_WAUP : 22|2@1+ (1,0) [0|0] "" XXX
SG_ ST_ENG_RUN : 20|2@1+ (1,0) [0|0] "" XXX
SG_ Counter_464 : 16|4@0+ (1,0) [0|14] "" XXX
SG_ Counter_464 : 16|4@1+ (1,0) [0|14] "" XXX
SG_ TEMP_EOI : 8|8@1+ (1,-48) [0|0] "C" XXX
SG_ TEMP_ENG : 0|8@1+ (1,-48) [0|0] "C" XXX

Expand All @@ -221,7 +226,7 @@ BO_ 200 SteeringWheelAngle_slow: 6 SZL

BO_ 466 TransmissionDataDisplay: 8 EGS
SG_ ShiftLeverMode : 32|2@1+ (1,0) [0|3] "" XXX
SG_ GearRelated_TBD : 12|4@1+ (1,0) [0|15] "" XXX
SG_ GearAct : 12|4@1+ (1,-4) [0|15] "" XXX
SG_ Counter_466 : 28|4@1+ (1,0) [0|14] "" XXX
SG_ ShiftLeverPosition : 0|4@1+ (1,0) [0|8] "" XXX
SG_ xFF : 40|8@1+ (1,0) [0|255] "" XXX
Expand Down Expand Up @@ -720,6 +725,7 @@ BO_ 843 Seat_back_lock_status_FA: 8 SM_FA
BO_ 845 Status_seat_back_lock_BF: 8 SM_BF

BO_ 847 Status_contact_handbrake: 8 JBBF
SG_ Handbrake_push : 0|2@1+ (1,0) [0|3] "" XXX

BO_ 858 Appointment_Condition_Based_Service: 8 CCC

Expand Down Expand Up @@ -853,7 +859,6 @@ BO_ 996 Configuration_rear_view_camera_CKM: 8 CCC
CM_ SG_ 170 ThrottlelPressed "Active when accelerator pedal pressed or cruise control: drives";
CM_ SG_ 170 AcceleratorPedalPressed "Active only when driver actually presses the pedal";
CM_ SG_ 170 AcceleratorPedalPercentage "ToDo Factor to be adjusted";

CM_ SG_ 404 plus1mph_request "Appears when +1mph/kph stalk is depressed";
CM_ SG_ 404 minus1mph_request "Appears when -1mph/kph stalk is depressed";
CM_ SG_ 404 Cancel_request_up_stalk "Appears when cancel stalk (up) is depressed";
Expand All @@ -871,7 +876,8 @@ CM_ SG_ 169 ALIV_TORQ_2_DME "Counter TORQ_2";
CM_ SG_ 182 TORQ_TAR_DSC "torque target DSC";

CM_ SG_ 403 CruiseControlSetpointSpeed "Speed target - unit depends on locale";

CM_ SG_ 186 GearTar "Values corresponds to forward gears. TBD Add enums for park, reverse";
CM_ SG_ 466 GearAct "TransmissionDataDisplay";
CM_ SG_ 414 DSC_full_off "0x4 enabling, 0xA enabled. TBD";

CM_ SG_ 416 YawRate "Lateral Acceleration";
Expand Down
9 changes: 8 additions & 1 deletion can/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import os
envDBC = env.Clone()
dbc_file_path = '-DDBC_FILE_PATH=\'"%s"\'' % (envDBC.Dir("..").abspath)
envDBC['CXXFLAGS'] += [dbc_file_path]
libdbc = envDBC.SharedLibrary('libdbc', ["dbc.cc", "parser.cc", "packer.cc", "common.cc"], LIBS=[common, "capnp", "kj", "zmq"])
src = ["dbc.cc", "parser.cc", "packer.cc", "common.cc"]
libs = [common, "capnp", "kj", "zmq"]

# shared library for openpilot
libdbc = envDBC.SharedLibrary('libdbc', src, LIBS=libs)

# static library for tools like cabana
envDBC.Library('libdbc_static', src, LIBS=libs)

# Build packer and parser
lenv = envCython.Clone()
Expand Down
Loading

0 comments on commit cc4106d

Please sign in to comment.