diff --git a/.github/workflows/auto_pr_review.yaml b/.github/workflows/auto_pr_review.yaml index 261109b8a2..97429873da 100644 --- a/.github/workflows/auto_pr_review.yaml +++ b/.github/workflows/auto_pr_review.yaml @@ -17,6 +17,7 @@ jobs: - uses: actions/labeler@v5.0.0 with: dot: true + sync-labels: true configuration-path: .github/labeler.yaml # Check PR target branch diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index db2737c14a..b5550649d2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,13 +15,12 @@ jobs: unit-tests: name: unit tests runs-on: ${{ matrix.os }} - timeout-minutes: 1 strategy: fail-fast: false matrix: os: [ubuntu-24.04, macos-latest] - #run: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] steps: + - uses: commaai/timeout@v1 - uses: actions/checkout@v4 - name: install uv and dependencies run: | @@ -35,10 +34,9 @@ jobs: static-analysis: name: static analysis runs-on: ubuntu-24.04 - timeout-minutes: 1 steps: + - uses: commaai/timeout@v1 - uses: actions/checkout@v4 - - run: sudo apt install --no-install-recommends -y cppcheck - name: setup python run: | curl -LsSf https://astral.sh/uv/install.sh | sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 61c331e075..03afd74162 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,20 +35,6 @@ repos: - --counting=detailed - --linelength=240 - --filter=-build,-legal,-readability,-runtime,-whitespace,+build/include_subdir,+build/forward_decl,+build/include_what_you_use,+build/deprecated,+whitespace/comma,+whitespace/line_length,+whitespace/empty_if_body,+whitespace/empty_loop_body,+whitespace/empty_conditional_body,+whitespace/forcolon,+whitespace/parens,+whitespace/semicolon,+whitespace/tab,+readability/braces -- repo: local - hooks: - - id: cppcheck - name: cppcheck - entry: cppcheck - language: system - types: [c++] - args: - - --error-exitcode=1 - - --language=c++ - - --inline-suppr - - --force - - --quiet - - -j4 - repo: local hooks: - id: generator diff --git a/README.md b/README.md index 169bcb8cdc..9e19db75f5 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@

opendbc

-

opendbc is a Python API for your car.
- Read the speed, steering angle, and more. Send gas, braking, and steering commands. + Control the gas, brake, steering, and more. Read the speed, steering angle, and more.

