Skip to content
Permalink
Browse files

openpilot v0.5.10 release

  • Loading branch information...
Vehicle Researcher
Vehicle Researcher committed Mar 26, 2019
1 parent be5c2ae commit f74a201edcce4a81ae9e1ba388039a982a68f2fa
Showing with 6,419 additions and 5,458 deletions.
  1. +2 −1 .gitignore
  2. +3 −1 .travis.yml
  3. +2 −3 README.md
  4. +13 −1 RELEASES.md
  5. +31 −2 SAFETY.md
  6. BIN apk/ai.comma.plus.offroad.apk
  7. +2 −0 cereal/car.capnp
  8. +12 −2 cereal/log.capnp
  9. +11 −2 common/ffi_wrapper.py
  10. +22 −26 common/params.py
  11. +81 −0 common/sympy_helpers.py
  12. +34 −0 common/transformations/camera.py
  13. +29 −0 common/transformations/model.py
  14. BIN models/monitoring_model.dlc
  15. +4 −2 requirements_openpilot.txt
  16. 0 selfdrive/athena/__init__.py
  17. +128 −0 selfdrive/athena/athenad.py
  18. +9 −0 selfdrive/boardd/boardd.cc
  19. +3 −0 selfdrive/can/common.h
  20. +4 −0 selfdrive/can/dbc_template.cc
  21. +2 −0 selfdrive/can/libdbc_py.py
  22. +36 −5 selfdrive/can/parser.cc
  23. +5 −1 selfdrive/can/parser.py
  24. +5 −1 selfdrive/can/process_dbc.py
  25. +36 −0 selfdrive/car/__init__.py
  26. +6 −6 selfdrive/car/chrysler/carstate.py
  27. +0 −1 selfdrive/car/chrysler/chryslercan_test.py
  28. +1 −1 selfdrive/car/chrysler/values.py
  29. +6 −6 selfdrive/car/ford/carstate.py
  30. +6 −3 selfdrive/car/gm/carstate.py
  31. +3 −2 selfdrive/car/honda/carcontroller.py
  32. +4 −4 selfdrive/car/honda/carstate.py
  33. +0 −12 selfdrive/car/honda/hondacan.py
  34. +7 −7 selfdrive/car/hyundai/carstate.py
  35. +0 −4 selfdrive/car/hyundai/interface.py
  36. +1 −0 selfdrive/car/subaru/__init__.py
  37. +104 −0 selfdrive/car/subaru/carstate.py
  38. +205 −0 selfdrive/car/subaru/interface.py
  39. +24 −0 selfdrive/car/subaru/radar_interface.py
  40. +18 −0 selfdrive/car/subaru/values.py
  41. +4 −3 selfdrive/car/toyota/carcontroller.py
  42. +7 −7 selfdrive/car/toyota/carstate.py
  43. +0 −12 selfdrive/car/toyota/toyotacan.py
  44. +6 −13 selfdrive/car/toyota/values.py
  45. +1 −1 selfdrive/common/version.h
  46. +19 −14 selfdrive/controls/controlsd.py
  47. +7 −0 selfdrive/controls/lib/alerts.py
  48. +4 −4 selfdrive/controls/lib/drive_helpers.py
  49. +71 −0 selfdrive/controls/lib/fcw.py
  50. +2 −0 selfdrive/controls/lib/latcontrol.py
  51. +3 −1 selfdrive/controls/lib/lateral_mpc/lateral_mpc.c
  52. BIN selfdrive/controls/lib/lateral_mpc/lateral_mpc.o
  53. BIN selfdrive/controls/lib/lateral_mpc/libmpc.so
  54. +1 −0 selfdrive/controls/lib/lateral_mpc/libmpc_py.py
  55. +120 −0 selfdrive/controls/lib/long_mpc.py
  56. +3 −12 selfdrive/controls/lib/longitudinal_mpc/generator.cpp
  57. BIN selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_auxiliary_functions.o
  58. +64 −67 selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_common.h
  59. +71 −314 selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.c
  60. BIN selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_integrator.o
  61. +1 −1 selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.cpp
  62. +1 −1 selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.hpp
  63. BIN selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.o
  64. +3,558 −4,148 selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.c
  65. BIN selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_solver.o
  66. BIN selfdrive/controls/lib/longitudinal_mpc/lib_qp/Bounds.o
  67. BIN selfdrive/controls/lib/longitudinal_mpc/lib_qp/Constraints.o
  68. BIN selfdrive/controls/lib/longitudinal_mpc/lib_qp/CyclingManager.o
  69. BIN selfdrive/controls/lib/longitudinal_mpc/lib_qp/EXTRAS/SolutionAnalysis.o
  70. BIN selfdrive/controls/lib/longitudinal_mpc/lib_qp/Indexlist.o
  71. BIN selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblem.o
  72. BIN selfdrive/controls/lib/longitudinal_mpc/lib_qp/QProblemB.o
  73. BIN selfdrive/controls/lib/longitudinal_mpc/lib_qp/SubjectTo.o
  74. BIN selfdrive/controls/lib/longitudinal_mpc/libmpc1.so
  75. +1 −0 selfdrive/controls/lib/longitudinal_mpc/libmpc_py.py
  76. +43 −29 selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.c
  77. BIN selfdrive/controls/lib/longitudinal_mpc/longitudinal_mpc.o
  78. +15 −6 selfdrive/controls/lib/pathplanner.py
  79. +33 −223 selfdrive/controls/lib/planner.py
  80. +10 −3 selfdrive/controls/lib/vehicle_model.py
  81. +10 −1 selfdrive/controls/plannerd.py
  82. +20 −6 selfdrive/controls/radard.py
  83. +23 −0 selfdrive/crash.py
  84. 0 selfdrive/locationd/kalman/__init__.py
  85. +124 −0 selfdrive/locationd/kalman/ekf_c.c
  86. +564 −0 selfdrive/locationd/kalman/ekf_sym.py
  87. +165 −0 selfdrive/locationd/kalman/kalman_helpers.py
  88. +128 −0 selfdrive/locationd/kalman/loc_local_kf.py
  89. +80 −0 selfdrive/locationd/kalman/loc_local_model.py
  90. +274 −0 selfdrive/locationd/locationd_local.py
  91. +6 −3 selfdrive/locationd/ublox.py
  92. BIN selfdrive/loggerd/loggerd
  93. +4 −0 selfdrive/manager.py
  94. +1 −0 selfdrive/mapd/default_speeds.json
  95. +0 −454 selfdrive/mapd/default_speeds_by_region.json
  96. +12 −6 selfdrive/mapd/default_speeds_generator.py
  97. +6 −27 selfdrive/mapd/mapd.py
  98. BIN selfdrive/sensord/gpsd
  99. BIN selfdrive/sensord/sensord
  100. +8 −0 selfdrive/test/plant/plant.py
  101. +68 −0 selfdrive/test/test_fingerprints.py
  102. +22 −9 selfdrive/test/tests/plant/test_longitudinal.py
