Skip to content
Permalink
Browse files

openpilot v0.5.13 release

  • Loading branch information...
Vehicle Researcher
Vehicle Researcher committed Jun 6, 2019
1 parent 59bd6b8 commit dd34ccfe288ebda8e2568cf550994ae890379f45
Showing with 3,744 additions and 1,920 deletions.
  1. +3 −0 .gitignore
  2. +7 −10 README.md
  3. +10 −0 RELEASES.md
  4. BIN apk/ai.comma.plus.offroad.apk
  5. +3 −1 cereal/car.capnp
  6. +13 −10 cereal/log.capnp
  7. +16 −0 common/clock.pyx
  8. +103 −0 common/file_helpers.py
  9. +31 −30 common/params.py
  10. +10 −45 common/realtime.py
  11. +95 −0 common/vin.py
  12. BIN installer/updater/updater
  13. +1 −0 requirements_openpilot.txt
  14. +1 −1 selfdrive/boardd/Makefile
  15. +30 −68 selfdrive/boardd/boardd.cc
  16. +2 −2 selfdrive/can/libdbc_py.py
  17. +14 −8 selfdrive/can/parser.cc
  18. +6 −4 selfdrive/can/parser.py
  19. +3 −2 selfdrive/can/tests/test_packer_honda.py
  20. +88 −46 selfdrive/car/car_helpers.py
  21. +4 −5 selfdrive/car/chrysler/carcontroller.py
  22. +2 −2 selfdrive/car/chrysler/carstate.py
  23. +18 −19 selfdrive/car/chrysler/interface.py
  24. +6 −5 selfdrive/car/chrysler/radar_interface.py
  25. +1 −1 selfdrive/car/ford/carstate.py
  26. +13 −16 selfdrive/car/ford/interface.py
  27. +7 −5 selfdrive/car/ford/radar_interface.py
  28. +16 −12 selfdrive/car/gm/carcontroller.py
  29. +2 −1 selfdrive/car/gm/carstate.py
  30. +7 −2 selfdrive/car/gm/gmcan.py
  31. +19 −20 selfdrive/car/gm/interface.py
  32. +6 −5 selfdrive/car/gm/radar_interface.py
  33. +4 −11 selfdrive/car/honda/carcontroller.py
  34. +7 −5 selfdrive/car/honda/carstate.py
  35. +5 −4 selfdrive/car/honda/hondacan.py
  36. +25 −28 selfdrive/car/honda/interface.py
  37. +4 −3 selfdrive/car/honda/radar_interface.py
  38. +4 −10 selfdrive/car/hyundai/carcontroller.py
  39. +4 −2 selfdrive/car/hyundai/carstate.py
  40. +17 −18 selfdrive/car/hyundai/interface.py
  41. +1 −1 selfdrive/car/hyundai/radar_interface.py
  42. +8 −3 selfdrive/car/mock/interface.py
  43. +1 −1 selfdrive/car/mock/radar_interface.py
  44. +2 −3 selfdrive/car/subaru/carcontroller.py
  45. +4 −2 selfdrive/car/subaru/carstate.py
  46. +15 −17 selfdrive/car/subaru/interface.py
  47. +1 −1 selfdrive/car/subaru/radar_interface.py
  48. +2 −4 selfdrive/car/toyota/carcontroller.py
  49. +2 −2 selfdrive/car/toyota/carstate.py
  50. +16 −19 selfdrive/car/toyota/interface.py
  51. +6 −5 selfdrive/car/toyota/radar_interface.py
  52. +5 −5 selfdrive/car/toyota/values.py
  53. +15 −0 selfdrive/common/messaging.h
  54. +1 −1 selfdrive/common/version.h
  55. +39 −41 selfdrive/controls/controlsd.py
  56. +2 −2 selfdrive/controls/lib/alertmanager.py
  57. +30 −2 selfdrive/controls/lib/alerts.py
  58. +13 −0 selfdrive/controls/lib/cluster/LICENSE
  59. +28 −0 selfdrive/controls/lib/cluster/Makefile
  60. +79 −0 selfdrive/controls/lib/cluster/README
  61. 0 selfdrive/{mapd → controls/lib/cluster}/__init__.py
  62. +218 −0 selfdrive/controls/lib/cluster/fastcluster.cpp
  63. +77 −0 selfdrive/controls/lib/cluster/fastcluster.h
  64. +115 −0 selfdrive/controls/lib/cluster/fastcluster_R_dm.cpp
  65. +1,794 −0 selfdrive/controls/lib/cluster/fastcluster_dm.cpp
  66. +30 −0 selfdrive/controls/lib/cluster/fastcluster_py.py
  67. +35 −0 selfdrive/controls/lib/cluster/test.cpp
  68. +1 −1 selfdrive/controls/lib/latcontrol_indi.py
  69. +1 −1 selfdrive/controls/lib/latcontrol_pid.py
  70. +1 −1 selfdrive/controls/lib/longcontrol.py
  71. +6 −5 selfdrive/controls/lib/pathplanner.py
  72. +13 −13 selfdrive/controls/lib/planner.py
  73. +1 −25 selfdrive/controls/lib/radar_helpers.py
  74. +23 −16 selfdrive/controls/plannerd.py
  75. +35 −37 selfdrive/controls/radard.py
  76. +138 −0 selfdrive/controls/tests/test_clustering.py
  77. +1 −1 selfdrive/controls/tests/test_following_distance.py
  78. +1 −0 selfdrive/debug/cpu_usage_stat.py
  79. +21 −0 selfdrive/locationd/kalman/chi2_lookup.py
  80. BIN selfdrive/locationd/kalman/chi2_lookup_table.npy
  81. +7 −9 selfdrive/locationd/kalman/ekf_sym.py
  82. +23 −13 selfdrive/locationd/locationd_local.py
  83. +3 −3 selfdrive/locationd/ubloxd_main.cc
  84. +10 −0 selfdrive/loggerd/config.py
  85. +2 −3 selfdrive/loggerd/deleter.py
  86. BIN selfdrive/loggerd/loggerd
  87. +2 −3 selfdrive/loggerd/tests/fill_eon.py
  88. +1 −0 selfdrive/logmessaged.py
  89. +7 −8 selfdrive/manager.py
  90. +0 −106 selfdrive/mapd/default_speeds.json
  91. +0 −240 selfdrive/mapd/default_speeds_generator.py
  92. +0 −297 selfdrive/mapd/mapd.py
  93. +0 −364 selfdrive/mapd/mapd_helpers.py
  94. +63 −17 selfdrive/registration.py
  95. BIN selfdrive/sensord/gpsd
  96. BIN selfdrive/sensord/sensord
  97. +9 −9 selfdrive/service_list.yaml
  98. +12 −12 selfdrive/test/plant/maneuver.py
  99. +9 −7 selfdrive/test/plant/plant.py
  100. +9 −46 selfdrive/thermald.py
  101. +7 −0 selfdrive/ui/start.py
  102. +0 −6 selfdrive/ui/start.sh
  103. +137 −146 selfdrive/ui/ui.c
  104. +43 −5 selfdrive/version.py
  105. +7 −11 selfdrive/visiond/camera_qcom.c
  106. +5 −5 selfdrive/visiond/visiond.cc