@@ -25,9 +24,72 @@ --- Most cars since 2016 have electronically-actuatable steering, gas, and brakes thanks to [LKAS](https://en.wikipedia.org/wiki/Lane_departure_warning_system#Lane_keeping_and_next_technologies) and [ACC](https://en.wikipedia.org/wiki/Adaptive_cruise_control). -The goal of this project is to support controlling every single one of those cars. See [docs/CARS.md](docs/CARS.md) for the current supported cars list. +The goal of this project is to support controlling the steering, gas, and brakes on every single one of those cars. + +While the primary focus is on supporting ADAS interfaces for [openpilot](https://github.com/commaai/openpilot), we're also interested in reading and writing as many things as we can (EV charge status, lock/unlocking doors, etc) such that we can build the best vehicle management app ever. + +--- + +This README and the [supported cars list](docs/CARS.md) are all the docs for the opendbc project. +Everything you need to know to use, contribute, and extend opendbc are in these docs. + +## Quick start + +```bash +git clone https://github.com/commaai/opendbc.git +cd opendbc + +pip3 install -e .[testing,docs] # install dependencies +scons -j8 # build with 8 cores +pytest . # run the tests +pre-commit run --all-files # run the linter +./test.sh # all-in-one for setup, build, lint, and test +``` + +[`examples/`](examples/) contains small example programs that can read state from the car and control the steering, gas, and brakes. +[`examples/joystick.py`](examples/joystick.py) allows you to control a car with a joystick. + +### Project Structure +* [`opendbc/dbc/`](opendbc/dbc/) is a repository of [DBC](https://en.wikipedia.org/wiki/CAN_bus#DBC) files +* [`opendbc/can/`](opendbc/can/) is a library for parsing and building CAN messages from DBC files +* [`opendbc/car/`](opendbc/car/) is a high-level library for interfacing with cars using Python + +## How to Port a Car + +This guide covers everything from adding support to a new car all the way to improving existing cars (e.g. adding longitudinal control or radar parsing). If similar cars to yours are already compatible, most of this work is likely already done for you. + +At its most basic, a car port will control the steering on a car. A "complete" car port will have all of: lateral control, longitudinal control, good tuning for both lateral and longitudinal, radar parsing (if equipped), fuzzy fingerprinting, and more. The new car support docs will clearly communicate each car's support level. + +### Connect to the Car + +The first step is to get connected to the car with a comma 3X and a car harness. +The car harness gets you connected to two different CAN buses and splits one of those buses to send our own actuation messages. + +If you're lucky, a harness compatible with your car will already be designed and sold on comma.ai/shop. +If you're not so lucky, start with a "developer harness" from comma.ai/shop and crimp on whatever connector you need. + +### Structure of a port + +Depending on , most of this basic structure will already be in place. -While the primary focus is on supporting ADAS interfaces for [openpilot](https://github.com/commaai/openpilot), we're also interested in reading and writing as many things as we can: EV charge status, lock/unlocking doors, etc. +The entirery of a car port lives in `opendbc/car//`: +* `carstate.py`: parses out the relevant information from the CAN stream using the car's DBC file +* `carcontroller.py`: outputs CAN messages to control the car +* `can.py`: thin Python helpers around the DBC file to build CAN messages +* `fingerprints.py`: database of ECU firmware versions for identifying car models +* `interface.py`: high level class for interfacing with the car +* `radar_interface.py`: parses out the radar +* `values.py`: enumerates the brand's supported cars + +### Reverse Engineer CAN messages + +Start off by recording a route with lots of interesting events: enable LKAS and ACC, turn the steering wheel both extremes, etc. Then, load up that route in [cabana](https://github.com/commaai/openpilot/tree/master/tools/cabana). + +### Tuning + +#### Longitudinal + +Use the [longitudinal maneuvers](https://github.com/commaai/openpilot/tree/master/tools/longitudinal_maneuvers) report to evaluate your car's longitudinal control and tune it. ## Contributing @@ -59,66 +121,48 @@ Every car port is eligible for a bounty: In addition to the standard bounties, we also offer higher value bounties for more popular cars. See those at [comma.ai/bounties](comma.ai/bounties). -### Project Structure -* [`opendbc/dbc/`](opendbc/dbc/) is a repository of [DBC](https://en.wikipedia.org/wiki/CAN_bus#DBC) files -* [`opendbc/can/`](opendbc/can/) is a library for parsing and building CAN messages from DBC files -* [`opendbc/car/`](opendbc/car/) is a high-level library for interfacing with cars using Python - -### Quick start - -```bash -git clone https://github.com/commaai/opendbc.git - -cd opendbc - -# Install the dependencies -pip3 install -e .[testing,docs] - -# Build -scons -j8 - -# Run the tests -pytest . - -# Run the linter -pre-commit run --all-files - -# ./test.sh is the all-in-one that will install deps, build, lint, and test -./test.sh -``` - -[`examples/`](examples/) contains small example programs that can read state from the car and control the steering, gas, and brakes. -[`examples/joystick.py`](examples/joystick.py) allows you to control a car with a joystick. - ## FAQ -***How do I use this?*** - -Depends on what you want to do. [openpilot](https://github.com/commaai/openpilot) is our development target and offers a replacement for your car's ADAS, but you can also use a [panda](https://comma.ai/shop/panda) for basic control or just reading state from your car. - -***What hardware do I need?*** +***How do I use this?*** A [comma 3X](https://comma.ai/shop/comma-3x) is custom-designed to be the best way to run and develop opendbc and openpilot. -* a [supported car](docs/CARS.md) -* a [car harness](https://comma.ai/shop/car-harness) -* a [comma 3X](https://comma.ai/shop/comma-3x) or [panda](https://comma.ai/shop/panda) +***Which cars are supported?*** See the [supported cars list](docs/CARS.md). -***Which cars are supported?*** +***Can I add support for my car?*** Yes, most car support comes from the community. Read the guide [here](https://github.com/commaai/opendbc/blob/docs/README.md#how-to-port-a-car). -See the [supported cars list](docs/CARS.md). +***Which cars can be supported?*** Any car with LKAS and ACC. More info [here](https://github.com/commaai/openpilot/blob/master/docs/CARS.md#dont-see-your-car-here). -***Can I add support for my car?*** +***How does this work?*** In short, we designed hardware to replace your car's built-in lane keep and adaptive cruise features. See [this talk](https://www.youtube.com/watch?v=FL8CxUSfipM) for an in-depth explanation. -Yes, most car support comes from the community. Join the [Discord](https://discord.comma.ai) and watch this [talk](https://www.youtube.com/watch?v=XxPS5TpTUnI&t=142s&pp=ygUPY29tbWFfY29uIGphc29u) to get started. (We also offer [paid bounties](https://comma.ai/bounties) on car ports.) +***Is there a timeline or roadmap for adding car support?*** No, most car support comes from the community, with comma doing final safety and quality validation. The more complete the community car port is and the more popular the car is, the more likely we are to pick it up as the next one to validate. -***Which cars can be supported?*** +### Terms -Any car with LKAS and ACC. More info [here](https://github.com/commaai/openpilot/blob/master/docs/CARS.md#dont-see-your-car-here). +* **port**: refers to the integration and support of a specific car +* **lateral control**: aka steering control +* **longitudinal control**: aka gas/brakes control +* **fingerprinting**: automatic process for identifying the car +* **[LKAS](https://en.wikipedia.org/wiki/Lane_departure_warning_system)**: lane keeping assist +* **[ACC](https://en.wikipedia.org/wiki/Adaptive_cruise_control)**: adaptive cruise control +* **[harness](https://comma.ai/shop/car-harness)**: car-specific hardware to attach to the car and intercept the ADAS messages +* **[panda](https://github.com/commaai/panda)**: hardware used to get on a car's CAN bus +* **[ECU](https://en.wikipedia.org/wiki/Electronic_control_unit)**: computers or control modules inside the car +* **[CAN bus](https://en.wikipedia.org/wiki/CAN_bus)**: a bus that connects the ECUs in a car +* **[cabana](https://github.com/commaai/openpilot/tree/master/tools/cabana#readme)**: our tool for reverse engineering CAN messages +* **[DBC file](https://en.wikipedia.org/wiki/CAN_bus#DBC)**: contains definitions for messages on a CAN bus +* **[openpilot](https://github.com/commaai/openpilot)**: an ADAS system for cars supported by opendbc +* **[comma](https://github.com/commaai)**: the company behind opendbc +* **[comma 3X](https://comma.ai/shop/comma-3x)**: the hardware used to run openpilot -***How does this work?*** +### More resources -In short, we designed hardware to sit at a convenient spot on your car's communication bus that allows for filtering out interesting messages and replacing them with our own. -See [this talk](https://www.youtube.com/watch?v=FL8CxUSfipM) for an in-depth explanation. +* [*How Do We Control The Car?*](https://www.youtube.com/watch?v=nNU6ipme878&pp=ygUoY29tbWEgY29uIDIwMjEgaG93IGRvIHdlIGNvbnRyb2wgdGhlIGNhcg%3D%3D) by [@robbederks](https://github.com/robbederks) from COMMA_CON 2021 +* [*How to Port a Car*](https://www.youtube.com/watch?v=XxPS5TpTUnI&t=142s&pp=ygUPamFzb24gY29tbWEgY29u) by [@jyoung8607](https://github.com/jyoung8607) from COMMA_CON 2023 +* [commaCarSegments](https://huggingface.co/datasets/commaai/commaCarSegments): a massive dataset of CAN data from 300 different car models +* [cabana](https://github.com/commaai/openpilot/tree/master/tools/cabana#readme): our tool for reverse engineering CAN messages +* [can_print_changes.py](https://github.com/commaai/openpilot/blob/master/selfdrive/debug/can_print_changes.py): diff the whole CAN bus across two drives, such as one without any LKAS and one with LKAS +* [longitudinal maneuvers](https://github.com/commaai/openpilot/tree/master/tools/longitudinal_maneuvers): a tool for evaluating and tuning longitudinal control +* [opendbc data](https://commaai.github.io/opendbc-data/): a repository of longitudinal maneuver evaluations ## Come work with us -- [comma.ai/jobs](https://comma.ai/jobs) -comma is hiring engineers to work on opendbc and [openpilot](https://github.com/commaai/openpilot). We love contributors. +comma is hiring engineers to work on opendbc and [openpilot](https://github.com/commaai/openpilot). We love hiring contributors. diff --git a/opendbc/can/logger.h b/opendbc/can/logger.h index bab70c4894..0101222acd 100644 --- a/opendbc/can/logger.h +++ b/opendbc/can/logger.h @@ -1,7 +1,6 @@ #pragma once #ifdef SWAGLOG -// cppcheck-suppress preprocessorErrorDirective #include SWAGLOG #else diff --git a/opendbc/car/chrysler/fingerprints.py b/opendbc/car/chrysler/fingerprints.py index 6462643281..f48d7270c4 100644 --- a/opendbc/car/chrysler/fingerprints.py +++ b/opendbc/car/chrysler/fingerprints.py @@ -498,6 +498,7 @@ b'68320950AL', b'68320950AM', b'68454268AB', + b'68454268AC', b'68475160AE', b'68475160AF', b'68475160AG', @@ -577,6 +578,7 @@ b'68448165AK', b'68455111AC ', b'68455119AC ', + b'68455137AC ', b'68455145AC ', b'68455145AE ', b'68455146AC ', @@ -631,6 +633,7 @@ b'68384328AD', b'68384332AD', b'68445531AC', + b'68445532AB', b'68445533AB', b'68445536AB', b'68445537AB', diff --git a/opendbc/car/ford/fingerprints.py b/opendbc/car/ford/fingerprints.py index c14c836669..121f24a754 100644 --- a/opendbc/car/ford/fingerprints.py +++ b/opendbc/car/ford/fingerprints.py @@ -137,6 +137,7 @@ ], (Ecu.abs, 0x760, None): [ b'NZ6C-2D053-AE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + b'NZ6C-2D053-AF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'NZ6C-2D053-AG\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'PZ6C-2D053-ED\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', b'PZ6C-2D053-EE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', diff --git a/opendbc/car/mazda/values.py b/opendbc/car/mazda/values.py index 393bfb7e5b..876557ab50 100644 --- a/opendbc/car/mazda/values.py +++ b/opendbc/car/mazda/values.py @@ -71,7 +71,7 @@ class CAR(Platforms): MAZDA_CX9.specs ) MAZDA_CX5_2022 = MazdaPlatformConfig( - [MazdaCarDocs("Mazda CX-5 2022-24")], + [MazdaCarDocs("Mazda CX-5 2022-25")], MAZDA_CX5.specs, ) diff --git a/opendbc/car/toyota/carcontroller.py b/opendbc/car/toyota/carcontroller.py index e208502821..0bc41b1d28 100644 --- a/opendbc/car/toyota/carcontroller.py +++ b/opendbc/car/toyota/carcontroller.py @@ -3,7 +3,7 @@ make_tester_present_msg, rate_limit, structs, ACCELERATION_DUE_TO_GRAVITY, DT_CTRL from opendbc.car.can_definitions import CanData from opendbc.car.common.filter_simple import FirstOrderFilter -from opendbc.car.common.numpy_fast import clip +from opendbc.car.common.numpy_fast import clip, interp from opendbc.car.common.pid import PIDController from opendbc.car.secoc import add_mac, build_sync_mac from opendbc.car.interfaces import CarControllerBase @@ -37,6 +37,26 @@ MAX_LTA_DRIVER_TORQUE_ALLOWANCE = 150 # slightly above steering pressed allows some resistance when changing lanes +def get_long_tune(CP, params): + kiBP = [0.] + kdBP = [0.] + kdV = [0.] + if CP.carFingerprint in TSS2_CAR: + kiV = [0.5] + kdV = [0.25 / 4] + + # Since we compensate for imprecise acceleration in carcontroller and error correct on aEgo, we can avoid using gains + if CP.flags & ToyotaFlags.RAISED_ACCEL_LIMIT: + kiV = [0.0] + else: + kiBP = [0., 5., 35.] + kiV = [3.6, 2.4, 1.5] + + return PIDController(0.0, (kiBP, kiV), k_f=1.0, k_d=(kdBP, kdV), + pos_limit=params.ACCEL_MAX, neg_limit=params.ACCEL_MIN, + rate=1 / (DT_CTRL * 3)) + + class CarController(CarControllerBase): def __init__(self, dbc_names, CP): super().__init__(dbc_names, CP) @@ -50,9 +70,16 @@ def __init__(self, dbc_names, CP): self.steer_rate_counter = 0 self.distance_button = 0 + self.long_pid = get_long_tune(self.CP, self.params) + + self.error_rate = FirstOrderFilter(0.0, 0.5, DT_CTRL * 3) + self.prev_error = 0.0 + + # *** start PCM compensation state *** self.pitch = FirstOrderFilter(0, 0.5, DT_CTRL) - self.accel_pid = PIDController(2.0, 0.5, 1 / (DT_CTRL * 3)) + # FIXME: rate isn't set properly + self.pcm_pid = PIDController(2.0, 0.5, 1 / (DT_CTRL * 3)) self.pcm_accel_compensation = FirstOrderFilter(0, 0.5, DT_CTRL * 3) # the PCM's reported acceleration request can sometimes mismatch aEgo, close the loop @@ -66,6 +93,7 @@ def __init__(self, dbc_names, CP): if not any(fw.ecu == Ecu.hybrid for fw in self.CP.carFw): self.pcm_accel_net.update_alpha(self.CP.longitudinalActuatorDelay + 0.2) self.net_acceleration_request.update_alpha(self.CP.longitudinalActuatorDelay + 0.2) + # *** end PCM compensation state *** self.packer = CANPacker(dbc_names[Bus.pt]) self.accel = 0 @@ -222,11 +250,11 @@ def update(self, CC, CS, now_nanos): pcm_accel_compensation = 0.0 if not stopping: # prevent compensation windup - self.accel_pid.neg_limit = pcm_accel_cmd - self.params.ACCEL_MAX - self.accel_pid.pos_limit = pcm_accel_cmd - self.params.ACCEL_MIN - pcm_accel_compensation = self.accel_pid.update(new_pcm_accel_net - self.net_acceleration_request.x) + self.pcm_pid.neg_limit = pcm_accel_cmd - self.params.ACCEL_MAX + self.pcm_pid.pos_limit = pcm_accel_cmd - self.params.ACCEL_MIN + pcm_accel_compensation = self.pcm_pid.update(new_pcm_accel_net - self.net_acceleration_request.x) else: - self.accel_pid.reset() + self.pcm_pid.reset() pcm_accel_cmd = pcm_accel_cmd - self.pcm_accel_compensation.update(pcm_accel_compensation) @@ -235,9 +263,29 @@ def update(self, CC, CS, now_nanos): self.pcm_accel_net_offset.x = 0.0 self.net_acceleration_request.x = 0.0 self.pcm_accel_net.x = CS.pcm_accel_net - self.accel_pid.reset() + self.pcm_pid.reset() self.permit_braking = True + if not (self.CP.flags & ToyotaFlags.RAISED_ACCEL_LIMIT): + if actuators.longControlState == LongCtrlState.pid: + # GVC does not overshoot ego acceleration when starting from stop, but still has a similar delay + if not self.CP.flags & ToyotaFlags.SECOC.value: + a_ego_blended = interp(CS.out.vEgo, [1.0, 2.0], [CS.gvc, CS.out.aEgo]) + else: + a_ego_blended = CS.out.aEgo + + error = pcm_accel_cmd - a_ego_blended + self.error_rate.update((error - self.prev_error) / (DT_CTRL * 3)) + self.prev_error = error + + pcm_accel_cmd = self.long_pid.update(error, error_rate=self.error_rate.x, + speed=CS.out.vEgo, + feedforward=pcm_accel_cmd) + else: + self.long_pid.reset() + self.error_rate.x = 0.0 + self.prev_error = 0.0 + # Along with rate limiting positive jerk above, this greatly improves gas response time # Consider the net acceleration request that the PCM should be applying (pitch included) net_acceleration_request_min = min(actuators.accel + accel_due_to_pitch, net_acceleration_request) diff --git a/opendbc/car/toyota/carstate.py b/opendbc/car/toyota/carstate.py index 1a52ef3241..ffed120314 100644 --- a/opendbc/car/toyota/carstate.py +++ b/opendbc/car/toyota/carstate.py @@ -54,6 +54,7 @@ def __init__(self, CP): self.acc_type = 1 self.lkas_hud = {} self.pcm_accel_net = 0.0 + self.gvc = 0.0 self.secoc_synchronization = None def update(self, can_parsers) -> structs.CarState: @@ -63,6 +64,9 @@ def update(self, can_parsers) -> structs.CarState: ret = structs.CarState() cp_acc = cp_cam if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) else cp + if not self.CP.flags & ToyotaFlags.SECOC.value: + self.gvc = cp.vl["VSC1S07"]["GVC"] + # Describes the acceleration request from the PCM if on flat ground, may be higher or lower if pitched # CLUTCH->ACCEL_NET is only accurate for gas, PCM_CRUISE->ACCEL_NET is only accurate for brake # These signals only have meaning when ACC is active @@ -241,6 +245,7 @@ def get_can_parsers(CP): ("GAS_PEDAL", 42), ] else: + pt_messages.append(("VSC1S07", 20)) if CP.carFingerprint not in [CAR.TOYOTA_MIRAI]: pt_messages.append(("ENGINE_RPM", 42)) diff --git a/opendbc/car/toyota/fingerprints.py b/opendbc/car/toyota/fingerprints.py index 9c3877ded5..e3bab79743 100644 --- a/opendbc/car/toyota/fingerprints.py +++ b/opendbc/car/toyota/fingerprints.py @@ -110,6 +110,7 @@ b'\x018966306Q6000\x00\x00\x00\x00', b'\x018966333N1100\x00\x00\x00\x00', b'\x018966333N4300\x00\x00\x00\x00', + b'\x018966333P3000\x00\x00\x00\x00', b'\x018966333P3100\x00\x00\x00\x00', b'\x018966333P3200\x00\x00\x00\x00', b'\x018966333P4200\x00\x00\x00\x00', @@ -160,6 +161,7 @@ b'8821F0605200 ', b'8821F0606200 ', b'8821F0607200 ', + b'8821F0607300 ', b'8821F0608000 ', b'8821F0608200 ', b'8821F0608300 ', @@ -192,6 +194,7 @@ b'8965B33581\x00\x00\x00\x00\x00\x00', b'8965B33611\x00\x00\x00\x00\x00\x00', b'8965B33621\x00\x00\x00\x00\x00\x00', + b'8965B33630\x00\x00\x00\x00\x00\x00', ], (Ecu.fwdRadar, 0x750, 0xf): [ b'8821F0601200 ', @@ -207,6 +210,7 @@ b'8821F0605200 ', b'8821F0606200 ', b'8821F0607200 ', + b'8821F0607300 ', b'8821F0608000 ', b'8821F0608200 ', b'8821F0608300 ', @@ -754,6 +758,7 @@ b'\x018966353Q2300\x00\x00\x00\x00', b'\x018966353Q4000\x00\x00\x00\x00', b'\x018966353R1100\x00\x00\x00\x00', + b'\x018966353R7000\x00\x00\x00\x00', b'\x018966353R7100\x00\x00\x00\x00', b'\x018966353R8000\x00\x00\x00\x00', b'\x018966353R8100\x00\x00\x00\x00', @@ -1353,6 +1358,7 @@ ], (Ecu.fwdCamera, 0x750, 0x6d): [ b'\x028646F0610000\x00\x00\x00\x008646G3304000\x00\x00\x00\x00', + b'\x028646F0610100\x00\x00\x00\x008646G3304000\x00\x00\x00\x00', b'\x028646F33030D0\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', b'\x028646F3303100\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', b'\x028646F3303200\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00', @@ -1550,6 +1556,7 @@ b'\x01896630E36100\x00\x00\x00\x00', b'\x01896630E36200\x00\x00\x00\x00', b'\x01896630E36300\x00\x00\x00\x00', + b'\x01896630E36600\x00\x00\x00\x00', b'\x01896630E37100\x00\x00\x00\x00', b'\x01896630E37200\x00\x00\x00\x00', b'\x01896630E37300\x00\x00\x00\x00', @@ -1656,6 +1663,7 @@ b'\x02348X8000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00', b'\x02348Y3000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00', b'\x0234D14000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00', + b'\x0234D15000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00', b'\x0234D16000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00', ], (Ecu.abs, 0x7b0, None): [ diff --git a/opendbc/car/toyota/interface.py b/opendbc/car/toyota/interface.py index 7c99a45ccb..8ab2e47751 100644 --- a/opendbc/car/toyota/interface.py +++ b/opendbc/car/toyota/interface.py @@ -47,7 +47,7 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime found_ecus = [fw.ecu for fw in car_fw] ret.enableDsu = len(found_ecus) > 0 and Ecu.dsu not in found_ecus and candidate not in (NO_DSU_CAR | UNSUPPORTED_DSU_CAR) - if candidate in (CAR.LEXUS_ES_TSS2, CAR.TOYOTA_COROLLA_TSS2) and Ecu.hybrid not in found_ecus: + if candidate in (CAR.LEXUS_ES_TSS2,) and Ecu.hybrid not in found_ecus: ret.flags |= ToyotaFlags.RAISED_ACCEL_LIMIT.value if candidate == CAR.TOYOTA_PRIUS: @@ -133,21 +133,11 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime # to a negative value, so it won't matter. ret.minEnableSpeed = -1. if stop_and_go else MIN_ACC_SPEED - tune = ret.longitudinalTuning if candidate in TSS2_CAR: - tune.kpV = [0.0] - tune.kiV = [0.5] ret.vEgoStopping = 0.25 ret.vEgoStarting = 0.25 ret.stoppingDecelRate = 0.3 # reach stopping target smoothly - # Since we compensate for imprecise acceleration in carcontroller and error correct on aEgo, we can avoid using gains - if ret.flags & ToyotaFlags.RAISED_ACCEL_LIMIT: - tune.kiV = [0.0] - else: - tune.kiBP = [0., 5., 35.] - tune.kiV = [3.6, 2.4, 1.5] - return ret @staticmethod diff --git a/opendbc/car/toyota/values.py b/opendbc/car/toyota/values.py index cfd00b5f33..bc4e182aa7 100644 --- a/opendbc/car/toyota/values.py +++ b/opendbc/car/toyota/values.py @@ -294,7 +294,7 @@ class CAR(Platforms): LEXUS_ES_TSS2 = ToyotaTSS2PlatformConfig( [ ToyotaCarDocs("Lexus ES 2019-24"), - ToyotaCarDocs("Lexus ES Hybrid 2019-24", video_link="https://youtu.be/BZ29osRVJeg?t=12"), + ToyotaCarDocs("Lexus ES Hybrid 2019-25", video_link="https://youtu.be/BZ29osRVJeg?t=12"), ], LEXUS_ES.specs, ) diff --git a/opendbc/car/volkswagen/fingerprints.py b/opendbc/car/volkswagen/fingerprints.py index 2ca7ddf435..78cda7aab6 100644 --- a/opendbc/car/volkswagen/fingerprints.py +++ b/opendbc/car/volkswagen/fingerprints.py @@ -13,6 +13,7 @@ b'\xf1\x873G0906259F \xf1\x890004', b'\xf1\x873G0906259G \xf1\x890004', b'\xf1\x873G0906259G \xf1\x890005', + b'\xf1\x873G0906259J \xf1\x890002', b'\xf1\x873G0906259M \xf1\x890003', b'\xf1\x873G0906259N \xf1\x890004', b'\xf1\x873G0906259P \xf1\x890001', @@ -22,6 +23,7 @@ b'\xf1\x8709G927158L \xf1\x893611', b'\xf1\x870DL300014C \xf1\x893704', b'\xf1\x870GC300011L \xf1\x891401', + b'\xf1\x870GC300013Q \xf1\x892402', b'\xf1\x870GC300014M \xf1\x892802', b'\xf1\x870GC300019G \xf1\x892804', b'\xf1\x870GC300040P \xf1\x891401', @@ -30,6 +32,7 @@ b'\xf1\x873Q0959655BK\xf1\x890703\xf1\x82\x0e1616001613121157161111572900', b'\xf1\x873Q0959655BK\xf1\x890703\xf1\x82\x0e1616001613121177161113772900', b'\xf1\x873Q0959655CK\xf1\x890711\xf1\x82\x0e1712141712141105121122052900', + b'\xf1\x873Q0959655CR\xf1\x890720\xf1\x82\x0e1616001613121105161111052900', b'\xf1\x873Q0959655DA\xf1\x890720\xf1\x82\x0e1712141712141105121122052900', b'\xf1\x873Q0959655DL\xf1\x890732\xf1\x82\x0e1812141812171105141123052J00', b'\xf1\x875QF959655AP\xf1\x890755\xf1\x82\x1311110011111311111100110200--1611125F49', @@ -37,6 +40,7 @@ (Ecu.eps, 0x712, None): [ b'\xf1\x873Q0909144K \xf1\x895072\xf1\x82\x0571B41815A1', b'\xf1\x873Q0909144L \xf1\x895081\xf1\x82\x0571B00817A1', + b'\xf1\x873Q0909144M \xf1\x895082\xf1\x82\x0571B00818A1', b'\xf1\x875Q0910143C \xf1\x892211\xf1\x82\x0567B0020800', b'\xf1\x875WA907145M \xf1\x891051\xf1\x82\x002MB4092M7N', b'\xf1\x875WA907145M \xf1\x891051\xf1\x82\x002NB4202N7N', @@ -220,6 +224,7 @@ b'\xf1\x870D9300014M \xf1\x895004', b'\xf1\x870D9300014Q \xf1\x895006', b'\xf1\x870D9300018 \xf1\x895201', + b'\xf1\x870D9300020D \xf1\x894309', b'\xf1\x870D9300020J \xf1\x894902', b'\xf1\x870D9300020Q \xf1\x895201', b'\xf1\x870D9300020S \xf1\x895201', diff --git a/opendbc/dbc/SConscript b/opendbc/dbc/SConscript index fd8d84529e..c24e5daa81 100644 --- a/opendbc/dbc/SConscript +++ b/opendbc/dbc/SConscript @@ -24,7 +24,7 @@ output_files += [ ] generated = env.Command( - target=output_files, + target=list(set(output_files)), source=[generator] + source_files, action="python3 ${SOURCES[0]}", )