@@ -25,11 +25,12 @@ clcache

board/obj/
selfdrive/boardd/boardd
selfdrive/visiond/visiond
selfdrive/logcatd/logcatd
selfdrive/mapd/default_speeds_by_region.json
selfdrive/proclogd/proclogd
selfdrive/ui/ui
selfdrive/test/tests/plant/out
selfdrive/visiond/visiond
/src/

one
@@ -7,6 +7,8 @@ install:
- docker build -t tmppilot -f Dockerfile.openpilot .

script:
- docker run --rm
- docker run
-v "$(pwd)"/selfdrive/test/tests/plant/out:/tmp/openpilot/selfdrive/test/tests/plant/out
tmppilot /bin/sh -c 'cd /tmp/openpilot/selfdrive/test/tests/plant && OPTEST=1 ./test_longitudinal.py'
- docker run
tmppilot /bin/sh -c 'cd /tmp/openpilot/selfdrive/test/ && ./test_fingerprints.py'
@@ -114,12 +114,11 @@ Community Maintained Cars
| Make | Model | Supported Package | Lateral | Longitudinal | No Accel Below | No Steer Below | Giraffe |
| ---------------------| -------------------------| ---------------------| --------| ---------------| -----------------| ---------------|-------------------|
| Honda | Fit 2018 | Honda Sensing | Yes | Yes | 25mph<sup>1</sup>| 12mph | Inverted Nidec |
| Tesla | Model S 2012 | All | Yes | Not yet | Not applicable | 0mph | Custom<sup>9</sup>|
| Tesla | Model S 2013 | All | Yes | Not yet | Not applicable | 0mph | Custom<sup>9</sup>|
| Tesla | Model S 2012-13 | All | Yes | Not yet | Not applicable | 0mph | Custom<sup>8</sup>|

