Skip to content
Permalink
Browse files

openpilot v0.5.11 release

  • Loading branch information...
Vehicle Researcher
Vehicle Researcher committed Apr 23, 2019
1 parent 790732b commit 2f92d577f995ff6ae1945ef6b89df3cb69b92999
Showing with 2,756 additions and 1,619 deletions.
  1. +3 −1 README.md
  2. +15 −3 RELEASES.md
  3. +13 −0 SAFETY.md
  4. BIN apk/ai.comma.plus.offroad.apk
  5. +12 −9 common/dbc.py
  6. +2 −4 common/ffi_wrapper.py
  7. +48 −20 common/transformations/camera.py
  8. +1 −1 common/transformations/model.py
  9. +2 −0 launch_chffrplus.sh
  10. BIN models/monitoring_model.dlc
  11. +2 −1 requirements_openpilot.txt
  12. +2 −2 selfdrive/boardd/boardd.py
  13. +45 −15 selfdrive/can/Makefile
  14. +1 −1 selfdrive/can/packer.py
  15. +5 −5 selfdrive/can/parser.py
  16. +4 −4 selfdrive/can/plant_can_parser.py
  17. +80 −59 selfdrive/can/process_dbc.py
  18. +0 −6 selfdrive/car/chrysler/chryslercan.py
  19. +0 −6 selfdrive/car/chrysler/chryslercan_test.py
  20. +1 −1 selfdrive/car/chrysler/interface.py
  21. +1 −1 selfdrive/car/chrysler/radar_interface.py
  22. +1 −1 selfdrive/car/ford/radar_interface.py
  23. +1 −1 selfdrive/car/gm/radar_interface.py
  24. +1 −1 selfdrive/car/honda/carcontroller.py
  25. +2 −2 selfdrive/car/honda/interface.py
  26. +1 −1 selfdrive/car/honda/radar_interface.py
  27. +3 −2 selfdrive/car/honda/values.py
  28. +2 −2 selfdrive/car/hyundai/interface.py
  29. +1 −1 selfdrive/car/hyundai/radar_interface.py
  30. +1 −2 selfdrive/car/mock/radar_interface.py
  31. +76 −0 selfdrive/car/subaru/carcontroller.py
  32. +47 −4 selfdrive/car/subaru/carstate.py
  33. +29 −13 selfdrive/car/subaru/interface.py
  34. +1 −1 selfdrive/car/subaru/radar_interface.py
  35. +54 −0 selfdrive/car/subaru/subarucan.py
  36. +2 −2 selfdrive/car/toyota/carcontroller.py
  37. +7 −3 selfdrive/car/toyota/values.py
  38. +28 −0 selfdrive/common/touch.c
  39. +1 −0 selfdrive/common/touch.h
  40. +1 −1 selfdrive/common/version.h
  41. +13 −5 selfdrive/common/visionimg.cc
  42. +3 −2 selfdrive/common/visionimg.h
  43. +4 −7 selfdrive/controls/controlsd.py
  44. +45 −23 selfdrive/controls/lib/driver_monitor.py
  45. +4 −4 selfdrive/controls/lib/pathplanner.py
  46. +1 −1 selfdrive/debug/can_printer.py
  47. +99 −0 selfdrive/debug/cpu_usage_stat.py
  48. +7 −7 selfdrive/debug/dump.py
  49. +2 −2 selfdrive/debug/get_fingerprint.py
  50. +1 −1 selfdrive/debug/getframes/getframes.py
  51. +86 −0 selfdrive/locationd/Makefile
  52. +8 −1 selfdrive/locationd/calibrationd.py
  53. +2 −2 selfdrive/locationd/kalman/ekf_sym.py
  54. +13 −12 selfdrive/locationd/locationd_local.py
  55. 0 selfdrive/locationd/test/__init__.py
  56. +82 −0 selfdrive/locationd/test/ci_test.py
  57. 0 selfdrive/locationd/{ → test}/ephemeris.py
  58. 0 selfdrive/locationd/{ → test}/ublox.py
  59. 0 selfdrive/locationd/{ → test}/ubloxd.py
  60. +55 −0 selfdrive/locationd/test/ubloxd_easy.py
  61. +77 −0 selfdrive/locationd/test/ubloxd_py_test.py
  62. +96 −0 selfdrive/locationd/test/ubloxd_regression_test.py
  63. +375 −0 selfdrive/locationd/ublox_msg.cc
  64. +149 −0 selfdrive/locationd/ublox_msg.h
  65. +45 −0 selfdrive/locationd/ubloxd.cc
  66. +113 −0 selfdrive/locationd/ubloxd_main.cc
  67. +103 −0 selfdrive/locationd/ubloxd_test.cc
  68. BIN selfdrive/loggerd/loggerd
  69. +1 −1 selfdrive/manager.py
  70. +1 −1 selfdrive/mapd/mapd.py
  71. +0 −8 selfdrive/orbd/.gitignore
  72. +0 −105 selfdrive/orbd/Makefile
  73. +0 −119 selfdrive/orbd/dsp/freethedsp.c
  74. +0 −39 selfdrive/orbd/dsp/gen/calculator.h
  75. +0 −613 selfdrive/orbd/dsp/gen/calculator_stub.c
  76. BIN selfdrive/orbd/dsp/gen/libcalculator_skel.so
  77. +0 −38 selfdrive/orbd/extractor.h
  78. +0 −191 selfdrive/orbd/orbd.cc
  79. +0 −13 selfdrive/orbd/orbd_wrapper.sh
  80. BIN selfdrive/sensord/gpsd
  81. BIN selfdrive/sensord/sensord
  82. +1 −1 selfdrive/swaglog.py
  83. +8 −8 selfdrive/test/plant/maneuver.py
  84. +1 −1 selfdrive/test/plant/plant.py
  85. +3 −3 selfdrive/test/plant/plant_ui.py
  86. +9 −9 selfdrive/test/test_fingerprints.py
  87. +5 −5 selfdrive/test/test_openpilot.py
  88. +5 −5 selfdrive/thermald.py
  89. +51 −15 selfdrive/tombstoned.py
  90. +2 −2 selfdrive/ui/Makefile
  91. +348 −175 selfdrive/ui/ui.c
  92. +14 −2 selfdrive/visiond/build_from_src.mk
  93. +1 −1 selfdrive/visiond/monitoring.cc
  94. +2 −2 selfdrive/visiond/monitoring.h
  95. +53 −0 selfdrive/visiond/rgb_to_yuv.c
  96. +127 −0 selfdrive/visiond/rgb_to_yuv.cl
  97. +32 −0 selfdrive/visiond/rgb_to_yuv.h
  98. +201 −0 selfdrive/visiond/rgb_to_yuv_test.cc
  99. +12 −19 selfdrive/visiond/visiond.cc
