Skip to content

Commit b5407b4

Browse files
author
Vehicle Researcher
committed
Squashed 'opendbc/' changes from f1e69a6..0430bfa
0430bfa run pre commit in ci (#268) 2ade6ee Subaru DBC update (#242) d1185a5 Toyota ACC_CONTROL PERMIT_BRAKING and ACCEL_CMT_ALT speculated definition (#258) e6766bb Update SCC ECU Messages for OP Long Dev. (#267) b49b9ee Add DAW (#175) 3b5cccb Fixed up cell voltage readings and added more commands (#220) 8b04493 Mazda: add missing static bits, tidy up endianness (#263) 1247199 Add BSD_RCTA to Subaru Global (#244) af1821f fix endianness in signal from new hyundai message 7ef4108 Add gas/brake message for hyundai EVs, from @TK211X 472aabb Subaru preglobal update (#260) 45c0d9e fix lta message (#262) 11343c1 Library cleanup (#261) 67d70cb Fix Toyota message size git-subtree-dir: opendbc git-subtree-split: 0430bfa
1 parent e0ab166 commit b5407b4

34 files changed

+921
-832
lines changed

.github/workflows/tests.yml

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
set -e
1313
docker build -t opendbc .
1414
name: "Build"
15+
- name: Static analysis
16+
run: |
17+
docker run opendbc bash -c "cd opendbc && git init && git add -A && pre-commit run --all"
1518
- run: |
1619
docker run opendbc bash -c "python -m unittest discover opendbc"
1720
name: "Unit tests"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.mypy_cache/
12
*.pyc
23
*.os
34
*.tmp

.pre-commit-config.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: master
4+
hooks:
5+
- id: check-ast
6+
- id: check-json
7+
- id: check-xml
8+
- id: check-yaml
9+
- repo: https://github.com/pre-commit/mirrors-mypy
10+
rev: master
11+
hooks:
12+
- id: mypy
13+
- repo: https://github.com/PyCQA/flake8
14+
rev: master
15+
hooks:
16+
- id: flake8
17+
args:
18+
- --select=F
19+
- repo: local
20+
hooks:
21+
- id: pylint
22+
name: pylint
23+
entry: pylint
24+
language: system
25+
types: [python]
26+
args:
27+
- --disable=R,C,W

Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from ubuntu:16.04
22

3-
RUN apt-get update && apt-get install -y libzmq3-dev clang wget git autoconf libtool curl make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
3+
RUN apt-get update && apt-get install -y libzmq3-dev capnproto libcapnp-dev clang wget git autoconf libtool curl make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
44

55
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
66
ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"
@@ -10,16 +10,16 @@ RUN pyenv rehash
1010

1111
COPY requirements.txt /tmp/
1212
RUN pip install -r /tmp/requirements.txt
13+
RUN pip install pre-commit==2.4.0 pylint==2.5.2
1314

1415
ENV PYTHONPATH=/project
1516

17+
WORKDIR /project
1618
# TODO: Add tag to cereal
1719
RUN git clone https://github.com/commaai/cereal.git /project/cereal
18-
RUN /project/cereal/install_capnp.sh
19-
20-
WORKDIR /project
2120

2221
COPY SConstruct .
2322
COPY . /project/opendbc
2423

24+
RUN rm -rf /project/opendbc/.git
2525
RUN scons -c && scons -j$(nproc)

can/packer_pyx_setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def get_ext_filename(self, ext_name):
3333

3434

3535
sourcefiles = ['packer_pyx.pyx']
36-
extra_compile_args = ["-std=c++11"]
36+
extra_compile_args = ["-std=c++14"]
3737
ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # pylint: disable=unexpected-keyword-arg
3838

3939
if ARCH == "aarch64":
@@ -54,7 +54,7 @@ def get_ext_filename(self, ext_name):
5454
extra_compile_args=extra_compile_args,
5555
include_dirs=[
5656
BASEDIR,
57-
os.path.join(BASEDIR, 'phonelibs', 'capnp-cpp/include'),
57+
os.path.join(BASEDIR, 'phonelibs'),
5858
],
5959
extra_link_args=[
6060
os.path.join(BASEDIR, 'opendbc', 'can', libdbc),

can/parser_pyx_setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def get_ext_filename(self, ext_name):
3333

3434

3535
sourcefiles = ['parser_pyx.pyx']
36-
extra_compile_args = ["-std=c++11"]
36+
extra_compile_args = ["-std=c++14"]
3737
ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # pylint: disable=unexpected-keyword-arg
3838

3939
if ARCH == "aarch64":
@@ -54,7 +54,7 @@ def get_ext_filename(self, ext_name):
5454
extra_compile_args=extra_compile_args,
5555
include_dirs=[
5656
BASEDIR,
57-
os.path.join(BASEDIR, 'phonelibs', 'capnp-cpp/include'),
57+
os.path.join(BASEDIR, 'phonelibs'),
5858
],
5959
extra_link_args=[
6060
os.path.join(BASEDIR, 'opendbc', 'can', libdbc),

can/process_dbc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def process(in_fn, out_fn):
4646
checksum_start_bit = 0
4747
counter_start_bit = 0
4848
little_endian = True
49-
elif can_dbc.name.startswith(("subaru_")):
49+
elif can_dbc.name.startswith(("subaru_global_")):
5050
checksum_type = "subaru"
5151
checksum_size = 8
5252
counter_size = None

generator/toyota/_toyota_2017.dbc

+7-4
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ BO_ 180 SPEED: 8 XXX
6060
SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX
6161
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
6262

63-
BO_ 353 DSU_SPEED: 8 XXX
63+
BO_ 353 DSU_SPEED: 7 XXX
6464
SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "kph" XXX
65-
65+
6666
BO_ 452 ENGINE_RPM: 8 CGW
6767
SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS
68-
68+
6969
BO_ 466 PCM_CRUISE: 8 XXX
7070
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
7171
SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX
@@ -128,10 +128,11 @@ BO_ 835 ACC_CONTROL: 8 DSU
128128
SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX
129129
SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX
130130
SG_ SET_ME_X3 : 19|4@0+ (1,0) [0|15] "" XXX
131-
SG_ SET_ME_1 : 30|1@0+ (1,0) [0|1] "" HCU
131+
SG_ PERMIT_BRAKING : 30|1@0+ (1,0) [0|1] "" HCU
132132
SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU
133133
SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU
134134
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
135+
SG_ ACCEL_CMD_ALT : 47|8@0- (0.05,0) [0|0] "m/s^2" XXX
135136

136137
BO_ 836 PRE_COLLISION_2: 8 DSU
137138
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX
@@ -285,6 +286,8 @@ CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active";
285286
CM_ SG_ 643 COUNTER "only used on cars that use this msg for cruise control";
286287
CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control";
287288
CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking";
289+
CM_ SG_ 835 PERMIT_BRAKING "Original ACC has this going high when a car in front is detected. In openpilot and before the PERMIT_BRAKING name, this was "SET_ME_1" and is hardcoded to be high. Unsure if only informational or has an effect though existing usage in openpilot is to always set it to 1. Originally 'PMTBRKG' in the leaked toyota_2017_ref_pt.dbc file and name expansion speculated to be PerMiT BRaKinG.";
290+
CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file.";
288291
CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit";
289292
CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel";
290293
CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces";

generator/toyota/toyota_nodsu_pt.dbc

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ CM_ "IMPORT _comma.dbc"
33
CM_ "IMPORT _toyota_nodsu_bsm.dbc"
44

55
BO_ 401 STEERING_LTA: 8 XXX
6-
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
76
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
87
SG_ SETME_X3 : 29|2@0+ (1,0) [0|3] "" XXX
98
SG_ PERCENTAGE : 39|8@0+ (1,0) [0|255] "" XXX
@@ -12,6 +11,9 @@ BO_ 401 STEERING_LTA: 8 XXX
1211
SG_ STEER_ANGLE_CMD : 15|16@0- (0.0573,0) [-540|540] "" XXX
1312
SG_ STEER_REQUEST : 25|1@0+ (1,0) [0|1] "" XXX
1413
SG_ BIT : 30|1@0+ (1,0) [0|1] "" XXX
14+
SG_ COUNTER : 6|6@0+ (1,0) [0|255] "" XXX
15+
SG_ STEER_REQUEST_2 : 0|1@0+ (1,0) [0|1] "" XXX
16+
SG_ SETME_X1 : 7|1@0+ (1,0) [0|1] "" XXX
1517

1618
BO_ 550 BRAKE_MODULE: 8 XXX
1719
SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX

0 commit comments

Comments
 (0)