[[Honda Fit Pull Request]](https://github.com/commaai/openpilot/pull/266). <br />
[[Tesla Model S Pull Request]](https://github.com/commaai/openpilot/pull/246) <br />
<sup>9</sup>Community built Giraffe, find more information here [Community Tesla Giraffe](https://github.com/jeankalud/neo/tree/tesla_giraffe/giraffe/tesla) <br />
<sup>8</sup>Community built Giraffe, find more information here [Community Tesla Giraffe](https://github.com/jeankalud/neo/tree/tesla_giraffe/giraffe/tesla) <br />

Community Maintained Cars are not confirmed by comma.ai to meet our [safety model](https://github.com/commaai/openpilot/blob/devel/SAFETY.md). Be extra cautious using them.

@@ -1,3 +1,15 @@
Version 0.5.10 (2019-03-19)
========================
* Self-tuning vehicle parameters: steering offset, tires 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.
* Additional speed limit rules for Germany thanks to arne182

Version 0.5.9 (2019-02-10)
========================
* Improve calibration using a dedicated neural network
@@ -8,7 +20,7 @@ Version 0.5.9 (2019-02-10)
* Kia Optima support thanks to emmertex!
* Buick Regal 2018 support thanks to HOYS!
* Comma pedal support for Toyota thanks to wocsor! Note: tuning needed and not maintained by comma
* Chrysler Pacifica and Jeep Grand Cherokee suppor thanks to adhintz!
* Chrysler Pacifica and Jeep Grand Cherokee support thanks to adhintz!

Version 0.5.8 (2019-01-17)
========================
@@ -89,7 +89,7 @@ GM/Chevrolet
and openpilot to 350. This is approximately 0.3g of braking.

- Steering torque is controlled through the 0x180 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 not fault when
openpilot to a value between -300 and 300. In addition, the vehicle EPS unit will fault for
commands outside these limits. 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.75s. Commanded steering torque is gradually limited by the panda firmware and by openpilot if the driver's
@@ -105,5 +105,34 @@ GM/Chevrolet
- GM CAN uses both a counter and a checksum to ensure integrity and prevent
replay of the same message.

**Extra note"**: comma.ai strongly discourages the use of openpilot forks with safety code either missing or
Hyundai/Kia (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 0x340 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 -409 and 409. 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.85s. Commanded steering torque is gradually limited by the panda firmware and by openpilot if the driver's
torque exceeds 50 units in the opposite dicrection to ensure limited applied torque against the
driver's will.

Chrysler/Jeep/Fiat (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 0x292 CAN message and it's limited by the panda firmware and by
openpilot to a value between -261 and 261. In addition, the vehicle EPS unit will fault for
commands outside these limits. 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.87s. Commanded steering torque is limited by the panda firmware and by openpilot to be no more than 80
units above the actual EPS generated motor torque to ensure limited differences between
commanded and actual torques.


**Extra note**: comma.ai strongly discourages the use of openpilot forks with safety code either missing or
not fully meeting the above requirements.
BIN -11.3 KB (100%) apk/ai.comma.plus.offroad.apk
Binary file not shown.
@@ -72,6 +72,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
calibrationProgress @47;
lowBattery @48;
invalidGiraffeHonda @49;
vehicleModelInvalid @50;
}
}

@@ -317,6 +318,7 @@ struct CarParams {
hyundai @8;
chrysler @9;
tesla @10;
subaru @11;
}

# things about the car in the manual
@@ -419,7 +419,7 @@ struct Live100Data {
alertType @44 :Text;
alertSound @45 :Text;
awarenessStatus @26 :Float32;
angleOffset @27 :Float32;
angleModelBias @27 :Float32;
gpsPlannerActive @40 :Bool;
engageable @41 :Bool; # can OP be engaged?
driverMonitoringOn @43 :Bool;
@@ -582,6 +582,9 @@ struct Plan {
vCurvature @21 :Float32;
decelForTurn @22 :Bool;
mapValid @25 :Bool;
radarValid @28 :Bool;

processingDelay @29 :Float32;


struct GpsTrajectory {
@@ -608,8 +611,12 @@ struct PathPlan {
rPoly @6 :List(Float32);
rProb @7 :Float32;

angleSteers @8 :Float32;
angleSteers @8 :Float32; # deg
rateSteers @13 :Float32; # deg/s
valid @9 :Bool;
paramsValid @10 :Bool;
modelValid @12 :Bool;
angleOffset @11 :Float32;
}

struct LiveLocationData {
@@ -1602,6 +1609,9 @@ struct LiveParametersData {
valid @0 :Bool;
gyroBias @1 :Float32;
angleOffset @2 :Float32;
angleOffsetAverage @3 :Float32;
stiffnessFactor @4 :Float32;
steerRatio @5 :Float32;
}

struct LiveMapData {
@@ -6,7 +6,11 @@

TMPDIR = "/tmp/ccache"

def ffi_wrap(name, c_code, c_header, tmpdir=TMPDIR, cflags="", libraries=[]):

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

cache = name + "_" + hashlib.sha1(c_code).hexdigest()
try:
os.mkdir(tmpdir)
@@ -28,14 +32,19 @@ def ffi_wrap(name, c_code, c_header, tmpdir=TMPDIR, cflags="", libraries=[]):

return mod.ffi, mod.lib

def compile_code(name, c_code, c_header, directory, cflags="", libraries=[]):

def compile_code(name, c_code, c_header, directory, cflags="", libraries=None):
if libraries is None:
libraries = []

ffibuilder = FFI()
ffibuilder.set_source(name, c_code, source_extension='.cpp', libraries=libraries)
ffibuilder.cdef(c_header)
os.environ['OPT'] = "-fwrapv -O2 -DNDEBUG -std=c++11"
os.environ['CFLAGS'] = cflags
ffibuilder.compile(verbose=True, debug=False, tmpdir=directory)


def wrap_compiled(name, directory):
sys.path.append(directory)
mod = __import__(name)
@@ -29,59 +29,55 @@
import tempfile
from enum import Enum


def mkdirs_exists_ok(path):
try:
os.makedirs(path)
except OSError:
if not os.path.isdir(path):
raise


class TxType(Enum):
PERSISTENT = 1
CLEAR_ON_MANAGER_START = 2
CLEAR_ON_CAR_START = 3


class UnknownKeyName(Exception):
pass


keys = {
# written: manager
# read: loggerd, uploaderd, offroad
"DongleId": TxType.PERSISTENT,
"AccessToken": TxType.PERSISTENT,
"Version": TxType.PERSISTENT,
"TrainingVersion": TxType.PERSISTENT,
"GitCommit": TxType.PERSISTENT,
"CalibrationParams": TxType.PERSISTENT,
"CarParams": TxType.CLEAR_ON_CAR_START,
"CompletedTrainingVersion": TxType.PERSISTENT,
"ControlsParams": TxType.PERSISTENT,
"DoUninstall": TxType.CLEAR_ON_MANAGER_START,
"DongleId": TxType.PERSISTENT,
"GitBranch": TxType.PERSISTENT,
"GitCommit": TxType.PERSISTENT,
"GitRemote": TxType.PERSISTENT,
# written: baseui
# read: ui, controls
"IsMetric": TxType.PERSISTENT,
"IsFcwEnabled": TxType.PERSISTENT,
"HasAcceptedTerms": TxType.PERSISTENT,
"CompletedTrainingVersion": TxType.PERSISTENT,
"IsUploadVideoOverCellularEnabled": TxType.PERSISTENT,
"IsDriverMonitoringEnabled": TxType.PERSISTENT,
"IsFcwEnabled": TxType.PERSISTENT,
"IsGeofenceEnabled": TxType.PERSISTENT,
"SpeedLimitOffset": TxType.PERSISTENT,
# written: visiond
# read: visiond, controlsd
"CalibrationParams": TxType.PERSISTENT,
"ControlsParams": TxType.PERSISTENT,
# written: controlsd
# read: radard
"CarParams": TxType.CLEAR_ON_CAR_START,

"Passive": TxType.PERSISTENT,
"DoUninstall": TxType.CLEAR_ON_MANAGER_START,
"ShouldDoUpdate": TxType.CLEAR_ON_MANAGER_START,
"IsMetric": TxType.PERSISTENT,
"IsUpdateAvailable": TxType.PERSISTENT,
"LongitudinalControl": TxType.PERSISTENT,
"IsUploadVideoOverCellularEnabled": TxType.PERSISTENT,
"LimitSetSpeed": TxType.PERSISTENT,

"LiveParameters": TxType.PERSISTENT,
"LongitudinalControl": TxType.PERSISTENT,
"Passive": TxType.PERSISTENT,
"RecordFront": TxType.PERSISTENT,
"ShouldDoUpdate": TxType.CLEAR_ON_MANAGER_START,
"SpeedLimitOffset": TxType.PERSISTENT,
"TrainingVersion": TxType.PERSISTENT,
"Version": TxType.PERSISTENT,
}


def fsync_dir(path):
fd = os.open(path, os.O_RDONLY)
try:
@@ -0,0 +1,81 @@
#!/usr/bin/env python
import sympy as sp
import numpy as np

def cross(x):
ret = sp.Matrix(np.zeros((3,3)))
ret[0,1], ret[0,2] = -x[2], x[1]
ret[1,0], ret[1,2] = x[2], -x[0]
ret[2,0], ret[2,1] = -x[1], x[0]
return ret

def euler_rotate(roll, pitch, yaw):
# make symbolic rotation matrix from eulers
matrix_roll = sp.Matrix([[1, 0, 0],
[0, sp.cos(roll), -sp.sin(roll)],
[0, sp.sin(roll), sp.cos(roll)]])
matrix_pitch = sp.Matrix([[sp.cos(pitch), 0, sp.sin(pitch)],
[0, 1, 0],
[-sp.sin(pitch), 0, sp.cos(pitch)]])
matrix_yaw = sp.Matrix([[sp.cos(yaw), -sp.sin(yaw), 0],
[sp.sin(yaw), sp.cos(yaw), 0],
[0, 0, 1]])
return matrix_yaw*matrix_pitch*matrix_roll

def quat_rotate(q0, q1, q2, q3):
# make symbolic rotation matrix from quat
return sp.Matrix([[q0**2 + q1**2 - q2**2 - q3**2, 2*(q1*q2 + q0*q3), 2*(q1*q3 - q0*q2)],
[2*(q1*q2 - q0*q3), q0**2 - q1**2 + q2**2 - q3**2, 2*(q2*q3 + q0*q1)],
[2*(q1*q3 + q0*q2), 2*(q2*q3 - q0*q1), q0**2 - q1**2 - q2**2 + q3**2]]).T

def quat_matrix_l(p):
return sp.Matrix([[p[0], -p[1], -p[2], -p[3]],
[p[1], p[0], -p[3], p[2]],
[p[2], p[3], p[0], -p[1]],
[p[3], -p[2], p[1], p[0]]])

def quat_matrix_r(p):
return sp.Matrix([[p[0], -p[1], -p[2], -p[3]],
[p[1], p[0], p[3], -p[2]],
[p[2], -p[3], p[0], p[1]],
[p[3], p[2], -p[1], p[0]]])


def sympy_into_c(sympy_functions):
from sympy.utilities import codegen
routines = []
for name, expr, args in sympy_functions:
r = codegen.make_routine(name, expr, language="C99")

# argument ordering input to sympy is broken with function with output arguments
nargs = []
# reorder the input arguments
for aa in args:
if aa is None:
nargs.append(codegen.InputArgument(sp.Symbol('unused'), dimensions=[1,1]))
continue
found = False
for a in r.arguments:
if str(aa.name) == str(a.name):
nargs.append(a)
found = True
break
if not found:
# [1,1] is a hack for Matrices
nargs.append(codegen.InputArgument(aa, dimensions=[1,1]))
# add the output arguments
for a in r.arguments:
if type(a) == codegen.OutputArgument:
nargs.append(a)

#assert len(r.arguments) == len(args)+1
r.arguments = nargs

# add routine to list
routines.append(r)

[(c_name, c_code), (h_name, c_header)] = codegen.get_code_generator('C', 'ekf', 'C99').write(routines, "ekf")
c_code = '\n'.join(filter(lambda x: len(x) > 0 and x[0] != '#', c_code.split("\n")))
c_header = '\n'.join(filter(lambda x: len(x) > 0 and x[0] != '#', c_header.split("\n")))

return c_header, c_code
Oops, something went wrong.

0 comments on commit f74a201

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