Merge remote-tracking branch 'upstream/master' into toyota-fuzzy-v2

pull/28641/head
Shane Smiskol 2 years ago
commit a1145f1b1b
  1. 7
      .devcontainer/Dockerfile
  2. 3
      .devcontainer/host_setup.sh
  3. 5
      .github/workflows/selfdrive_tests.yaml
  4. 7
      .github/workflows/setup-with-retry/action.yaml
  5. 21
      .github/workflows/setup/action.yaml
  6. 2
      common/params.cc
  7. 2
      common/params_pyx.pyx
  8. 2
      selfdrive/car/hyundai/values.py
  9. 2
      selfdrive/car/tests/routes.py
  10. 6
      selfdrive/car/torque_data/override.yaml
  11. 19
      selfdrive/car/toyota/interface.py
  12. 3
      selfdrive/car/toyota/values.py
  13. 40
      tools/README.md
  14. 18
      tools/cabana/chart/chart.cc
  15. 4
      tools/cabana/chart/chart.h
  16. 4
      tools/sim/lib/simulated_car.py

@ -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

@ -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

@ -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

@ -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

@ -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

@ -64,7 +64,7 @@ bool create_params_path(const std::string &param_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;
}

@ -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

@ -141,7 +141,7 @@ class Footnote(Enum):
CANFD = CarFootnote(
"Requires a comma 3X or <a href=\"https://comma.ai/shop/can-fd-panda-kit\" target=\"_blank\">CAN FD panda kit</a> " +
"for this <a href=\"https://en.wikipedia.org/wiki/CAN_FD\" target=\"_blank\">CAN FD car</a>.",
Column.MODEL, shop_footnote=True)
Column.MODEL, shop_footnote=False)
@dataclass

@ -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),

@ -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]

@ -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,10 +121,6 @@ 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]

@ -2428,8 +2428,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,

@ -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.

@ -10,7 +10,6 @@
#include <QGraphicsDropShadowEffect>
#include <QGraphicsItemGroup>
#include <QGraphicsOpacityEffect>
#include <QMenu>
#include <QMimeData>
#include <QOpenGLWidget>
#include <QPropertyAnimation>
@ -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;

@ -3,6 +3,7 @@
#include <tuple>
#include <utility>
#include <QMenu>
#include <QGraphicsPixmapItem>
#include <QGraphicsProxyWidget>
#include <QtCharts/QChartView>
@ -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;

@ -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)

Loading…
Cancel
Save