@@ -79,6 +79,7 @@ Supported Cars
| Honda | CR-V 2017-18 | Honda Sensing | Yes | Stock | 0mph | 12mph | Bosch |
| Honda | CR-V Hybrid 2019 | All | Yes | Stock | 0mph | 12mph | Bosch |
| Honda | Odyssey 2017-19 | Honda Sensing | Yes | Yes | 25mph<sup>1</sup>| 0mph | Inverted Nidec |
| Honda | Passport 2019 | All | Yes | Yes | 25mph<sup>1</sup>| 12mph | Inverted Nidec |
| Honda | Pilot 2016-18 | Honda Sensing | Yes | Yes | 25mph<sup>1</sup>| 12mph | Nidec |
| Honda | Pilot 2019 | All | Yes | Yes | 25mph<sup>1</sup>| 12mph | Inverted Nidec |
| Honda | Ridgeline 2017-19 | Honda Sensing | Yes | Yes | 25mph<sup>1</sup>| 12mph | Nidec |
@@ -90,7 +91,8 @@ Supported Cars
| Kia | Optima 2019 | SCC + LKAS | Yes | Stock | 0mph | 0mph | Custom<sup>6</sup>|
| Kia | Sorento 2018 | All | Yes | Stock | 0mph | 0mph | Custom<sup>6</sup>|
| Kia | Stinger 2018 | SCC + LKAS | Yes | Stock | 0mph | 0mph | Custom<sup>6</sup>|
| Lexus | RX Hybrid 2016-18 | All | Yes | Yes<sup>2</sup>| 0mph | 0mph | Toyota |
| Lexus | RX Hybrid 2016-19 | All | Yes | Yes<sup>2</sup>| 0mph | 0mph | Toyota |
| Subaru | Impreza 2019 | EyeSight | Yes | Stock | 0mph | 0mph | Subaru |
| Toyota | Camry 2018<sup>4</sup> | All | Yes | Stock | 0mph<sup>5</sup> | 0mph | Toyota |
| Toyota | C-HR 2017-18<sup>4</sup> | All | Yes | Stock | 0mph | 0mph | Toyota |
| Toyota | Corolla 2017-18 | All | Yes | Yes<sup>2</sup>| 20mph<sup>1</sup>| 0mph | Toyota |
@@ -1,13 +1,25 @@
Version 0.5.11 (2019-04-17)
========================
* Add support for Subaru
* Reduce panda power consumption by 60% when car is off
* Fix controlsd lag every 6 minutes. This would sometimes cause disengagements
* Fix bug in controls with new angle-offset learner in MPC
* Reduce cpu consumption of ubloxd by rewriting it in C++
* Improve driver monitoring model and face detection
* Improve performance of visiond and ui
* Honda Passport 2019 support
* Lexus RX Hybrid 2019 support thanks to schomems!