@@ -34,3 +34,6 @@ selfdrive/visiond/visiond
/src/

one
openpilot
xx

@@ -92,8 +92,6 @@ Supported Cars
| 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-19 | All | Yes | Yes<sup>2</sup>| 0mph | 0mph | Toyota |
| Subaru | Crosstrek 2018 | EyeSight | Yes | Stock | 0mph | 0mph | Subaru |
| Subaru | Impreza 2019 | EyeSight | Yes | Stock | 0mph | 0mph | Subaru |
| Toyota | Avalon 2016 | TSS-P | Yes | Yes<sup>2</sup>| 20mph<sup>1</sup>| 0mph | Toyota |
| 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 |
@@ -109,13 +107,13 @@ Supported Cars
| Toyota | Rav4 2019 | All | Yes | Yes | 0mph | 0mph | Toyota |
| Toyota | Rav4 Hybrid 2017-18 | All | Yes | Yes<sup>2</sup>| 0mph | 0mph | Toyota |

<sup>1</sup>[Comma Pedal](https://community.comma.ai/wiki/index.php/Comma_Pedal) is used to provide stop-and-go capability to some of the openpilot-supported cars that don't currently support stop-and-go. Here is how to [build a Comma Pedal](https://medium.com/@jfrux/comma-pedal-building-with-macrofab-6328bea791e8). ***NOTE: The Comma Pedal is not officially supported by [comma.ai](https://comma.ai)***
<sup>2</sup>When disconnecting the Driver Support Unit (DSU), otherwise longitudinal control is stock ACC. For DSU locations, see [Toyota Wiki page](https://community.comma.ai/wiki/index.php/Toyota)
<sup>3</sup>[GM installation guide](https://zoneos.com/volt/).
<sup>4</sup>It needs an extra 120Ohm resistor ([pic1](https://i.imgur.com/CmdKtTP.jpg), [pic2](https://i.imgur.com/s2etUo6.jpg)) on bus 3 and giraffe switches set to 01X1 (11X1 for stock LKAS), where X depends on if you have the [comma power](https://comma.ai/shop/products/power/).
<sup>5</sup>28mph for Camry 4CYL L, 4CYL LE and 4CYL SE which don't have Full-Speed Range Dynamic Radar Cruise Control.
<sup>6</sup>Open sourced [Hyundai Giraffe](https://github.com/commaai/neo/tree/master/giraffe/hyundai) is designed for the 2019 Sante Fe; pinout may differ for other Hyundais.
<sup>7</sup>Community built Giraffe, find more information [here](https://zoneos.com/shop/).
<sup>1</sup>[Comma Pedal](https://community.comma.ai/wiki/index.php/Comma_Pedal) is used to provide stop-and-go capability to some of the openpilot-supported cars that don't currently support stop-and-go. Here is how to [build a Comma Pedal](https://medium.com/@jfrux/comma-pedal-building-with-macrofab-6328bea791e8). ***NOTE: The Comma Pedal is not officially supported by [comma.ai](https://comma.ai)***
<sup>2</sup>When disconnecting the Driver Support Unit (DSU), otherwise longitudinal control is stock ACC. For DSU locations, see [Toyota Wiki page](https://community.comma.ai/wiki/index.php/Toyota)
<sup>3</sup>[GM installation guide](https://zoneos.com/volt/).
<sup>4</sup>It needs an extra 120Ohm resistor ([pic1](https://i.imgur.com/CmdKtTP.jpg), [pic2](https://i.imgur.com/s2etUo6.jpg)) on bus 3 and giraffe switches set to 01X1 (11X1 for stock LKAS), where X depends on if you have the [comma power](https://comma.ai/shop/products/power/).
<sup>5</sup>28mph for Camry 4CYL L, 4CYL LE and 4CYL SE which don't have Full-Speed Range Dynamic Radar Cruise Control.
<sup>6</sup>Open sourced [Hyundai Giraffe](https://github.com/commaai/neo/tree/master/giraffe/hyundai) is designed for the 2019 Sante Fe; pinout may differ for other Hyundais.
<sup>7</sup>Community built Giraffe, find more information [here](https://zoneos.com/shop/).

Community Maintained Cars
------
@@ -173,7 +171,6 @@ Directory structure
├── locationd # Soon to be home of precise location
├── logcatd # Android logcat as a service
├── loggerd # Logger and uploader of car data
├── mapd # Fetches map data and computes next global path
├── proclogd # Logs information from proc
├── sensord # IMU / GPS interface code
├── test # Car simulator running code through virtual maneuvers
@@ -1,3 +1,13 @@
Version 0.5.13 (2019-05-31)
==========================
* Reduce panda power consumption by 70%, down to 80mW, when car is off (not for GM)
* Reduce EON power consumption by 40%, down to 1100mW, when car is off
* Reduce CPU utilization by 20% and improve stability
* Temporarily remove mapd functionalities to improve stability
* Add openpilot record-only mode for unsupported cars
* Synchronize controlsd to boardd to reduce latency
* Remove panda support for Subaru giraffe

Version 0.5.12 (2019-05-16)
==========================
* Improve lateral control for the Prius and Prius Prime
BIN -64.8 KB (100%) apk/ai.comma.plus.offroad.apk
Binary file not shown.
@@ -74,6 +74,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
invalidGiraffeHonda @49;
vehicleModelInvalid @50;
controlsFailed @51;
sensorDataInvalid @52;
}
}

@@ -175,7 +176,7 @@ struct CarState {

# ******* radar state @ 20hz *******

struct RadarState {
struct RadarData @0x888ad6581cf0aacb {
errors @0 :List(Error);
points @1 :List(RadarPoint);

@@ -333,6 +334,7 @@ struct CarParams {

steerActuatorDelay @36 :Float32; # Steering wheel actuator delay in seconds
openpilotLongitudinalControl @37 :Bool; # is openpilot doing the longitudinal control?
carVin @38 :Text; # VIN number queried during fingerprinting

struct LateralPIDTuning {
kpBP @0 :List(Float32);
@@ -305,12 +305,12 @@ struct LiveUI {
awarenessStatus @3 :Float32;
}

struct Live20Data {
struct RadarState @0x9a185389d6fdd05f {
canMonoTimes @10 :List(UInt64);
mdMonoTime @6 :UInt64;
ftMonoTimeDEPRECATED @7 :UInt64;
l100MonoTime @11 :UInt64;
radarErrors @12 :List(Car.RadarState.Error);
controlsStateMonoTime @11 :UInt64;
radarErrors @12 :List(Car.RadarData.Error);

# all deprecated
warpMatrixDEPRECATED @0 :List(Float32);
@@ -368,15 +368,15 @@ struct LiveTracks {
oncoming @9 :Bool;
}

struct Live100Data {
struct ControlsState @0x97ff69c53601abf1 {
canMonoTimeDEPRECATED @16 :UInt64;
canMonoTimes @21 :List(UInt64);
l20MonoTimeDEPRECATED @17 :UInt64;
radarStateMonoTimeDEPRECATED @17 :UInt64;
mdMonoTimeDEPRECATED @18 :UInt64;
planMonoTime @28 :UInt64;
pathPlanMonoTime @50 :UInt64;

state @31 :ControlState;
state @31 :OpenpilotState;
vEgo @0 :Float32;
vEgoRaw @32 :Float32;
aEgoDEPRECATED @1 :Float32;
@@ -433,7 +433,7 @@ struct Live100Data {
pidState @53 :LateralPIDState;
}

enum ControlState {
enum OpenpilotState @0xdbe58b96d2d1ac61 {
disabled @0;
preEnabled @1;
enabled @2;
@@ -507,6 +507,7 @@ struct ModelData {
points @0 :List(Float32);
prob @1 :Float32;
std @2 :Float32;
stds @3 :List(Float32);
}

struct LeadData {
@@ -574,7 +575,7 @@ struct LogRotate {

struct Plan {
mdMonoTime @9 :UInt64;
l20MonoTime @10 :UInt64;
radarStateMonoTime @10 :UInt64;
eventsDEPRECATED @13 :List(Car.CarEvent);

# lateral, 3rd order polynomial
@@ -648,6 +649,7 @@ struct PathPlan {
paramsValid @10 :Bool;
modelValid @12 :Bool;
angleOffset @11 :Float32;
sensorValid @14 :Bool;
}

struct LiveLocationData {
@@ -1643,6 +1645,7 @@ struct LiveParametersData {
angleOffsetAverage @3 :Float32;
stiffnessFactor @4 :Float32;
steerRatio @5 :Float32;
sensorValid @6 :Bool;
}

struct LiveMapData {
@@ -1690,13 +1693,13 @@ struct Event {
sensorEventDEPRECATED @4 :SensorEventData;
can @5 :List(CanData);
thermal @6 :ThermalData;
live100 @7 :Live100Data;
controlsState @7 :ControlsState;
liveEventDEPRECATED @8 :List(LiveEventData);
model @9 :ModelData;
features @10 :CalibrationFeatures;
sensorEvents @11 :List(SensorEventData);
health @12 :HealthData;
live20 @13 :Live20Data;
radarState @13 :RadarState;
liveUIDEPRECATED @14 :LiveUI;
encodeIdx @15 :EncodeIndex;
liveTracks @16 :List(LiveTracks);
@@ -0,0 +1,16 @@
from posix.time cimport clock_gettime, timespec, CLOCK_BOOTTIME, CLOCK_MONOTONIC_RAW

cdef double readclock(int clock_id):
cdef timespec ts
cdef double current

clock_gettime(clock_id, &ts)
current = ts.tv_sec + (ts.tv_nsec / 1000000000.)
return current


def monotonic_time():
return readclock(CLOCK_MONOTONIC_RAW)

def sec_since_boot():
return readclock(CLOCK_BOOTTIME)
@@ -0,0 +1,103 @@
import os
import shutil
import tempfile
from atomicwrites import AtomicWriter

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

def rm_not_exists_ok(path):
try:
os.remove(path)
except OSError:
if os.path.exists(path):
raise

def rm_tree_or_link(path):
if os.path.islink(path):
os.unlink(path)
elif os.path.isdir(path):
shutil.rmtree(path)

def get_tmpdir_on_same_filesystem(path):
# TODO(mgraczyk): HACK, we should actually check for which filesystem.
normpath = os.path.normpath(path)
parts = normpath.split("/")
if len(parts) > 1:
if parts[1].startswith("raid"):
if len(parts) > 2 and parts[2] == "runner":
return "/{}/runner/tmp".format(parts[1])
elif len(parts) > 2 and parts[2] == "aws":
return "/{}/aws/tmp".format(parts[1])
else:
return "/{}/tmp".format(parts[1])
elif parts[1] == "aws":
return "/aws/tmp"
elif parts[1] == "scratch":
return "/scratch/tmp"
return "/tmp"

class AutoMoveTempdir(object):
def __init__(self, target_path, temp_dir=None):
self._target_path = target_path
self._path = tempfile.mkdtemp(dir=temp_dir)

@property
def name(self):
return self._path

def close(self):
os.rename(self._path, self._target_path)

def __enter__(self): return self

def __exit__(self, type, value, traceback):
if type is None:
self.close()
else:
shutil.rmtree(self._path)

class NamedTemporaryDir(object):
def __init__(self, temp_dir=None):
self._path = tempfile.mkdtemp(dir=temp_dir)

@property
def name(self):
return self._path

def close(self):
shutil.rmtree(self._path)

def __enter__(self): return self

def __exit__(self, type, value, traceback):
self.close()

def _get_fileobject_func(writer, temp_dir):
def _get_fileobject():
file_obj = writer.get_fileobject(dir=temp_dir)
os.chmod(file_obj.name, 0o644)
return file_obj
return _get_fileobject

def atomic_write_on_fs_tmp(path, **kwargs):
"""Creates an atomic writer using a temporary file in a temporary directory
on the same filesystem as path.
"""
# TODO(mgraczyk): This use of AtomicWriter relies on implementation details to set the temp
# directory.
writer = AtomicWriter(path, **kwargs)
return writer._open(_get_fileobject_func(writer, get_tmpdir_on_same_filesystem(path)))


def atomic_write_in_dir(path, **kwargs):
"""Creates an atomic writer using a temporary file in the same directory
as the destination file.
"""
writer = AtomicWriter(path, **kwargs)
return writer._open(_get_fileobject_func(writer, os.path.dirname(path)))

@@ -41,40 +41,41 @@ def mkdirs_exists_ok(path):
class TxType(Enum):
PERSISTENT = 1
CLEAR_ON_MANAGER_START = 2
CLEAR_ON_CAR_START = 3
CLEAR_ON_PANDA_DISCONNECT = 3


class UnknownKeyName(Exception):
pass


keys = {
"AccessToken": 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,
"HasAcceptedTerms": TxType.PERSISTENT,
"IsDriverMonitoringEnabled": TxType.PERSISTENT,
"IsFcwEnabled": TxType.PERSISTENT,
"IsGeofenceEnabled": TxType.PERSISTENT,
"IsMetric": TxType.PERSISTENT,
"IsUpdateAvailable": 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,
"AccessToken": [TxType.PERSISTENT],
"CalibrationParams": [TxType.PERSISTENT],
"CarParams": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
"CompletedTrainingVersion": [TxType.PERSISTENT],
"ControlsParams": [TxType.PERSISTENT],
"DoUninstall": [TxType.CLEAR_ON_MANAGER_START],
"DongleId": [TxType.PERSISTENT],
"GitBranch": [TxType.PERSISTENT],
"GitCommit": [TxType.PERSISTENT],
"GitRemote": [TxType.PERSISTENT],
"HasAcceptedTerms": [TxType.PERSISTENT],
"IsDriverMonitoringEnabled": [TxType.PERSISTENT],
"IsFcwEnabled": [TxType.PERSISTENT],
"IsGeofenceEnabled": [TxType.PERSISTENT],
"IsMetric": [TxType.PERSISTENT],
"IsUpdateAvailable": [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],
"SubscriberInfo": [TxType.PERSISTENT],
"TrainingVersion": [TxType.PERSISTENT],
"Version": [TxType.PERSISTENT],
}


@@ -308,14 +309,14 @@ def transaction(self, write=False):
def _clear_keys_with_type(self, tx_type):
with self.transaction(write=True) as txn:
for key in keys:
if keys[key] == tx_type:
if tx_type in keys[key]:
txn.delete(key)

def manager_start(self):
self._clear_keys_with_type(TxType.CLEAR_ON_MANAGER_START)

def car_start(self):
self._clear_keys_with_type(TxType.CLEAR_ON_CAR_START)
def panda_disconnect(self):
self._clear_keys_with_type(TxType.CLEAR_ON_PANDA_DISCONNECT)

def delete(self, key):
with self.transaction(write=True) as txn:

0 comments on commit dd34ccf

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