Skip to content

Commit

Permalink
Merge branch 'commaai:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Tes1a8 authored Sep 19, 2023
2 parents 29eabfc + d0a3151 commit 76992cb
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 29 deletions.
7 changes: 6 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions .devcontainer/host_setup.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]' ) }}
Expand All @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/setup-with-retry/action.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
21 changes: 19 additions & 2 deletions .github/workflows/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion common/params_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/hyundai/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 20 additions & 20 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
18 changes: 15 additions & 3 deletions tools/cabana/chart/chart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <QGraphicsDropShadowEffect>
#include <QGraphicsItemGroup>
#include <QGraphicsOpacityEffect>
#include <QMenu>
#include <QMimeData>
#include <QOpenGLWidget>
#include <QPropertyAnimation>
Expand Down Expand Up @@ -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")};
Expand All @@ -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());
});
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions tools/cabana/chart/chart.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <tuple>
#include <utility>

#include <QMenu>
#include <QGraphicsPixmapItem>
#include <QGraphicsProxyWidget>
#include <QtCharts/QChartView>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -98,7 +100,9 @@ private slots:
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;
Expand Down

0 comments on commit 76992cb

Please sign in to comment.