Skip to content

Commit

Permalink
Squash merge of the following commits from commaai/master:
Browse files Browse the repository at this point in the history
7eca4d6 tools: better joystick instructions
ed5e58c Hyundai: use regular Hyundai safety mode and add radar DBC (commaai#23461)
233a6e4 LanePlanner: offsets cleanup (commaai#23459)
24213ac lfs: easier to use config (commaai#23490)
6e817f9 manager: default driverview to False (commaai#23492)
44592f4 statsd: run at 2Hz (commaai#23493)
35ec6ac use ndarray.tolist  to convert numpy array to float (commaai#23485)
8444f82 calibrationd: convert existing calibration to numpy (commaai#23494)
5fb9c6a thermald has slowly started to use more CPU
678732d AlertManager: cleanup add_many (commaai#23438)
85dcfbb update comment (commaai#23495)
a186bcc cleanup iterate keys in dictionaries (commaai#23497)
79577e4 boardd: remove ublox timestamp logging (commaai#23498)
dbae5e7 lateral_planner: use nympy.isnan().any() (commaai#23500)
b1a226b VW MQB: Add FW for 2022 Volkswagen Atlas (commaai#23501)
eb9f359 Toyota: Support Avalon 2022 (TSS2.5) (commaai#23381)
08a1ce0 update release notes
3816ecf bump opendbc
9941c99 process replay: handle inf and nan in absolute tolerance
de572c3 calibrationd: fix indentation (commaai#23502)
e5f9af4 calibrationd: Don't repeatedly call get_valid_idxs() (commaai#23473)
f808b17 use roll std from locationd (commaai#23449)
7d7c0ff tools: add bootlog helpers (commaai#23504)
ee52a61 add pre-commit hook for large files (commaai#23505)
c214aee cleanup .gitattributes (commaai#23503)
9e1428f Do not disable loggerd when below 5% space (commaai#23440)
48b6dfa controlsd: check self.enabled out of the any() (commaai#23507)
c84a085 bump cereal: more qlog decimation
fcfea4c Kia Niro EV - replace \000 by \x00 (commaai#23509)
6d16b0c can_printer.py: default no ascii
1538013 pandad: only reset pandas on first run (commaai#23511)
6d5dce2 Subaru: fix missing commas in fingerprints (commaai#23512)
2c94f15 linter: don't allow implicitly concatenated strings (commaai#23513)
d5f4fdb eliminate xx filereader (commaai#23514)
57156c4 Chrysler: remove standstill exception for gas disengage (commaai#23515)
df35ebd fix filereader cd:/ replacement
a6b46c3 filereader better name for cd:/ replacement
6dbae95 UI: reset interactivity timeout on PC (commaai#23508)
9f4fd73 Toyota: DBC signal renames (commaai#23452)
fd042a5 controlsd: cleanup parsing android log (commaai#23421)
feae375 swaglog.cc: add test case. fixed the ctx of the first message is empty (commaai#23226)
8c53adf swaglog: add daemon name to context (commaai#23518)
610b99f Log android system shutdown to param (commaai#23520)
ef3a549 thermald: remove modem version log (commaai#23524)
e72eb1d thermald: remove brightness setting on ui crash (commaai#23527)
ed23177 thermald: remove panda disconnect logic (commaai#23526)
53ca036 thermald: let manager handle shutdown (commaai#23528)
b75e410 boardd: panda_state_thread run closer to 2 Hz (commaai#23529)
785180d MainWindow::eventFilter: add static keyword for evts (commaai#23521)
75be122 ui/WifiManager: inherit from QObject instead of QWidget (commaai#23523)
39d904d ui/networking: combine connect functions into one (commaai#23522)
308a6f1 manager: log exit reason (commaai#23532)
  • Loading branch information
budney authored and Len Budney committed Jan 14, 2022
1 parent 5a7875b commit cb1b6fd
Show file tree
Hide file tree
Showing 76 changed files with 608 additions and 501 deletions.
6 changes: 0 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
*.keras filter=lfs diff=lfs merge=lfs -text
*.dlc filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.ipynb filter=nbstripout -diff
external/ffmpeg/bin/ffmpeg_cuda filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ jobs:
$UNIT_TEST tools/lib/tests && \
./selfdrive/boardd/tests/test_boardd_usbprotocol && \
./selfdrive/common/tests/test_util && \
./selfdrive/common/tests/test_swaglog && \
./selfdrive/loggerd/tests/test_logger &&\
./selfdrive/proclogd/tests/test_proclog && \
./selfdrive/ui/replay/tests/test_replay && \
Expand Down
3 changes: 2 additions & 1 deletion .lfsconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[lfs]
url = https://gitlab.com/commaai/openpilot-lfs.git/info/lfs
pushurl =
pushurl = ssh://[email protected]/commaai/openpilot-lfs.git
locksverify = false
16 changes: 13 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-ast
exclude: '^(pyextra)/'
Expand All @@ -9,8 +13,10 @@ repos:
- id: check-yaml
- id: check-merge-conflict
- id: check-symlinks
- id: check-added-large-files
args: ['--maxkb=100']
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
rev: v0.931
hooks:
- id: mypy
exclude: '^(pyextra/)|(cereal/)|(rednose/)|(panda/)|(laika/)|(opendbc/)|(laika_repo/)|(rednose_repo/)/'
Expand All @@ -21,17 +27,21 @@ repos:
hooks:
- id: flake8
exclude: '^(pyextra/)|(cereal/)|(rednose/)|(panda/)|(laika/)|(opendbc/)|(laika_repo/)|(rednose_repo/)|(selfdrive/debug/)/'
additional_dependencies: ['flake8-no-implicit-concat']
args:
- --indent-size=2
- --enable-extensions=NIC
- --select=F,E112,E113,E304,E502,E701,E702,E703,E71,E72,E731,W191,W6
- --statistics
- -j4
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
exclude: '^(pyextra/)|(cereal/)|(rednose/)|(panda/)|(laika/)|(laika_repo/)|(rednose_repo/)/'
exclude: '^(pyextra/)|(cereal/)|(rednose/)|(panda/)|(laika/)|(laika_repo/)|(rednose_repo/)'
- repo: local
hooks:
- id: cppcheck
Expand Down
5 changes: 5 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@ known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant

[STRING]

# This flag controls whether the implicit-str-concat should generate a warning
# on implicit string concatenation in sequences defined over several lines.
check-str-concat-over-line-jumps=yes

[EXCEPTIONS]

Expand Down
2 changes: 2 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Version 0.8.13 (2022-XX-XX)
========================
* Improved driver monitoring
* Roll compensation
* Improved camera focus on the comma two
* Subaru ECU firmware fingerprinting thanks to martinl!
* Hyundai Santa Fe Plug-in Hybrid 2022 support thanks to sunnyhaibin!
* Subaru Impreza 2020 support thanks to martinl!
* Toyota Avalon 2022 support thanks to sshane!

Version 0.8.12 (2021-12-15)
========================
Expand Down
2 changes: 1 addition & 1 deletion cereal
Submodule cereal updated 2 files
+1 −1 log.capnp
+3 −3 services.py
1 change: 0 additions & 1 deletion common/params_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ cdef extern from "selfdrive/common/params.h":
cpdef enum ParamKeyType:
PERSISTENT
CLEAR_ON_MANAGER_START
CLEAR_ON_PANDA_DISCONNECT
CLEAR_ON_IGNITION_ON
CLEAR_ON_IGNITION_OFF
ALL
Expand Down
8 changes: 0 additions & 8 deletions common/tests/test_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ def test_params_non_ascii(self):
self.params.put("CarParams", st)
assert self.params.get("CarParams") == st

def test_params_get_cleared_panda_disconnect(self):
self.params.put("CarParams", "test")
self.params.put("DongleId", "cb38263377b873ee")
assert self.params.get("CarParams") == b"test"
self.params.clear_all(ParamKeyType.CLEAR_ON_PANDA_DISCONNECT)
assert self.params.get("CarParams") is None
assert self.params.get("DongleId") is not None

def test_params_get_cleared_manager_start(self):
self.params.put("CarParams", "test")
self.params.put("DongleId", "cb38263377b873ee")
Expand Down
191 changes: 94 additions & 97 deletions docs/CARS.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions lfs-push.sh

This file was deleted.

2 changes: 1 addition & 1 deletion panda
1 change: 1 addition & 0 deletions release/files_common
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ selfdrive/hardware/base.py
selfdrive/hardware/hw.h
selfdrive/hardware/eon/__init__.py
selfdrive/hardware/eon/androidd.py
selfdrive/hardware/eon/shutdownd.py
selfdrive/hardware/eon/hardware.h
selfdrive/hardware/eon/hardware.py
selfdrive/hardware/eon/neos.py
Expand Down
42 changes: 6 additions & 36 deletions selfdrive/boardd/boardd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
#include <cassert>
#include <cerrno>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <future>
#include <thread>
#include <unordered_map>

#include <libusb-1.0/libusb.h>

Expand All @@ -26,7 +26,6 @@
#include "selfdrive/common/timing.h"
#include "selfdrive/common/util.h"
#include "selfdrive/hardware/hw.h"
#include "selfdrive/locationd/ublox_msg.h"

#include "selfdrive/boardd/panda.h"
#include "selfdrive/boardd/pigeon.h"
Expand Down Expand Up @@ -421,6 +420,8 @@ void panda_state_thread(PubMaster *pm, std::vector<Panda *> pandas, bool spoofin

// run at 2hz
while (!do_exit && check_all_connected(pandas)) {
uint64_t start_time = nanos_since_boot();

// send out peripheralState
send_peripheral_state(pm, peripheral_panda);
ignition = send_panda_states(pm, pandas, spoofing_started);
Expand Down Expand Up @@ -453,7 +454,9 @@ void panda_state_thread(PubMaster *pm, std::vector<Panda *> pandas, bool spoofin
for (const auto &panda : pandas) {
panda->send_heartbeat(engaged);
}
util::sleep_for(500);

uint64_t dt = nanos_since_boot() - start_time;
util::sleep_for(500 - dt / 1000000ULL);
}
}

Expand Down Expand Up @@ -552,38 +555,11 @@ void pigeon_thread(Panda *panda) {

std::unique_ptr<Pigeon> pigeon(Hardware::TICI() ? Pigeon::connect("/dev/ttyHS0") : Pigeon::connect(panda));

std::unordered_map<char, uint64_t> last_recv_time;
std::unordered_map<char, int64_t> cls_max_dt = {
{(char)ublox::CLASS_NAV, int64_t(900000000ULL)}, // 0.9s
{(char)ublox::CLASS_RXM, int64_t(900000000ULL)}, // 0.9s
};

while (!do_exit && panda->connected) {
bool need_reset = false;
bool ignition_local = ignition;
std::string recv = pigeon->receive();

// Parse message header
if (ignition_local && recv.length() >= 3) {
if (recv[0] == (char)ublox::PREAMBLE1 && recv[1] == (char)ublox::PREAMBLE2) {
const char msg_cls = recv[2];
uint64_t t = nanos_since_boot();
if (t > last_recv_time[msg_cls]) {
last_recv_time[msg_cls] = t;
}
}
}

// Check based on message frequency
for (const auto& [msg_cls, max_dt] : cls_max_dt) {
int64_t dt = (int64_t)nanos_since_boot() - (int64_t)last_recv_time[msg_cls];
if (ignition_last && ignition_local && dt > max_dt) {
LOGD("ublox receive timeout, msg class: 0x%02x, dt %llu", msg_cls, dt);
// TODO: turn on reset after verification of logs
// need_reset = true;
}
}

// Check based on null bytes
if (ignition_local && recv.length() > 0 && recv[0] == (char)0x00) {
need_reset = true;
Expand All @@ -599,12 +575,6 @@ void pigeon_thread(Panda *panda) {
if((ignition_local && !ignition_last) || need_reset) {
pigeon_active = true;
pigeon->init();

// Set receive times to current time
uint64_t t = nanos_since_boot() + 10000000000ULL; // Give ublox 10 seconds to start
for (const auto& [msg_cls, dt] : cls_max_dt) {
last_recv_time[msg_cls] = t;
}
} else if (!ignition_local && ignition_last) {
// power off on falling edge of ignition
LOGD("powering off pigeon\n");
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/car_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def fingerprint(logcan, sendcan):
# The fingerprint dict is generated for all buses, this way the car interface
# can use it to detect a (valid) multipanda setup and initialize accordingly
if can.src < 128:
if can.src not in finger.keys():
if can.src not in finger:
finger[can.src] = {}
finger[can.src][can.address] = len(can.dat)

Expand Down
3 changes: 1 addition & 2 deletions selfdrive/car/chrysler/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ def update(self, c, can_strings):
ret.steeringRateLimited = self.CC.steer_rate_limited if self.CC is not None else False

# events
events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low],
gas_resume_speed=2.)
events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low])

if ret.vEgo < self.CP.minSteerSpeed:
events.add(car.CarEvent.EventName.belowSteerSpeed)
Expand Down
2 changes: 0 additions & 2 deletions selfdrive/car/chrysler/values.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
Expand Down
2 changes: 0 additions & 2 deletions selfdrive/car/ford/values.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
Expand Down
2 changes: 0 additions & 2 deletions selfdrive/car/gm/values.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

from cereal import car
from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu
Expand Down
12 changes: 5 additions & 7 deletions selfdrive/car/hyundai/values.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

from cereal import car
from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu
Expand Down Expand Up @@ -672,7 +670,7 @@ class Buttons:
b'\xf1\x00IK MDPS R 1.00 1.07 57700-G9220 4I2VL107',
],
(Ecu.transmission, 0x7e1, None): [
b'\xf1\x87VCJLP18407832DN3\x88vXfvUVT\x97eFU\x87d7v\x88eVeveFU\x89\x98\x7f\xff\xb2\xb0\xf1\x81E25\x00\x00\x00'
b'\xf1\x87VCJLP18407832DN3\x88vXfvUVT\x97eFU\x87d7v\x88eVeveFU\x89\x98\x7f\xff\xb2\xb0\xf1\x81E25\x00\x00\x00',
b'\x00\x00\x00\x00\xf1\x00bcsh8p54 E25\x00\x00\x00\x00\x00\x00\x00SIK0T33NB4\xecE\xefL',
],
(Ecu.fwdRadar, 0x7d0, None): [
Expand Down Expand Up @@ -798,7 +796,7 @@ class Buttons:
b'\xf1\x00DEev SCC F-CUP 1.00 1.03 96400-Q4100 ',
b'\xf1\x8799110Q4000\xf1\x00DEev SCC F-CUP 1.00 1.00 99110-Q4000 ',
b'\xf1\x8799110Q4100\xf1\x00DEev SCC F-CUP 1.00 1.00 99110-Q4100 ',
b'\xf1\x8799110Q4500\xf1\000DEev SCC F-CUP 1.00 1.00 99110-Q4500 ',
b'\xf1\x8799110Q4500\xf1\x00DEev SCC F-CUP 1.00 1.00 99110-Q4500 ',
b'\xf1\x8799110Q4600\xf1\x00DEev SCC FNCUP 1.00 1.00 99110-Q4600 ',
b'\xf1\x8799110Q4600\xf1\x00DEev SCC FHCUP 1.00 1.00 99110-Q4600 ',
],
Expand All @@ -807,7 +805,7 @@ class Buttons:
b'\xf1\x00DE MDPS C 1.00 1.05 56310Q4100\x00 4DEEC105',
],
(Ecu.fwdCamera, 0x7C4, None): [
b'\xf1\000DEE MFC AT EUR LHD 1.00 1.00 99211-Q4100 200706',
b'\xf1\x00DEE MFC AT EUR LHD 1.00 1.00 99211-Q4100 200706',
b'\xf1\x00DEE MFC AT EUR LHD 1.00 1.00 99211-Q4000 191211',
b'\xf1\x00DEE MFC AT USA LHD 1.00 1.00 99211-Q4000 191211',
b'\xf1\x00DEE MFC AT USA LHD 1.00 1.03 95740-Q4000 180821',
Expand Down Expand Up @@ -1015,7 +1013,7 @@ class Buttons:
EV_CAR = {CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.KIA_NIRO_EV}

# these cars require a special panda safety mode due to missing counters and checksums in the messages
LEGACY_SAFETY_MODE_CAR = {CAR.HYUNDAI_GENESIS, CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.IONIQ_PHEV, CAR.IONIQ, CAR.KONA_EV, CAR.KIA_SORENTO, CAR.SONATA_LF, CAR.KIA_NIRO_EV, CAR.KIA_OPTIMA, CAR.VELOSTER, CAR.KIA_STINGER, CAR.GENESIS_G70, CAR.GENESIS_G80, CAR.KIA_CEED, CAR.ELANTRA, CAR.IONIQ_HEV_2022}
LEGACY_SAFETY_MODE_CAR = {CAR.HYUNDAI_GENESIS, CAR.IONIQ_EV_2020, CAR.IONIQ_EV_LTD, CAR.IONIQ_PHEV, CAR.IONIQ, CAR.KONA_EV, CAR.KIA_SORENTO, CAR.SONATA_LF, CAR.KIA_OPTIMA, CAR.VELOSTER, CAR.KIA_STINGER, CAR.GENESIS_G70, CAR.GENESIS_G80, CAR.KIA_CEED, CAR.ELANTRA, CAR.IONIQ_HEV_2022}

# If 0x500 is present on bus 1 it probably has a Mando radar outputting radar points.
# If no points are outputted by default it might be possible to turn it on using selfdrive/debug/hyundai_enable_radar_points.py
Expand All @@ -1036,7 +1034,7 @@ class Buttons:
CAR.IONIQ_HEV_2022: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_FORTE: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_K5_2021: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_NIRO_EV: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_NIRO_EV: dbc_dict('hyundai_kia_generic', 'hyundai_kia_mando_front_radar'),
CAR.KIA_NIRO_HEV: dbc_dict('hyundai_kia_generic', 'hyundai_kia_mando_front_radar'),
CAR.KIA_NIRO_HEV_2021: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_OPTIMA: dbc_dict('hyundai_kia_generic', None),
Expand Down
6 changes: 2 additions & 4 deletions selfdrive/car/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def update(self, c: car.CarControl, can_strings: List[bytes]) -> car.CarState:
def apply(self, c: car.CarControl) -> Tuple[car.CarControl.Actuators, List[bytes]]:
pass

def create_common_events(self, cs_out, extra_gears=None, gas_resume_speed=-1, pcm_enable=True):
def create_common_events(self, cs_out, extra_gears=None, pcm_enable=True):
events = Events()

if cs_out.doorOpen:
Expand Down Expand Up @@ -165,9 +165,7 @@ def create_common_events(self, cs_out, extra_gears=None, gas_resume_speed=-1, pc
events.add(EventName.steerUnavailable)

# Disable on rising edge of gas or brake. Also disable on brake when speed > 0.
# Optionally allow to press gas at zero speed to resume.
# e.g. Chrysler does not spam the resume button yet, so resuming with gas is handy. FIXME!
if (self.disengage_on_gas and cs_out.gasPressed and (not self.CS.out.gasPressed) and cs_out.vEgo > gas_resume_speed) or \
if (cs_out.gasPressed and not self.CS.out.gasPressed) or \
(cs_out.brakePressed and (not self.CS.out.brakePressed or not cs_out.standstill)):
events.add(EventName.pedalPressed)

Expand Down
2 changes: 0 additions & 2 deletions selfdrive/car/mazda/values.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
Expand Down
4 changes: 1 addition & 3 deletions selfdrive/car/nissan/values.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
Expand Down Expand Up @@ -71,7 +69,7 @@ class CAR:
(Ecu.gateway, 0x18dad0f1, None): [
b'284U29HE0A',
],
},
},
CAR.LEAF_IC: {
(Ecu.fwdCamera, 0x707, None): [
b'5SH1BDB\x04\x18\x00\x00\x00\x00\x00_-?\x04\x91\xf2\x00\x00\x00\x80',
Expand Down
Loading

0 comments on commit cb1b6fd

Please sign in to comment.