Version 0.5.10 (2019-03-19)
========================
* Self-tuning vehicle parameters: steering offset, tires stiffness and steering ratio
* Self-tuning vehicle parameters: steering offset, tire stiffness and steering ratio
* Improve longitudinal control at low speed when lead vehicle harshly decelerates
* Fix panda bug going unexpectedly in DCP mode when EON is connected
* Reduce white panda power consumption by 500mW when EON is disconnected by turning off WIFI
* New Driver Monitoring Model
* Support QR codes for login using comma connect
* Refactor comma pedal FW and use CRC-8 checksum algorithm for safety. Reflashing pedal is required.
Please see `#hw-pedal` on [discord](discord.comma.ai) for assistance updating comma pedal.
* Refactor comma pedal FW and use CRC-8 checksum algorithm for safety. Reflashing pedal is required.
Please see `#hw-pedal` on [discord](discord.comma.ai) for assistance updating comma pedal.
* Additional speed limit rules for Germany thanks to arne182
* Allow negative speed limit offsets

@@ -133,6 +133,19 @@ Chrysler/Jeep/Fiat (Lateral only)
units above the actual EPS generated motor torque to ensure limited differences between
commanded and actual torques.

Subaru (Lateral only)
------

- While the system is engaged, steer commands are subject to the same limits used by
the stock system.

- Steering torque is controlled through the 0x122 CAN message and it's limited by the panda firmware and by
openpilot to a value between -255 and 255. In addition, the vehicle EPS unit will fault for
commands outside the values of -2047 and 2047. A steering torque rate limit is enforced by the panda firmware and by
openpilot, so that the commanded steering torque must rise from 0 to max value no faster than
0.41s. Commanded steering torque is gradually limited by the panda firmware and by openpilot if the driver's
torque exceeds 60 units in the opposite dicrection to ensure limited applied torque against the
driver's will.

**Extra note**: comma.ai strongly discourages the use of openpilot forks with safety code either missing or
not fully meeting the above requirements.
BIN -8 Bytes (100%) apk/ai.comma.plus.offroad.apk
Binary file not shown.
@@ -7,9 +7,9 @@

def int_or_float(s):
# return number, trying to maintain int format
try:
return int(s)
except ValueError:
if s.isdigit():
return int(s, 10)
else:
return float(s)

