From 4b7b234b9e91c0a291e2ff3fae6e6b5f0cf02113 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 18 Sep 2023 15:53:16 -0700 Subject: [PATCH 1/9] CI: login to docker hub on BuildJet (#29961) * CI: login to docker hub on BuildJet * shell * try quotes * forward * try this * can't believe this is broken * try * fix process replay --- .github/workflows/selfdrive_tests.yaml | 5 +++++ .../workflows/setup-with-retry/action.yaml | 7 +++++++ .github/workflows/setup/action.yaml | 21 +++++++++++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index 9b2b565547..854faf4545 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -78,6 +78,7 @@ jobs: submodules: true - uses: ./.github/workflows/setup-with-retry with: + docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }} cache_key_prefix: scons_${{ matrix.arch }} - uses: ./.github/workflows/compile-openpilot timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 15 || 30) }} # allow more time when we missed the scons cache @@ -177,6 +178,7 @@ jobs: sudo rm -rf /Applications/ArmGNUToolchain/*/*/.fseventsd docker_push: + name: docker push strategy: matrix: arch: ${{ fromJson( (github.repository == 'commaai/openpilot') && '["x86_64", "aarch64"]' || '["x86_64"]' ) }} @@ -194,6 +196,7 @@ jobs: - uses: ./.github/workflows/setup-with-retry with: git-lfs: false + docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }} - name: Build and push CL Docker image if: matrix.arch == 'x86_64' run: | @@ -280,6 +283,8 @@ jobs: with: submodules: true - uses: ./.github/workflows/setup-with-retry + with: + docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }} - name: Cache test routes id: dependency-cache uses: actions/cache@v3 diff --git a/.github/workflows/setup-with-retry/action.yaml b/.github/workflows/setup-with-retry/action.yaml index e4c97af3ce..159778211d 100644 --- a/.github/workflows/setup-with-retry/action.yaml +++ b/.github/workflows/setup-with-retry/action.yaml @@ -1,6 +1,10 @@ name: 'openpilot env setup, with retry on failure' inputs: + docker_hub_pat: + description: 'Auth token for Docker Hub, required for BuildJet jobs' + required: false + default: '' git_lfs: description: 'Whether or not to pull the git lfs' required: false @@ -21,6 +25,7 @@ runs: uses: ./.github/workflows/setup continue-on-error: true with: + docker_hub_pat: ${{ inputs.docker_hub_pat }} git_lfs: ${{ inputs.git_lfs }} cache_key_prefix: ${{ inputs.cache_key_prefix }} is_retried: true @@ -32,6 +37,7 @@ runs: uses: ./.github/workflows/setup continue-on-error: true with: + docker_hub_pat: ${{ inputs.docker_hub_pat }} git_lfs: ${{ inputs.git_lfs }} cache_key_prefix: ${{ inputs.cache_key_prefix }} is_retried: true @@ -42,6 +48,7 @@ runs: if: steps.setup2.outcome == 'failure' uses: ./.github/workflows/setup with: + docker_hub_pat: ${{ inputs.docker_hub_pat }} git_lfs: ${{ inputs.git_lfs }} cache_key_prefix: ${{ inputs.cache_key_prefix }} is_retried: true diff --git a/.github/workflows/setup/action.yaml b/.github/workflows/setup/action.yaml index eebc376346..d00f968b5c 100644 --- a/.github/workflows/setup/action.yaml +++ b/.github/workflows/setup/action.yaml @@ -1,13 +1,17 @@ name: 'openpilot env setup' inputs: + docker_hub_pat: + description: 'Auth token for Docker Hub, required for BuildJet jobs' + required: true + default: '' git_lfs: description: 'Whether or not to pull the git lfs' - required: false + required: true default: 'true' cache_key_prefix: description: 'Prefix for caching key' - required: false + required: true default: 'scons_x86_64' is_retried: description: 'A mock param that asserts that we use the setup-with-retry instead of this action directly' @@ -29,6 +33,19 @@ runs: if: ${{ inputs.git_lfs == 'true' }} run: git lfs pull + # on BuildJet runners, must be logged into DockerHub to avoid rate limiting + # https://buildjet.com/for-github-actions/docs/guides/docker + - shell: bash + if: ${{ contains(runner.name, 'buildjet') && inputs.docker_hub_pat == '' }} + run: | + echo "Need to set the Docker Hub PAT secret as an input to this action" + exit 1 + - name: Login to Docker Hub + if: contains(runner.name, 'buildjet') + shell: bash + run: | + docker login -u adeebshihadeh -p ${{ inputs.docker_hub_pat }} + # build cache - id: date shell: bash From 50cca99e45d1db095ccbf47aaa155019d7c6e4c2 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Tue, 19 Sep 2023 07:14:54 +0800 Subject: [PATCH 2/9] cabana/chart: add contex menu (#29957) --- tools/cabana/chart/chart.cc | 18 +++++++++++++++--- tools/cabana/chart/chart.h | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/cabana/chart/chart.cc b/tools/cabana/chart/chart.cc index 537aac1f28..70536cc0c2 100644 --- a/tools/cabana/chart/chart.cc +++ b/tools/cabana/chart/chart.cc @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -66,8 +65,8 @@ void ChartView::createToolButtons() { close_btn_proxy->setWidget(remove_btn); close_btn_proxy->setZValue(chart()->zValue() + 11); + menu = new QMenu(this); // series types - QMenu *menu = new QMenu(this); auto change_series_group = new QActionGroup(menu); change_series_group->setExclusive(true); QStringList types{tr("Line"), tr("Step Line"), tr("Scatter")}; @@ -90,7 +89,9 @@ void ChartView::createToolButtons() { manage_btn_proxy->setWidget(manage_btn); manage_btn_proxy->setZValue(chart()->zValue() + 11); - QObject::connect(remove_btn, &QToolButton::clicked, [this]() { charts_widget->removeChart(this); }); + close_act = new QAction(tr("Close"), this); + QObject::connect(close_act, &QAction::triggered, [this] () { charts_widget->removeChart(this); }); + QObject::connect(remove_btn, &QToolButton::clicked, close_act, &QAction::triggered); QObject::connect(change_series_group, &QActionGroup::triggered, [this](QAction *action) { setSeriesType((SeriesType)action->data().toInt()); }); @@ -452,6 +453,17 @@ static QPixmap getDropPixmap(const QPixmap &src) { return px; } +void ChartView::contextMenuEvent(QContextMenuEvent *event) { + QMenu context_menu(this); + context_menu.addActions(menu->actions()); + context_menu.addSeparator(); + context_menu.addAction(charts_widget->undo_zoom_action); + context_menu.addAction(charts_widget->redo_zoom_action); + context_menu.addSeparator(); + context_menu.addAction(close_act); + context_menu.exec(event->globalPos()); +} + void ChartView::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton && move_icon->sceneBoundingRect().contains(event->pos())) { QMimeData *mimeData = new QMimeData; diff --git a/tools/cabana/chart/chart.h b/tools/cabana/chart/chart.h index de2a1b4510..f91b81cc91 100644 --- a/tools/cabana/chart/chart.h +++ b/tools/cabana/chart/chart.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -65,6 +66,7 @@ private slots: private: void createToolButtons(); void addSeries(QXYSeries *series); + void contextMenuEvent(QContextMenuEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *ev) override; @@ -98,7 +100,9 @@ private: int align_to = 0; QValueAxis *axis_x; QValueAxis *axis_y; + QMenu *menu; QAction *split_chart_act; + QAction *close_act; QGraphicsPixmapItem *move_icon; QGraphicsProxyWidget *close_btn_proxy; QGraphicsProxyWidget *manage_btn_proxy; From 747a6149b41a91a9438a7f735b057007da73ac9a Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 18 Sep 2023 16:30:11 -0700 Subject: [PATCH 3/9] docs: don't show panda kit in shop (#29963) --- selfdrive/car/hyundai/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index b84cb80843..3239be6d76 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -141,7 +141,7 @@ class Footnote(Enum): CANFD = CarFootnote( "Requires a comma 3X or CAN FD panda kit " + "for this CAN FD car.", - Column.MODEL, shop_footnote=True) + Column.MODEL, shop_footnote=False) @dataclass From 8aad9758cf901bb141724a4363e67da5fb044a7d Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Mon, 18 Sep 2023 16:50:44 -0700 Subject: [PATCH 4/9] Params: better error logging on constructor (#29954) * ensure params path * static anlysis * revert that --- common/params.cc | 2 +- common/params_pyx.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/params.cc b/common/params.cc index 63baa30315..e510b60160 100644 --- a/common/params.cc +++ b/common/params.cc @@ -64,7 +64,7 @@ bool create_params_path(const std::string ¶m_path, const std::string &key_pa std::string ensure_params_path(const std::string &prefix, const std::string &path = {}) { std::string params_path = path.empty() ? Path::params() : path; if (!create_params_path(params_path, params_path + prefix)) { - throw std::runtime_error(util::string_format("Failed to ensure params path, errno=%d", errno)); + throw std::runtime_error(util::string_format("Failed to ensure params path, errno=%d, path=%s", errno, params_path.c_str())); } return params_path; } diff --git a/common/params_pyx.pyx b/common/params_pyx.pyx index abb3199d05..cc6bd287a6 100644 --- a/common/params_pyx.pyx +++ b/common/params_pyx.pyx @@ -14,7 +14,7 @@ cdef extern from "common/params.h": ALL cdef cppclass c_Params "Params": - c_Params(string) nogil + c_Params(string) nogil except + string get(string, bool) nogil bool getBool(string, bool) nogil int remove(string) nogil From 4b55d90af9d4c854168c7e1e3a6f834e8171405b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Sch=C3=A4fer?= Date: Mon, 18 Sep 2023 16:01:32 -1000 Subject: [PATCH 5/9] setup README: Native on 20.04, WSL on windows, otherwise devcontainer (#29928) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Main README: Webcam needs work, don't mention * Update README.md * Link to VSCode guide * Update README.md * Fix formatting * Update README.md * little more --------- Co-authored-by: Kacper Rączy Co-authored-by: Adeeb Shihadeh --- tools/README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/README.md b/tools/README.md index 28f4f7ebd2..36929a4290 100644 --- a/tools/README.md +++ b/tools/README.md @@ -2,55 +2,55 @@ ## System Requirements -openpilot is developed and tested on **Ubuntu 20.04**, which is the primary development target aside from the [supported embedded hardware](https://github.com/commaai/openpilot#running-on-a-dedicated-device-in-a-car). We also have a CI test to verify that openpilot builds on macOS, but the tools are untested. For the best experience, stick to Ubuntu 20.04, otherwise openpilot and the tools should work with minimal to no modifications on macOS and other Linux systems. +openpilot is developed and tested on **Ubuntu 20.04**, which is the primary development target aside from the [supported embedded hardware](https://github.com/commaai/openpilot#running-on-a-dedicated-device-in-a-car). -## Setup your PC +Running natively on any other system is not recommended and will require modifications. On Windows you can use WSL, and on macOS or incompatible Linux systems, it is recommended to use the dev containers. -First, clone openpilot: -``` bash -cd ~ -git clone --recurse-submodules https://github.com/commaai/openpilot.git +## Native setup on Ubuntu 20.04 + +**1. Clone openpilot** -# or do a partial clone instead for a faster clone and smaller repo size +Either do a partial clone for faster download: +``` bash git clone --filter=blob:none --recurse-submodules --also-filter-submodules https://github.com/commaai/openpilot.git +``` -cd openpilot +or do a full clone: +``` bash +git clone --recurse-submodules https://github.com/commaai/openpilot.git ``` -Then, run the setup script: +**2. Run the setup script** ``` bash -# for Ubuntu 20.04 LTS +cd openpilot tools/ubuntu_setup.sh - -# for macOS -tools/mac_setup.sh ``` Activate a shell with the Python dependencies installed: - ``` bash -cd openpilot && poetry shell +poetry shell ``` -Build openpilot with this command: +**3. Build openpilot** + ``` bash scons -u -j$(nproc) ``` -### Dev Container +## Dev Container on any Linux or macOS openpilot supports [Dev Containers](https://containers.dev/). Dev containers provide customizable and consistent development environment wrapped inside a container. This means you can develop in a designated environment matching our primary development target, regardless of your local setup. -Dev containers are supported in [multiple editors and IDEs](https://containers.dev/supporting), including [Visual Studio Code](https://code.visualstudio.com/docs/devcontainers/containers). +Dev containers are supported in [multiple editors and IDEs](https://containers.dev/supporting), including Visual Studio Code. Use the following [guide](https://code.visualstudio.com/docs/devcontainers/containers) to start using them with VSCode. #### X11 forwarding on macOS GUI apps like `ui` or `cabana` can also run inside the container by leveraging X11 forwarding. To make use of it on macOS, additional configuration steps must be taken. Follow [these](https://gist.github.com/sorny/969fe55d85c9b0035b0109a31cbcb088) steps to setup X11 forwarding on macOS. -### Windows +## WSL on Windows -Neither openpilot nor any of the tools are developed or tested on Windows, but the [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/about) should provide a similar experience to native Ubuntu. [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/compare-versions) specifically has been reported by several users to be a seamless experience. +[Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/about) should provide a similar experience to native Ubuntu. [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/compare-versions) specifically has been reported by several users to be a seamless experience. Follow [these instructions](https://docs.microsoft.com/en-us/windows/wsl/install) to setup the WSL and install the `Ubuntu-20.04` distribution. Once your Ubuntu WSL environment is setup, follow the Linux setup instructions to finish setting up your environment. See [these instructions](https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps) for running GUI apps. From 66e5531c2509c9df927efa05748bc786053d56d2 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 18 Sep 2023 19:32:27 -0700 Subject: [PATCH 6/9] add tmux and vim config to dev container (#29967) --- .devcontainer/Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e72704bfd0..08d3abaca9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,5 +2,10 @@ FROM ghcr.io/commaai/openpilot-base:latest # remove gitconfig if exists, since its gonna be replaced by host one RUN rm -f /root/.gitconfig -RUN apt update && apt install -y vim net-tools usbutils htop ripgrep + +RUN apt update && apt install -y vim net-tools usbutils htop ripgrep tmux RUN pip install ipython jupyter jupyterlab + +RUN cd $HOME && \ + curl -O https://raw.githubusercontent.com/commaai/agnos-builder/master/userspace/home/.tmux.conf && \ + curl -O https://github.com/commaai/agnos-builder/blob/master/userspace/home/.vimrc From d0a31515a0ab5a91a949cd6f9ef3e05ef093925f Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 18 Sep 2023 19:45:12 -0700 Subject: [PATCH 7/9] dev container: pull docker base image (#29968) --- .devcontainer/host_setup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/host_setup.sh b/.devcontainer/host_setup.sh index 597d0a1112..e8a0781a2c 100755 --- a/.devcontainer/host_setup.sh +++ b/.devcontainer/host_setup.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# pull base image +docker pull ghcr.io/commaai/openpilot-base:latest + # setup .host dir mkdir -p .devcontainer/.host From bee40de70312b892c50f7872e795977dec7f740f Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Tue, 19 Sep 2023 12:51:54 -0700 Subject: [PATCH 8/9] Simulator: fix controlsd mismatch (#29976) fix controls mismatch --- tools/sim/lib/simulated_car.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/sim/lib/simulated_car.py b/tools/sim/lib/simulated_car.py index bbdbb9fcc4..7cd01e1610 100644 --- a/tools/sim/lib/simulated_car.py +++ b/tools/sim/lib/simulated_car.py @@ -14,7 +14,7 @@ class SimulatedCar: def __init__(self): self.pm = messaging.PubMaster(['can', 'pandaStates']) - self.sm = messaging.SubMaster(['carControl', 'controlsState']) + self.sm = messaging.SubMaster(['carControl', 'controlsState', 'carParams']) self.cp = self.get_car_can_parser() self.idx = 0 @@ -93,6 +93,7 @@ class SimulatedCar: self.pm.send('can', can_list_to_can_capnp(msg)) def send_panda_state(self, simulator_state): + self.sm.update(0) dat = messaging.new_message('pandaStates', 1) dat.valid = True dat.pandaStates[0] = { @@ -100,6 +101,7 @@ class SimulatedCar: 'pandaType': "blackPanda", 'controlsAllowed': True, 'safetyModel': 'hondaNidec', + 'alternativeExperience': self.sm["carParams"].alternativeExperience } self.pm.send('pandaStates', dat) From b50a769ae9f1e13ad37d2dfa94896b58a301a703 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 19 Sep 2023 14:29:54 -0700 Subject: [PATCH 9/9] Revert "Toyota: use torque control for Japanese-made 2023 RAV4" (#29978) Revert "Toyota: use torque control for Japanese-made 2023 RAV4 (#29896)" This reverts commit 9dfd0579d4bcf4065ee289a2486bb77f0700655a. --- selfdrive/car/tests/routes.py | 2 +- selfdrive/car/torque_data/override.yaml | 6 ++- selfdrive/car/toyota/interface.py | 49 +++++++++++-------------- selfdrive/car/toyota/values.py | 3 +- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/selfdrive/car/tests/routes.py b/selfdrive/car/tests/routes.py index f7ad219f63..1e37ddf945 100755 --- a/selfdrive/car/tests/routes.py +++ b/selfdrive/car/tests/routes.py @@ -25,6 +25,7 @@ non_tested_cars = [ HONDA.ODYSSEY_CHN, VOLKSWAGEN.CRAFTER_MK2, # need a route from an ACC-equipped Crafter TOYOTA.RAV4_TSS2_2023, + TOYOTA.RAV4H_TSS2_2023, SUBARU.FORESTER_HYBRID, ] @@ -183,7 +184,6 @@ routes = [ CarTestRoute("a5c341bb250ca2f0|2022-05-18--16-05-17", TOYOTA.RAV4_TSS2_2022), CarTestRoute("7e34a988419b5307|2019-12-18--19-13-30", TOYOTA.RAV4H_TSS2), CarTestRoute("2475fb3eb2ffcc2e|2022-04-29--12-46-23", TOYOTA.RAV4H_TSS2_2022), - CarTestRoute("49e041422a032273|2023-09-14--09-21-32", TOYOTA.RAV4H_TSS2_2023), CarTestRoute("7a31f030957b9c85|2023-04-01--14-12-51", TOYOTA.LEXUS_ES), CarTestRoute("e6a24be49a6cd46e|2019-10-29--10-52-42", TOYOTA.LEXUS_ES_TSS2), CarTestRoute("da23c367491f53e2|2021-05-21--09-09-11", TOYOTA.LEXUS_CTH, segment=3), diff --git a/selfdrive/car/torque_data/override.yaml b/selfdrive/car/torque_data/override.yaml index 61ed8a5a77..fc39cd76cb 100644 --- a/selfdrive/car/torque_data/override.yaml +++ b/selfdrive/car/torque_data/override.yaml @@ -12,6 +12,10 @@ SUBARU FORESTER 2022: [.nan, 3.0, .nan] SUBARU OUTBACK 7TH GEN: [.nan, 3.0, .nan] SUBARU ASCENT 2023: [.nan, 3.0, .nan] +# Toyota LTA also has torque +TOYOTA RAV4 2023: [.nan, 3.0, .nan] +TOYOTA RAV4 HYBRID 2023: [.nan, 3.0, .nan] + # Tesla has high torque TESLA AP1 MODEL S: [.nan, 2.5, .nan] TESLA AP2 MODEL S: [.nan, 2.5, .nan] @@ -57,8 +61,6 @@ HYUNDAI KONA ELECTRIC 2ND GEN: [2.5, 2.5, 0.1] HYUNDAI IONIQ 6 2023: [2.5, 2.5, 0.1] HYUNDAI AZERA 6TH GEN: [1.8, 1.8, 0.1] KIA K8 HYBRID 1ST GEN: [2.5, 2.5, 0.1] -TOYOTA RAV4 2023: [2.5, 2.5, 0.1] -TOYOTA RAV4 HYBRID 2023: [2.5, 2.5, 0.1] # Dashcam or fallback configured as ideal car mock: [10.0, 10, 0.0] diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index d51026b547..d6f428ab1d 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -27,15 +27,7 @@ class CarInterface(CarInterfaceBase): if DBC[candidate]["pt"] == "toyota_new_mc_pt_generated": ret.safetyConfigs[0].safetyParam |= Panda.FLAG_TOYOTA_ALT_BRAKE - # Allow angle control cars with whitelisted EPSs to use torque control (made in Japan) - # So far only hybrid RAV4 2023 has been seen with this FW version - angle_car_torque_fw = any(fw.ecu == "eps" and fw.fwVersion == b'8965B42371\x00\x00\x00\x00\x00\x00' for fw in car_fw) - if candidate not in ANGLE_CONTROL_CAR or (angle_car_torque_fw and candidate == CAR.RAV4H_TSS2_2023): - CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) - - ret.steerActuatorDelay = 0.12 # Default delay, Prius has larger delay - ret.steerLimitTimer = 0.4 - else: + if candidate in ANGLE_CONTROL_CAR: ret.dashcamOnly = True ret.steerControlType = SteerControlType.angle ret.safetyConfigs[0].safetyParam |= Panda.FLAG_TOYOTA_LTA @@ -43,6 +35,11 @@ class CarInterface(CarInterfaceBase): # LTA control can be more delayed and winds up more often ret.steerActuatorDelay = 0.25 ret.steerLimitTimer = 0.8 + else: + CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) + + ret.steerActuatorDelay = 0.12 # Default delay, Prius has larger delay + ret.steerLimitTimer = 0.4 ret.stoppingControl = False # Toyota starts braking more when it thinks you want to stop @@ -124,25 +121,21 @@ class CarInterface(CarInterfaceBase): ret.steerRatio = 14.3 ret.tireStiffnessFactor = 0.7933 ret.mass = 3585. * CV.LB_TO_KG # Average between ICE and Hybrid - - # Only specific EPS FW accept torque on 2023 RAV4, so they likely are all the same - # TODO: revisit this disparity if there is a divide for 2023 - if candidate not in (CAR.RAV4_TSS2_2023, CAR.RAV4H_TSS2_2023): - ret.lateralTuning.init('pid') - ret.lateralTuning.pid.kiBP = [0.0] - ret.lateralTuning.pid.kpBP = [0.0] - ret.lateralTuning.pid.kpV = [0.6] - ret.lateralTuning.pid.kiV = [0.1] - ret.lateralTuning.pid.kf = 0.00007818594 - - # 2019+ RAV4 TSS2 uses two different steering racks and specific tuning seems to be necessary. - # See https://github.com/commaai/openpilot/pull/21429#issuecomment-873652891 - for fw in car_fw: - if fw.ecu == "eps" and (fw.fwVersion.startswith(b'\x02') or fw.fwVersion in [b'8965B42181\x00\x00\x00\x00\x00\x00']): - ret.lateralTuning.pid.kpV = [0.15] - ret.lateralTuning.pid.kiV = [0.05] - ret.lateralTuning.pid.kf = 0.00004 - break + ret.lateralTuning.init('pid') + ret.lateralTuning.pid.kiBP = [0.0] + ret.lateralTuning.pid.kpBP = [0.0] + ret.lateralTuning.pid.kpV = [0.6] + ret.lateralTuning.pid.kiV = [0.1] + ret.lateralTuning.pid.kf = 0.00007818594 + + # 2019+ RAV4 TSS2 uses two different steering racks and specific tuning seems to be necessary. + # See https://github.com/commaai/openpilot/pull/21429#issuecomment-873652891 + for fw in car_fw: + if fw.ecu == "eps" and (fw.fwVersion.startswith(b'\x02') or fw.fwVersion in [b'8965B42181\x00\x00\x00\x00\x00\x00']): + ret.lateralTuning.pid.kpV = [0.15] + ret.lateralTuning.pid.kiV = [0.05] + ret.lateralTuning.pid.kf = 0.00004 + break elif candidate in (CAR.COROLLA_TSS2, CAR.COROLLAH_TSS2): ret.wheelbase = 2.67 # Average between 2.70 for sedan and 2.64 for hatchback diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index fd0a54b349..bb9672fb0e 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -2389,8 +2389,7 @@ UNSUPPORTED_DSU_CAR = {CAR.LEXUS_IS, CAR.LEXUS_RC} # these cars have a radar which sends ACC messages instead of the camera RADAR_ACC_CAR = {CAR.RAV4H_TSS2_2022, CAR.RAV4_TSS2_2022, CAR.RAV4H_TSS2_2023, CAR.RAV4_TSS2_2023, CAR.CHR_TSS2, CAR.CHRH_TSS2} -# these cars manufactured in U.S., Canada have EPSs that reject Lane Keep Assist (LKA, torque) messages and require -# Lane Tracing Assist (LTA, angle) to steer properly. cars manufactured in Japan still work with the older LKA messages which is detected +# these cars use the Lane Tracing Assist (LTA) message for lateral control ANGLE_CONTROL_CAR = {CAR.RAV4H_TSS2_2023, CAR.RAV4_TSS2_2023} EV_HYBRID_CAR = {CAR.AVALONH_2019, CAR.AVALONH_TSS2, CAR.CAMRYH, CAR.CAMRYH_TSS2, CAR.CHRH, CAR.CHRH_TSS2, CAR.COROLLAH_TSS2,