DBCSignal = namedtuple(
@@ -21,7 +21,7 @@ class dbc(object):
def __init__(self, fn):
self.name, _ = os.path.splitext(os.path.basename(fn))
with open(fn) as f:
self.txt = f.read().split("\n")
self.txt = f.readlines()
self._warned_addresses = set()

# regexps from https://github.com/ebroecker/canmatrix/blob/master/canmatrix/importdbc.py
@@ -51,7 +51,8 @@ def __init__(self, fn):
dat = bo_regexp.match(l)

if dat is None:
print "bad BO", l
print("bad BO {0}".format(l))

name = dat.group(2)
size = int(dat.group(3))
ids = int(dat.group(1), 0) # could be hex
@@ -67,8 +68,9 @@ def __init__(self, fn):
if dat is None:
dat = sgm_regexp.match(l)
go = 1

if dat is None:
print "bad SG", l
print("bad SG {0}".format(l))

sgname = dat.group(1)
start_bit = int(dat.group(go+2))
@@ -90,7 +92,8 @@ def __init__(self, fn):
dat = val_regexp.match(l)

if dat is None:
print "bad VAL", l
print("bad VAL {0}".format(l))

ids = int(dat.group(1), 0) # could be hex
sgname = dat.group(2)
defvals = dat.group(3)
@@ -208,7 +211,7 @@ def decode(self, x, arr=None, debug=False):

name = msg[0][0]
if debug:
print name
print(name)

st = x[2].ljust(8, '\x00')
le, be = None, None
@@ -252,7 +255,7 @@ def decode(self, x, arr=None, debug=False):
tmp = tmp * factor + offset

# if debug:
# print "%40s %2d %2d %7.2f %s" % (s[0], s[1], s[2], tmp, s[-1])
# print("%40s %2d %2d %7.2f %s" % (s[0], s[1], s[2], tmp, s[-1]))

if arr is None:
out[s[0]] = tmp
@@ -4,10 +4,8 @@
import hashlib
from cffi import FFI

TMPDIR = "/tmp/ccache"


def ffi_wrap(name, c_code, c_header, tmpdir=TMPDIR, cflags="", libraries=None):
def ffi_wrap(name, c_code, c_header, tmpdir="/tmp/ccache", cflags="", libraries=None):
if libraries is None:
libraries = []

@@ -24,7 +22,7 @@ def ffi_wrap(name, c_code, c_header, tmpdir=TMPDIR, cflags="", libraries=None):
try:
mod = __import__(cache)
except Exception:
print "cache miss", cache
print("cache miss {0}".format(cache))
compile_code(cache, c_code, c_header, tmpdir, cflags, libraries)
mod = __import__(cache)
finally:
@@ -1,6 +1,7 @@
import numpy as np
import common.transformations.orientation as orient
import cv2
import math

FULL_FRAME_SIZE = (1164, 874)
W, H = FULL_FRAME_SIZE[0], FULL_FRAME_SIZE[1]
@@ -12,6 +13,17 @@
[ 0., FOCAL, H/2.],
[ 0., 0., 1.]])


leon_dcam_intrinsics = np.array([
[650, 0, 816/2],
[ 0, 650, 612/2],
[ 0, 0, 1]])

eon_dcam_intrinsics = np.array([
[860, 0, 1152/2],
[ 0, 860, 864/2],
[ 0, 0, 1]])

# aka 'K_inv' aka view_frame_from_camera_frame
eon_intrinsics_inv = np.linalg.inv(eon_intrinsics)

@@ -147,28 +159,44 @@ def transform_img(base_img,
from_intr=eon_intrinsics,
to_intr=eon_intrinsics,
calib_rot_view=None,
output_size=None):
cy = from_intr[1,2]
output_size=None,
pretransform=None,
top_hacks=True):
size = base_img.shape[:2]
if not output_size:
output_size = size[::-1]
h = 1.22
quadrangle = np.array([[0, cy + 20],
[size[1]-1, cy + 20],
[0, size[0]-1],
[size[1]-1, size[0]-1]], dtype=np.float32)
quadrangle_norm = np.hstack((normalize(quadrangle, intrinsics=from_intr), np.ones((4,1))))
quadrangle_world = np.column_stack((h*quadrangle_norm[:,0]/quadrangle_norm[:,1],
h*np.ones(4),
h/quadrangle_norm[:,1]))
rot = orient.rot_from_euler(augment_eulers)
if calib_rot_view is not None:
rot = calib_rot_view.dot(rot)
to_extrinsics = np.hstack((rot.T, -augment_trans[:,None]))
to_KE = to_intr.dot(to_extrinsics)
warped_quadrangle_full = np.einsum('jk,ik->ij', to_KE, np.hstack((quadrangle_world, np.ones((4,1)))))
warped_quadrangle = np.column_stack((warped_quadrangle_full[:,0]/warped_quadrangle_full[:,2],
warped_quadrangle_full[:,1]/warped_quadrangle_full[:,2])).astype(np.float32)
M = cv2.getPerspectiveTransform(quadrangle, warped_quadrangle.astype(np.float32))

cy = from_intr[1,2]
def get_M(h=1.22):
quadrangle = np.array([[0, cy + 20],
[size[1]-1, cy + 20],
[0, size[0]-1],
[size[1]-1, size[0]-1]], dtype=np.float32)
quadrangle_norm = np.hstack((normalize(quadrangle, intrinsics=from_intr), np.ones((4,1))))
quadrangle_world = np.column_stack((h*quadrangle_norm[:,0]/quadrangle_norm[:,1],
h*np.ones(4),
h/quadrangle_norm[:,1]))
rot = orient.rot_from_euler(augment_eulers)
if calib_rot_view is not None:
rot = calib_rot_view.dot(rot)
to_extrinsics = np.hstack((rot.T, -augment_trans[:,None]))
to_KE = to_intr.dot(to_extrinsics)
warped_quadrangle_full = np.einsum('jk,ik->ij', to_KE, np.hstack((quadrangle_world, np.ones((4,1)))))
warped_quadrangle = np.column_stack((warped_quadrangle_full[:,0]/warped_quadrangle_full[:,2],
warped_quadrangle_full[:,1]/warped_quadrangle_full[:,2])).astype(np.float32)
M = cv2.getPerspectiveTransform(quadrangle, warped_quadrangle.astype(np.float32))
return M

M = get_M()
if pretransform is not None:
M = M.dot(pretransform)
augmented_rgb = cv2.warpPerspective(base_img, M, output_size, borderMode=cv2.BORDER_REPLICATE)

if top_hacks:
cyy = int(math.ceil(to_intr[1,2]))
M = get_M(1000)
if pretransform is not None:
M = M.dot(pretransform)
augmented_rgb[:cyy] = cv2.warpPerspective(base_img, M, (output_size[0], cyy), borderMode=cv2.BORDER_REPLICATE)

return augmented_rgb
@@ -32,7 +32,7 @@


# MED model
MEDMODEL_INPUT_SIZE = (640, 240)
MEDMODEL_INPUT_SIZE = (512, 256)
MEDMODEL_YUV_SIZE = (MEDMODEL_INPUT_SIZE[0], MEDMODEL_INPUT_SIZE[1] * 3 // 2)
MEDMODEL_CY = 47.6

@@ -19,6 +19,8 @@ function launch {
echo 0-3 > /dev/cpuset/foreground/cpus
echo 0-3 > /dev/cpuset/android/cpus

# handle pythonpath
ln -s /data/openpilot /data/pythonpath
export PYTHONPATH="$PWD"

# start manager
BIN +260 Bytes (100%) models/monitoring_model.dlc
Binary file not shown.
@@ -23,7 +23,7 @@ enum34==1.1.6
evdev==0.6.1
fastcluster==1.1.20
filterpy==1.2.4
hexdump
hexdump==3.3
ipaddress==1.0.16
json-rpc==1.12.1
libusb1==1.5.0
@@ -33,6 +33,7 @@ nose==1.3.7
numpy==1.11.1
opencv-python==3.4.0.12
pause==0.1.2
psutil==3.4.2
py==1.4.31
pyOpenSSL==16.0.0
pyasn1-modules==0.0.8
@@ -220,7 +220,7 @@ def boardd_proxy_loop(rate=200, address="192.168.2.251"):
# recv @ 100hz
can_msgs = can_recv()
#for m in can_msgs:
# print "R:",hex(m[0]), str(m[2]).encode("hex")
# print("R: {0} {1}".format(hex(m[0]), str(m[2]).encode("hex")))

# publish to logger
# TODO: refactor for speed
@@ -233,7 +233,7 @@ def boardd_proxy_loop(rate=200, address="192.168.2.251"):
if tsc is not None:
cl = can_capnp_to_can_list(tsc.can)
#for m in cl:
# print "S:",hex(m[0]), str(m[2]).encode("hex")
# print("S: {0} {1}".format(hex(m[0]), str(m[2]).encode("hex")))
can_send_many(cl)

rk.keep_time()
@@ -16,6 +16,7 @@ WARN_FLAGS = -Werror=implicit-function-declaration \

CFLAGS = -std=gnu11 -g -fPIC -O2 $(WARN_FLAGS)
CXXFLAGS = -std=c++11 -g -fPIC -O2 $(WARN_FLAGS)
LDFLAGS =

ifeq ($(UNAME_S),Darwin)
ZMQ_LIBS = -L/usr/local/lib -lzmq
@@ -28,18 +29,24 @@ else ifeq ($(UNAME_M),x86_64)
else ifeq ($(UNAME_M),aarch64)
ZMQ_FLAGS = -I$(PHONELIBS)/zmq/aarch64/include
ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib -l:libzmq.a
CXXFLAGS += -lgnustl_shared
LDFLAGS += -lgnustl_shared
endif

OBJDIR = obj

OPENDBC_PATH := $(shell python -c 'import opendbc; print opendbc.DBC_PATH')

DBC_SOURCES := $(wildcard $(OPENDBC_PATH)/*.dbc)
DBC_OBJS := $(patsubst $(OPENDBC_PATH)/%.dbc,$(OBJDIR)/%.o,$(DBC_SOURCES))
DBC_CCS := $(patsubst $(OPENDBC_PATH)/%.dbc,dbc_out/%.cc,$(DBC_SOURCES))
.SECONDARY: $(DBC_CCS)

LIBDBC_OBJS := $(OBJDIR)/dbc.o $(OBJDIR)/parser.o $(OBJDIR)/packer.o

CWD := $(shell pwd)

.PHONY: all
all: libdbc.so
all: $(OBJDIR) libdbc.so

include ../common/cereal.mk

@@ -49,22 +56,45 @@ libdbc.so:: ../../cereal/gen/cpp/log.capnp.h
../../cereal/gen/cpp/log.capnp.h:
cd ../../cereal && make

libdbc.so:: dbc.cc parser.cc packer.cc $(DBC_CCS)
libdbc.so:: $(LIBDBC_OBJS) $(DBC_OBJS)
@echo "[ LINK ] $@"
$(CXX) -fPIC -shared -o '$@' $^ \
-I. \
-I../.. \
$(CXXFLAGS) \
$(ZMQ_FLAGS) \
$(ZMQ_LIBS) \
$(CEREAL_CXXFLAGS) \
$(CEREAL_LIBS)

dbc_out/%.cc: $(OPENDBC_PATH)/%.dbc process_dbc.py dbc_template.cc
PYTHONPATH=$(PYTHONPATH):$(CWD)/../../pyextra ./process_dbc.py '$<' '$@'

.PHONY: clean
-I. -I../.. \
$(CXXFLAGS) \
$(LDFLAGS) \
$(ZMQ_FLAGS) \
$(ZMQ_LIBS) \
$(CEREAL_CXXFLAGS) \
$(CEREAL_LIBS)

$(OBJDIR)/%.o: %.cc
@echo "[ CXX ] $@"
$(CXX) -fPIC -c -o '$@' $^ \
-I. -I../.. \
$(CXXFLAGS) \
$(ZMQ_FLAGS) \
$(CEREAL_CXXFLAGS) \

$(OBJDIR)/%.o: dbc_out/%.cc
@echo "[ CXX ] $@"
$(CXX) -fPIC -c -o '$@' $^ \
-I. -I../.. \
$(CXXFLAGS) \
$(ZMQ_FLAGS) \
$(CEREAL_CXXFLAGS) \

dbc_out/%.cc: process_dbc.py dbc_template.cc $(OPENDBC_PATH)/%.dbc
@echo "[ DBC GEN ] $@"
@echo "Missing prereq $?"
PYTHONPATH=$(PYTHONPATH):$(CWD)/../../pyextra ./process_dbc.py $(OPENDBC_PATH) dbc_out

$(OBJDIR):
mkdir -p $@

.PHONY: clean $(OBJDIR)
clean:
rm -rf libdbc.so*
rm -f dbc_out/*.cc
rm -f dbcs.txt
rm -f dbcs.csv
rm -rf $(OBJDIR)/*
Oops, something went wrong.

0 comments on commit 2f92d57

Please sign in to comment.
You can’t perform that action at this time.