diff --git a/README.md b/README.md
index ae6b0ed66f..442fbd4470 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
-[](#)
+[](#)
Welcome to openpilot
======
-[openpilot](http://github.com/commaai/openpilot) is an open source driving agent. Currently it performs the functions of Adaptive Cruise Control (ACC) and Lane Keeping Assist System (LKAS) for Hondas, Acuras, Toyotas, and a Chevy. It's about on par with Tesla Autopilot and GM Super Cruise, and better than [all other manufacturers](http://www.thedrive.com/tech/5707/the-war-for-autonomous-driving-part-iii-us-vs-germany-vs-japan).
+[openpilot](http://github.com/commaai/openpilot) is an open source driving agent. Currently it performs the functions of Adaptive Cruise Control (ACC) and Lane Keeping Assist System (LKAS) for selected Honda, Toyota, Acura, Lexus, Chevrolet, Hyundai, Kia. It's about on par with Tesla Autopilot and GM Super Cruise, and better than [all other manufacturers](http://www.thedrive.com/tech/5707/the-war-for-autonomous-driving-part-iii-us-vs-germany-vs-japan).
The openpilot codebase has been written to be concise and enable rapid prototyping. We look forward to your contributions - improving real vehicle automation has never been easier.
@@ -14,7 +14,7 @@ openpilot is developed by [comma.ai](https://comma.ai/) and users like you.
We have a [Twitter you should follow](https://twitter.com/comma_ai).
-Also, we have a 3500+ person [community on slack](https://slack.comma.ai).
+Also, we have a several thousand people community on [slack](https://slack.comma.ai).
@@ -41,54 +41,54 @@ Install openpilot on a neo device by entering ``https://openpilot.comma.ai`` dur
Supported Cars
------
-| Make | Model | Supported Package | Lateral | Longitudinal | No Accel Below | No Steer Below |
-| -------------------| ----------------------| ---------------------| --------| ---------------| -----------------| ---------------|
-| Acura | ILX 2016 | AcuraWatch Plus | Yes | Yes | 25mph1| 25mph |
-| Acura | ILX 2017 | AcuraWatch Plus | Yes | Yes | 25mph1| 25mph |
-| Acura | RDX 2018 | AcuraWatch Plus | Yes | Yes | 25mph1| 12mph |
-| GM3 | Volt 2017 | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
-| GM3 | Volt 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
-| Honda | Accord 2018 | All | Yes | Stock | 0mph | 3mph |
-| Honda | Civic 2016 | Honda Sensing | Yes | Yes | 0mph | 12mph |
-| Honda | Civic 2017 | Honda Sensing | Yes | Yes | 0mph | 12mph |
-| Honda | Civic 2017 *(Hatch)* | Honda Sensing | Yes | Stock | 0mph | 12mph |
-| Honda | Civic 2018 | Honda Sensing | Yes | Yes | 0mph | 12mph |
-| Honda | Civic 2018 *(Hatch)* | Honda Sensing | Yes | Stock | 0mph | 12mph |
-| Honda | CR-V 2015 | Touring | Yes | Yes | 25mph1| 12mph |
-| Honda | CR-V 2016 | Touring | Yes | Yes | 25mph1| 12mph |
-| Honda | CR-V 2017 | Honda Sensing | Yes | Stock | 0mph | 12mph |
-| Honda | CR-V 2018 | Honda Sensing | Yes | Stock | 0mph | 12mph |
-| Honda | Odyssey 2017 | Honda Sensing | Yes | Yes | 25mph1| 0mph |
-| Honda | Odyssey 2018 | Honda Sensing | Yes | Yes | 25mph1| 0mph |
-| Honda | Odyssey 2019 | Honda Sensing | Yes | Yes | 25mph1| 0mph |
-| Honda | Pilot 2017 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
-| Honda | Pilot 2018 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
-| Honda | Pilot 2019 | All | Yes | Yes | 25mph1| 12mph |
-| Honda | Ridgeline 2017 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
-| Honda | Ridgeline 2018 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
-| Hyundai6| Santa Fe 2019 | All | Yes | Stock | 0mph | 0mph |
-| Hyundai6| Elantra 2017 | SCC + LKAS | Yes | Stock | 19mph | 34mph |
-| Hyundai6| Genesis 2018 | All | Yes | Stock | 19mph | 34mph |
-| Kia6 | Sorento 2018 | All | Yes | Stock | 0mph | 0mph |
-| Kia6 | Stinger 2018 | SCC + LKAS | Yes | Stock | 0mph | 0mph |
-| Lexus | RX Hybrid 2017 | All | Yes | Yes2| 0mph | 0mph |
-| Lexus | RX Hybrid 2018 | All | Yes | Yes2| 0mph | 0mph |
-| Toyota | Camry 20184| All | Yes | Stock | 0mph5 | 0mph |
-| Toyota | C-HR 20184 | All | Yes | Stock | 0mph | 0mph |
-| Toyota | Corolla 2017 | All | Yes | Yes2| 20mph | 0mph |
-| Toyota | Corolla 2018 | All | Yes | Yes2| 20mph | 0mph |
-| Toyota | Highlander 2017 | All | Yes | Yes2| 0mph | 0mph |
-| Toyota | Highlander Hybrid 2018| All | Yes | Yes2| 0mph | 0mph |
-| Toyota | Prius 2016 | TSS-P | Yes | Yes2| 0mph | 0mph |
-| Toyota | Prius 2017 | All | Yes | Yes2| 0mph | 0mph |
-| Toyota | Prius 2018 | All | Yes | Yes2| 0mph | 0mph |
-| Toyota | Prius Prime 2017 | All | Yes | Yes2| 0mph | 0mph |
-| Toyota | Prius Prime 2018 | All | Yes | Yes2| 0mph | 0mph |
-| Toyota | Rav4 2016 | TSS-P | Yes | Yes2| 20mph | 0mph |
-| Toyota | Rav4 2017 | All | Yes | Yes2| 20mph | 0mph |
-| Toyota | Rav4 2018 | All | Yes | Yes2| 20mph | 0mph |
-| Toyota | Rav4 Hybrid 2017 | All | Yes | Yes2| 0mph | 0mph |
-| Toyota | Rav4 Hybrid 2018 | All | Yes | Yes2| 0mph | 0mph |
+| Make | Model | Supported Package | Lateral | Longitudinal | No Accel Below | No Steer Below |
+| ---------------------| ----------------------| ---------------------| --------| ---------------| -----------------| ---------------|
+| Acura | ILX 2016 | AcuraWatch Plus | Yes | Yes | 25mph1| 25mph |
+| Acura | ILX 2017 | AcuraWatch Plus | Yes | Yes | 25mph1| 25mph |
+| Acura | RDX 2018 | AcuraWatch Plus | Yes | Yes | 25mph1| 12mph |
+| Chevrolet3| Volt 2017 | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
+| Chevrolet3| Volt 2018 | Adaptive Cruise | Yes | Yes | 0mph | 7mph |
+| Honda | Accord 2018 | All | Yes | Stock | 0mph | 3mph |
+| Honda | Civic 2016 | Honda Sensing | Yes | Yes | 0mph | 12mph |
+| Honda | Civic 2017 | Honda Sensing | Yes | Yes | 0mph | 12mph |
+| Honda | Civic 2017 *(Hatch)* | Honda Sensing | Yes | Stock | 0mph | 12mph |
+| Honda | Civic 2018 | Honda Sensing | Yes | Yes | 0mph | 12mph |
+| Honda | Civic 2018 *(Hatch)* | Honda Sensing | Yes | Stock | 0mph | 12mph |
+| Honda | CR-V 2015 | Touring | Yes | Yes | 25mph1| 12mph |
+| Honda | CR-V 2016 | Touring | Yes | Yes | 25mph1| 12mph |
+| Honda | CR-V 2017 | Honda Sensing | Yes | Stock | 0mph | 12mph |
+| Honda | CR-V 2018 | Honda Sensing | Yes | Stock | 0mph | 12mph |
+| Honda | Odyssey 2017 | Honda Sensing | Yes | Yes | 25mph1| 0mph |
+| Honda | Odyssey 2018 | Honda Sensing | Yes | Yes | 25mph1| 0mph |
+| Honda | Odyssey 2019 | Honda Sensing | Yes | Yes | 25mph1| 0mph |
+| Honda | Pilot 2017 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
+| Honda | Pilot 2018 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
+| Honda | Pilot 2019 | All | Yes | Yes | 25mph1| 12mph |
+| Honda | Ridgeline 2017 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
+| Honda | Ridgeline 2018 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
+| Hyundai6 | Santa Fe 2019 | All | Yes | Stock | 0mph | 0mph |
+| Hyundai6 | Elantra 2017 | SCC + LKAS | Yes | Stock | 19mph | 34mph |
+| Hyundai6 | Genesis 2018 | All | Yes | Stock | 19mph | 34mph |
+| Kia6 | Sorento 2018 | All | Yes | Stock | 0mph | 0mph |
+| Kia6 | Stinger 2018 | SCC + LKAS | Yes | Stock | 0mph | 0mph |
+| Lexus | RX Hybrid 2017 | All | Yes | Yes2| 0mph | 0mph |
+| Lexus | RX Hybrid 2018 | All | Yes | Yes2| 0mph | 0mph |
+| Toyota | Camry 20184| All | Yes | Stock | 0mph5 | 0mph |
+| Toyota | C-HR 20184 | All | Yes | Stock | 0mph | 0mph |
+| Toyota | Corolla 2017 | All | Yes | Yes2| 20mph | 0mph |
+| Toyota | Corolla 2018 | All | Yes | Yes2| 20mph | 0mph |
+| Toyota | Highlander 2017 | All | Yes | Yes2| 0mph | 0mph |
+| Toyota | Highlander Hybrid 2018| All | Yes | Yes2| 0mph | 0mph |
+| Toyota | Prius 2016 | TSS-P | Yes | Yes2| 0mph | 0mph |
+| Toyota | Prius 2017 | All | Yes | Yes2| 0mph | 0mph |
+| Toyota | Prius 2018 | All | Yes | Yes2| 0mph | 0mph |
+| Toyota | Prius Prime 2017 | All | Yes | Yes2| 0mph | 0mph |
+| Toyota | Prius Prime 2018 | All | Yes | Yes2| 0mph | 0mph |
+| Toyota | Rav4 2016 | TSS-P | Yes | Yes2| 20mph | 0mph |
+| Toyota | Rav4 2017 | All | Yes | Yes2| 20mph | 0mph |
+| Toyota | Rav4 2018 | All | Yes | Yes2| 20mph | 0mph |
+| Toyota | Rav4 Hybrid 2017 | All | Yes | Yes2| 0mph | 0mph |
+| Toyota | Rav4 Hybrid 2018 | All | Yes | Yes2| 0mph | 0mph |
1[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)***
2When 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)
@@ -103,8 +103,11 @@ Community Maintained Cars
| Make | Model | Supported Package | Lateral | Longitudinal | No Accel Below | No Steer Below |
| ------- | ---------------------- | -------------------- | ------- | ------------ | -------------- | -------------- |
| Honda | Fit 2018 | Honda Sensing | Yes | Yes | 25mph1| 12mph |
+| Tesla | Model S 2012 | All | Yes | Not yet | Not applicable | 0mph |
+| Tesla | Model S 2013 | All | Yes | Not yet | Not applicable | 0mph |
[[Honda Fit Pull Request]](https://github.com/commaai/openpilot/pull/266).
+[[Tesla Model S Pull Request]](https://github.com/commaai/openpilot/pull/246)
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.
diff --git a/RELEASES.md b/RELEASES.md
index 6230b33fe0..82f0120865 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -1,3 +1,9 @@
+Version 0.5.5 (2018-10-20)
+========================
+ * Increase allowed Honda positive accelerations
+ * Fix sporadic unexpected braking when passing semi-trucks in Toyota
+ * Fix gear reading bug in Hyundai Elantra thanks to emmertex!
+
Version 0.5.4 (2018-09-25)
========================
* New Driving Model
diff --git a/cereal/log.capnp b/cereal/log.capnp
index ea7012bad3..f1b4b50b62 100644
--- a/cereal/log.capnp
+++ b/cereal/log.capnp
@@ -410,6 +410,7 @@ struct Live100Data {
alertStatus @38 :AlertStatus;
alertSize @39 :AlertSize;
alertBlinkingRate @42 :Float32;
+ alertType @44 :Text;
awarenessStatus @26 :Float32;
angleOffset @27 :Float32;
gpsPlannerActive @40 :Bool;
@@ -1558,6 +1559,13 @@ struct Boot {
lastPmsg @2 :Data;
}
+struct LiveParametersData {
+ valid @0 :Bool;
+ gyroBias @1 :Float32;
+ angleOffset @2 :Float32;
+}
+
+
struct Event {
# in nanoseconds?
logMonoTime @0 :UInt64;
@@ -1623,5 +1631,6 @@ struct Event {
orbFeaturesSummary @58 :OrbFeaturesSummary;
driverMonitoring @59 :DriverMonitoring;
boot @60 :Boot;
+ liveParameters @61 :LiveParametersData;
}
}
diff --git a/common/ffi_wrapper.py b/common/ffi_wrapper.py
index 264dbd7fcb..65b790a803 100644
--- a/common/ffi_wrapper.py
+++ b/common/ffi_wrapper.py
@@ -6,7 +6,7 @@ from cffi import FFI
TMPDIR = "/tmp/ccache"
-def ffi_wrap(name, c_code, c_header, tmpdir=TMPDIR):
+def ffi_wrap(name, c_code, c_header, tmpdir=TMPDIR, cflags="", libraries=[]):
cache = name + "_" + hashlib.sha1(c_code).hexdigest()
try:
os.mkdir(tmpdir)
@@ -21,19 +21,19 @@ def ffi_wrap(name, c_code, c_header, tmpdir=TMPDIR):
mod = __import__(cache)
except Exception:
print "cache miss", cache
- compile_code(cache, c_code, c_header, tmpdir)
+ compile_code(cache, c_code, c_header, tmpdir, cflags, libraries)
mod = __import__(cache)
finally:
os.close(fd)
return mod.ffi, mod.lib
-def compile_code(name, c_code, c_header, directory):
+def compile_code(name, c_code, c_header, directory, cflags="", libraries=[]):
ffibuilder = FFI()
- ffibuilder.set_source(name, c_code, source_extension='.cpp')
+ 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'] = ""
+ os.environ['CFLAGS'] = cflags
ffibuilder.compile(verbose=True, debug=False, tmpdir=directory)
def wrap_compiled(name, directory):
diff --git a/common/transformations/model.py b/common/transformations/model.py
index 26a20d509f..107c3d542c 100644
--- a/common/transformations/model.py
+++ b/common/transformations/model.py
@@ -75,10 +75,8 @@ def get_model_height_transform(camera_frame_from_road_frame, height):
[0, 0, 1],
]))
- ground_from_camera_frame = np.linalg.inv(camera_frame_from_road_ground)
-
- low_camera_from_high_camera = np.dot(camera_frame_from_road_high, ground_from_camera_frame)
- high_camera_from_low_camera = np.linalg.inv(low_camera_from_high_camera)
+ road_high_from_camera_frame = np.linalg.inv(camera_frame_from_road_high)
+ high_camera_from_low_camera = np.dot(camera_frame_from_road_ground, road_high_from_camera_frame)
return high_camera_from_low_camera
diff --git a/opendbc/gm_global_a_object.dbc b/opendbc/gm_global_a_object.dbc
index b4aa31a3e1..8847bab39d 100644
--- a/opendbc/gm_global_a_object.dbc
+++ b/opendbc/gm_global_a_object.dbc
@@ -67,8 +67,37 @@ BO_ 776 ASCMAccSpeedStatus: 7 NEO
SG_ VehicleSpeed : 15|12@0+ (1,0) [0|0] "" B233B_LRR
SG_ AlwaysOne : 3|1@0+ (1,0) [0|0] "" B233B_LRR
-BO_ 1120 LRRNumObjects: 8 B233B_LRR
- SG_ LRRNumObjects : 20|5@0+ (1,0) [0|0] "" NEO
+BO_ 1120 F_LRR_Obj_Header: 8 LRR_FO
+ SG_ FLRRRollingCount : 7|2@0+ (1,0) [0|3] "" EOCM_F_FO
+ SG_ FLRRModeCmdFdbk : 23|3@0+ (1,0) [0|7] "" EOCM_F_FO
+ SG_ FLRRNumValidTargets : 20|5@0+ (1,0) [0|31] "" EOCM_F_FO
+ SG_ FLRRTimeStampV : 31|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRTimeStamp : 2|11@0+ (1,0) [0|2047] "ms" EOCM_F_FO
+ SG_ FLRRRoadTypeInfo : 5|3@0+ (1,0) [0|7] "" EOCM_F_FO
+ SG_ FLRRBurstChecksum : 55|16@0+ (1,0) [0|65535] "" EOCM_F_FO
+ SG_ FLRRDiagSpare : 30|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRVltgOutRngLo : 44|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRVltgOutRngHi : 43|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRSvcAlgnInPrcs : 38|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRSnsrBlckd : 45|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRSnstvFltPrsntInt : 24|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRPlntAlgnInProc : 37|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRMsalgnYawRt : 47|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRMsalgnYawLt : 46|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRLonVelPlsblityFlt : 35|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRYawRtPlsblityFlt : 34|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRMsalgnPtchUp : 32|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRMsalgnPtchDn : 33|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRInitDiagCmplt : 40|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRHWFltPrsntInt : 25|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRExtIntrfrnc : 36|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRCANSgnlSpvFld : 29|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRCANRxErr : 28|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRTunlDtctd : 27|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRAmbTmpOutRngLw : 42|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRAmbTmpOutRngHi : 41|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRAntTngFltPrsnt : 26|1@0+ (1,0) [0|1] "" EOCM_F_FO
+ SG_ FLRRAlgnFltPrsnt : 39|1@0+ (1,0) [0|1] "" EOCM_F_FO
BO_ 1134 LRRObject14: 8 B233B_LRR
SG_ TrkRange : 5|11@0+ (0.125,0) [0|255.875] "m" NEO
diff --git a/opendbc/toyota_prius_2017_adas.dbc b/opendbc/toyota_prius_2017_adas.dbc
index 9d1646f04a..4aae65aa40 100644
--- a/opendbc/toyota_prius_2017_adas.dbc
+++ b/opendbc/toyota_prius_2017_adas.dbc
@@ -182,80 +182,95 @@ BO_ 543 TRACK_A_15: 8 XXX
BO_ 544 TRACK_B_0: 8 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 545 TRACK_B_1: 8 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 546 TRACK_B_2: 8 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 547 TRACK_B_3: 8 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 548 TRACK_B_4: 8 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 549 TRACK_B_5: 8 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 550 TRACK_B_6: 8 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 551 TRACK_B_7: 8 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 552 TRACK_B_8: 6 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX
BO_ 553 TRACK_B_9: 6 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX
BO_ 554 TRACK_B_10: 6 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX
BO_ 555 TRACK_B_11: 6 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX
BO_ 556 TRACK_B_12: 6 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX
BO_ 557 TRACK_B_13: 6 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX
BO_ 558 TRACK_B_14: 6 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX
BO_ 559 TRACK_B_15: 6 XXX
SG_ COUNTER : 7|8@0+ (1,0) [0|255] "" XXX
SG_ REL_ACCEL : 15|7@0- (1,0) [-64|63] "" XXX
+ SG_ SCORE : 23|8@0+ (1,0) [0|100] "" XXX
SG_ CHECKSUM : 47|8@0+ (1,0) [0|255] "" XXX
-
diff --git a/panda/VERSION b/panda/VERSION
index 261f347572..46882bcf3d 100644
--- a/panda/VERSION
+++ b/panda/VERSION
@@ -1 +1 @@
-v1.1.5
\ No newline at end of file
+v1.1.6
\ No newline at end of file
diff --git a/panda/board/safety.h b/panda/board/safety.h
index 4c24bd9b26..51a2bb8963 100644
--- a/panda/board/safety.h
+++ b/panda/board/safety.h
@@ -56,6 +56,7 @@ int controls_allowed = 0;
#include "safety/safety_toyota.h"
#ifdef PANDA
#include "safety/safety_toyota_ipas.h"
+#include "safety/safety_tesla.h"
#endif
#include "safety/safety_gm.h"
#include "safety/safety_ford.h"
@@ -100,6 +101,7 @@ typedef struct {
#define SAFETY_FORD 5
#define SAFETY_CADILLAC 6
#define SAFETY_HYUNDAI 7
+#define SAFETY_TESLA 8
#define SAFETY_TOYOTA_IPAS 0x1335
#define SAFETY_TOYOTA_NOLIMITS 0x1336
#define SAFETY_ALLOUTPUT 0x1337
@@ -117,6 +119,7 @@ const safety_hook_config safety_hook_registry[] = {
{SAFETY_TOYOTA_NOLIMITS, &toyota_nolimits_hooks},
#ifdef PANDA
{SAFETY_TOYOTA_IPAS, &toyota_ipas_hooks},
+ {SAFETY_TESLA, &tesla_hooks},
#endif
{SAFETY_ALLOUTPUT, &alloutput_hooks},
{SAFETY_ELM327, &elm327_hooks},
diff --git a/panda/board/safety/safety_tesla.h b/panda/board/safety/safety_tesla.h
new file mode 100644
index 0000000000..a13e78f5a5
--- /dev/null
+++ b/panda/board/safety/safety_tesla.h
@@ -0,0 +1,287 @@
+// board enforces
+// in-state
+// accel set/resume
+// out-state
+// cancel button
+// regen paddle
+// accel rising edge
+// brake rising edge
+// brake > 0mph
+//
+int fmax_limit_check(float val, const float MAX, const float MIN) {
+ return (val > MAX) || (val < MIN);
+}
+
+// 2m/s are added to be less restrictive
+const struct lookup_t TESLA_LOOKUP_ANGLE_RATE_UP = {
+ {2., 7., 17.},
+ {5., .8, .25}};
+
+const struct lookup_t TESLA_LOOKUP_ANGLE_RATE_DOWN = {
+ {2., 7., 17.},
+ {5., 3.5, .8}};
+
+const struct lookup_t TESLA_LOOKUP_MAX_ANGLE = {
+ {2., 29., 38.},
+ {410., 92., 36.}};
+
+const int TESLA_RT_INTERVAL = 250000; // 250ms between real time checks
+
+// state of angle limits
+float tesla_desired_angle_last = 0; // last desired steer angle
+float tesla_rt_angle_last = 0.; // last real time angle
+float tesla_ts_angle_last = 0;
+
+int tesla_controls_allowed_last = 0;
+
+int tesla_brake_prev = 0;
+int tesla_gas_prev = 0;
+int tesla_speed = 0;
+int eac_status = 0;
+
+int tesla_ignition_started = 0;
+
+
+void set_gmlan_digital_output(int to_set);
+void reset_gmlan_switch_timeout(void);
+void gmlan_switch_init(int timeout_enable);
+
+
+static void tesla_rx_hook(CAN_FIFOMailBox_TypeDef *to_push)
+{
+ set_gmlan_digital_output(0); // #define GMLAN_HIGH 0
+ reset_gmlan_switch_timeout(); //we're still in tesla safety mode, reset the timeout counter and make sure our output is enabled
+
+ //int bus_number = (to_push->RDTR >> 4) & 0xFF;
+ uint32_t addr;
+ if (to_push->RIR & 4)
+ {
+ // Extended
+ // Not looked at, but have to be separated
+ // to avoid address collision
+ addr = to_push->RIR >> 3;
+ }
+ else
+ {
+ // Normal
+ addr = to_push->RIR >> 21;
+ }
+
+ if (addr == 0x45)
+ {
+ // 6 bits starting at position 0
+ int lever_position = (to_push->RDLR & 0x3F);
+ if (lever_position == 2)
+ { // pull forward
+ // activate openpilot
+ controls_allowed = 1;
+ //}
+ }
+ else if (lever_position == 1)
+ { // push towards the back
+ // deactivate openpilot
+ controls_allowed = 0;
+ }
+ }
+
+ // Detect drive rail on (ignition) (start recording)
+ if (addr == 0x348)
+ {
+ // GTW_status
+ int drive_rail_on = (to_push->RDLR & 0x0001);
+ tesla_ignition_started = drive_rail_on == 1;
+ }
+
+ // exit controls on brake press
+ // DI_torque2::DI_brakePedal 0x118
+ if (addr == 0x118)
+ {
+ // 1 bit at position 16
+ if (((to_push->RDLR & 0x8000)) >> 15 == 1)
+ {
+ //disable break cancel by commenting line below
+ controls_allowed = 0;
+ }
+ //get vehicle speed in m/s. Tesla gives MPH
+ tesla_speed = ((((((to_push->RDLR >> 24) & 0x0F) << 8) + ((to_push->RDLR >> 16) & 0xFF)) * 0.05 - 25) * 1.609 / 3.6);
+ if (tesla_speed < 0)
+ {
+ tesla_speed = 0;
+ }
+ }
+
+ // exit controls on EPAS error
+ // EPAS_sysStatus::EPAS_eacStatus 0x370
+ if (addr == 0x370)
+ {
+ // if EPAS_eacStatus is not 1 or 2, disable control
+ eac_status = ((to_push->RDHR >> 21)) & 0x7;
+ // For human steering override we must not disable controls when eac_status == 0
+ // Additional safety: we could only allow eac_status == 0 when we have human steering allowed
+ if ((controls_allowed == 1) && (eac_status != 0) && (eac_status != 1) && (eac_status != 2))
+ {
+ controls_allowed = 0;
+ //puts("EPAS error! \n");
+ }
+ }
+ //get latest steering wheel angle
+ if (addr == 0x00E)
+ {
+ float angle_meas_now = (int)((((to_push->RDLR & 0x3F) << 8) + ((to_push->RDLR >> 8) & 0xFF)) * 0.1 - 819.2);
+ uint32_t ts = TIM2->CNT;
+ uint32_t ts_elapsed = get_ts_elapsed(ts, tesla_ts_angle_last);
+
+ // *** angle real time check
+ // add 1 to not false trigger the violation and multiply by 25 since the check is done every 250 ms and steer angle is updated at 100Hz
+ float rt_delta_angle_up = interpolate(TESLA_LOOKUP_ANGLE_RATE_UP, tesla_speed) * 25. + 1.;
+ float rt_delta_angle_down = interpolate(TESLA_LOOKUP_ANGLE_RATE_DOWN, tesla_speed) * 25. + 1.;
+ float highest_rt_angle = tesla_rt_angle_last + (tesla_rt_angle_last > 0 ? rt_delta_angle_up : rt_delta_angle_down);
+ float lowest_rt_angle = tesla_rt_angle_last - (tesla_rt_angle_last > 0 ? rt_delta_angle_down : rt_delta_angle_up);
+
+ if ((ts_elapsed > TESLA_RT_INTERVAL) || (controls_allowed && !tesla_controls_allowed_last))
+ {
+ tesla_rt_angle_last = angle_meas_now;
+ tesla_ts_angle_last = ts;
+ }
+
+ // check for violation;
+ if (fmax_limit_check(angle_meas_now, highest_rt_angle, lowest_rt_angle))
+ {
+ // We should not be able to STEER under these conditions
+ // Other sending is fine (to allow human override)
+ controls_allowed = 0;
+ //puts("WARN: RT Angle - No steer allowed! \n");
+ }
+ else
+ {
+ controls_allowed = 1;
+ }
+
+ tesla_controls_allowed_last = controls_allowed;
+ }
+}
+
+// all commands: gas/regen, friction brake and steering
+// if controls_allowed and no pedals pressed
+// allow all commands up to limit
+// else
+// block all commands that produce actuation
+
+static int tesla_tx_hook(CAN_FIFOMailBox_TypeDef *to_send)
+{
+
+ uint32_t addr;
+ float angle_raw;
+ float desired_angle;
+
+ addr = to_send->RIR >> 21;
+
+ // do not transmit CAN message if steering angle too high
+ // DAS_steeringControl::DAS_steeringAngleRequest
+ if (addr == 0x488)
+ {
+ angle_raw = ((to_send->RDLR & 0x7F) << 8) + ((to_send->RDLR & 0xFF00) >> 8);
+ desired_angle = angle_raw * 0.1 - 1638.35;
+ int16_t violation = 0;
+ int st_enabled = (to_send->RDLR & 0x400000) >> 22;
+
+ if (st_enabled == 0) {
+ //steering is not enabled, do not check angles and do send
+ tesla_desired_angle_last = desired_angle;
+ return true;
+ }
+
+ if (controls_allowed)
+ {
+ // add 1 to not false trigger the violation
+ float delta_angle_up = interpolate(TESLA_LOOKUP_ANGLE_RATE_UP, tesla_speed) + 1.;
+ float delta_angle_down = interpolate(TESLA_LOOKUP_ANGLE_RATE_DOWN, tesla_speed) + 1.;
+ float highest_desired_angle = tesla_desired_angle_last + (tesla_desired_angle_last > 0 ? delta_angle_up : delta_angle_down);
+ float lowest_desired_angle = tesla_desired_angle_last - (tesla_desired_angle_last > 0 ? delta_angle_down : delta_angle_up);
+ float TESLA_MAX_ANGLE = interpolate(TESLA_LOOKUP_MAX_ANGLE, tesla_speed) + 1.;
+
+ //check for max angles
+ violation |= fmax_limit_check(desired_angle, TESLA_MAX_ANGLE, -TESLA_MAX_ANGLE);
+
+ //check for angle delta changes
+ violation |= fmax_limit_check(desired_angle, highest_desired_angle, lowest_desired_angle);
+
+ if (violation)
+ {
+ controls_allowed = 0;
+ return false;
+ }
+ tesla_desired_angle_last = desired_angle;
+ return true;
+ }
+ return false;
+ }
+ return true;
+}
+
+static int tesla_tx_lin_hook(int lin_num, uint8_t *data, int len)
+{
+ // LIN is not used on the Tesla
+ return false;
+}
+
+static void tesla_init(int16_t param)
+{
+ controls_allowed = 0;
+ tesla_ignition_started = 0;
+ gmlan_switch_init(1); //init the gmlan switch with 1s timeout enabled
+}
+
+static int tesla_ign_hook()
+{
+ return tesla_ignition_started;
+}
+
+static int tesla_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd)
+{
+
+ int32_t addr = to_fwd->RIR >> 21;
+
+ if (bus_num == 0)
+ {
+
+ // change inhibit of GTW_epasControl
+ if (addr == 0x101)
+ {
+ to_fwd->RDLR = to_fwd->RDLR | 0x4000; // 0x4000: WITH_ANGLE, 0xC000: WITH_BOTH (angle and torque)
+ int checksum = (((to_fwd->RDLR & 0xFF00) >> 8) + (to_fwd->RDLR & 0xFF) + 2) & 0xFF;
+ to_fwd->RDLR = to_fwd->RDLR & 0xFFFF;
+ to_fwd->RDLR = to_fwd->RDLR + (checksum << 16);
+ return 2;
+ }
+
+ // remove EPB_epasControl
+ if (addr == 0x214)
+ {
+ return false;
+ }
+
+ return 2; // Custom EPAS bus
+ }
+ if (bus_num == 2)
+ {
+
+ // remove GTW_epasControl in forwards
+ if (addr == 0x101)
+ {
+ return false;
+ }
+
+ return 0; // Chassis CAN
+ }
+ return false;
+}
+
+const safety_hooks tesla_hooks = {
+ .init = tesla_init,
+ .rx = tesla_rx_hook,
+ .tx = tesla_tx_hook,
+ .tx_lin = tesla_tx_lin_hook,
+ .ignition = tesla_ign_hook,
+ .fwd = tesla_fwd_hook,
+};
diff --git a/panda/tests/safety/test.c b/panda/tests/safety/test.c
index c3f280644b..c1555db5d5 100644
--- a/panda/tests/safety/test.c
+++ b/panda/tests/safety/test.c
@@ -183,3 +183,13 @@ void init_tests_honda(void){
brake_prev = 0;
gas_prev = 0;
}
+
+
+void set_gmlan_digital_output(int to_set){
+}
+
+void reset_gmlan_switch_timeout(void){
+}
+
+void gmlan_switch_init(int timeout_enable){
+}
diff --git a/selfdrive/assets/sounds/hq_disengaged.mp3 b/selfdrive/assets/sounds/hq_disengaged.mp3
new file mode 100644
index 0000000000..a2e9eb2aa0
Binary files /dev/null and b/selfdrive/assets/sounds/hq_disengaged.mp3 differ
diff --git a/selfdrive/assets/sounds/hq_engaged.mp3 b/selfdrive/assets/sounds/hq_engaged.mp3
new file mode 100644
index 0000000000..dad247493e
Binary files /dev/null and b/selfdrive/assets/sounds/hq_engaged.mp3 differ
diff --git a/selfdrive/assets/sounds/hq_warning_0.mp3 b/selfdrive/assets/sounds/hq_warning_0.mp3
new file mode 100644
index 0000000000..5dbe1a4aea
Binary files /dev/null and b/selfdrive/assets/sounds/hq_warning_0.mp3 differ
diff --git a/selfdrive/assets/sounds/hq_warning_1.mp3 b/selfdrive/assets/sounds/hq_warning_1.mp3
new file mode 100644
index 0000000000..4b658591f3
Binary files /dev/null and b/selfdrive/assets/sounds/hq_warning_1.mp3 differ
diff --git a/selfdrive/assets/sounds/hq_warning_2.mp3 b/selfdrive/assets/sounds/hq_warning_2.mp3
new file mode 100644
index 0000000000..04371e0a81
Binary files /dev/null and b/selfdrive/assets/sounds/hq_warning_2.mp3 differ
diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py
index be0ca64ccb..71277cf2a7 100644
--- a/selfdrive/car/gm/carcontroller.py
+++ b/selfdrive/car/gm/carcontroller.py
@@ -26,7 +26,11 @@ class CarControllerParams():
self.STEER_DRIVER_FACTOR = 100 # from dbc
self.NEAR_STOP_BRAKE_PHASE = 0.5 # m/s, more aggressive braking near full stop
- self.ADAS_KEEPALIVE_STEP = 10
+ # Takes case of "Service Adaptive Cruise" and "Service Front Camera"
+ # dashboard messages.
+ self.ADAS_KEEPALIVE_STEP = 100
+ self.CAMERA_KEEPALIVE_STEP = 100
+
# pedal lookups, only for Volt
MAX_GAS = 3072 # Only a safety limit
ZERO_GAS = 2048
@@ -59,12 +63,11 @@ class CarController(object):
self.pedal_steady = 0.
self.start_time = sec_since_boot()
self.chime = 0
- self.lkas_active = False
- self.inhibit_steer_for = 0
self.steer_idx = 0
self.apply_steer_last = 0
self.car_fingerprint = car_fingerprint
self.allow_controls = allow_controls
+ self.lka_icon_status_last = (False, False)
# Setup detection helper. Routes commands to
# an appropriate CAN bus number.
@@ -158,10 +161,21 @@ class CarController(object):
can_sends.append(gmcan.create_adas_steering_status(canbus.obstacle, idx))
can_sends.append(gmcan.create_adas_accelerometer_speed_status(canbus.obstacle, CS.v_ego, idx))
- # Send ADAS keepalive, 10hz
if frame % P.ADAS_KEEPALIVE_STEP == 0:
can_sends += gmcan.create_adas_keepalive(canbus.powertrain)
+ # Show green icon when LKA torque is applied, and
+ # alarming orange icon when approaching torque limit.
+ # If not sent again, LKA icon disappears in about 5 seconds.
+ # Conveniently, sending camera message periodically also works as a keepalive.
+ lka_active = CS.lkas_status == 1
+ lka_critical = lka_active and abs(actuators.steer) > 0.9
+ lka_icon_status = (lka_active, lka_critical)
+ if frame % P.CAMERA_KEEPALIVE_STEP == 0 \
+ or lka_icon_status != self.lka_icon_status_last:
+ can_sends.append(gmcan.create_lka_icon_command(canbus.sw_gmlan, lka_active, lka_critical))
+ self.lka_icon_status_last = lka_icon_status
+
# Send chimes
if self.chime != chime:
duration = 0x3c
diff --git a/selfdrive/car/gm/gmcan.py b/selfdrive/car/gm/gmcan.py
index 47b0d8b38d..910cb1d956 100644
--- a/selfdrive/car/gm/gmcan.py
+++ b/selfdrive/car/gm/gmcan.py
@@ -134,6 +134,16 @@ def create_chime_command(bus, chime_type, duration, repeat_cnt):
dat = [chime_type, duration, repeat_cnt, 0xff, 0]
return [0x10400060, 0, "".join(map(chr, dat)), bus]
+def create_lka_icon_command(bus, active, critical):
+ if active:
+ if critical:
+ dat = "\x40\xc0\x14"
+ else:
+ dat = "\x40\x40\x18"
+ else:
+ dat = "\x00\x00\x00"
+ return [0x104c006c, 0, dat, bus]
+
# TODO: WIP
'''
def create_friction_brake_command_ct6(packer, bus, apply_brake, idx, near_stop, at_full_stop):
diff --git a/selfdrive/car/gm/radar_interface.py b/selfdrive/car/gm/radar_interface.py
index bc35b3459b..a14cb1603f 100755
--- a/selfdrive/car/gm/radar_interface.py
+++ b/selfdrive/car/gm/radar_interface.py
@@ -11,13 +11,13 @@ from common.realtime import sec_since_boot
from selfdrive.services import service_list
import selfdrive.messaging as messaging
-NUM_TARGETS_MSG = 1120
-SLOT_1_MSG = NUM_TARGETS_MSG + 1
+RADAR_HEADER_MSG = 1120
+SLOT_1_MSG = RADAR_HEADER_MSG + 1
NUM_SLOTS = 20
# Actually it's 0x47f, but can parser only reports
# messages that are present in DBC
-LAST_RADAR_MSG = NUM_TARGETS_MSG + NUM_SLOTS
+LAST_RADAR_MSG = RADAR_HEADER_MSG + NUM_SLOTS
def create_radard_can_parser(canbus, car_fingerprint):
@@ -25,12 +25,16 @@ def create_radard_can_parser(canbus, car_fingerprint):
if car_fingerprint == CAR.VOLT:
# C1A-ARS3-A by Continental
radar_targets = range(SLOT_1_MSG, SLOT_1_MSG + NUM_SLOTS)
- signals = zip(['LRRNumObjects'] +
+ signals = zip(['FLRRNumValidTargets',
+ 'FLRRSnsrBlckd', 'FLRRYawRtPlsblityFlt',
+ 'FLRRHWFltPrsntInt', 'FLRRAntTngFltPrsnt',
+ 'FLRRAlgnFltPrsnt', 'FLRRSnstvFltPrsntInt'] +
['TrkRange'] * NUM_SLOTS + ['TrkRangeRate'] * NUM_SLOTS +
['TrkRangeAccel'] * NUM_SLOTS + ['TrkAzimuth'] * NUM_SLOTS +
['TrkWidth'] * NUM_SLOTS + ['TrkObjectID'] * NUM_SLOTS,
- [NUM_TARGETS_MSG] + radar_targets * 6,
- [0] + [0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS +
+ [RADAR_HEADER_MSG] * 7 + radar_targets * 6,
+ [0] * 7 +
+ [0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS +
[0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS +
[0.0] * NUM_SLOTS + [0] * NUM_SLOTS)
@@ -44,8 +48,6 @@ class RadarInterface(object):
def __init__(self, CP):
# radar
self.pts = {}
- self.track_id = 0
- self.num_targets = 0
self.delay = 0.0 # Delay of radar
@@ -70,22 +72,27 @@ class RadarInterface(object):
if LAST_RADAR_MSG in updated_messages:
break
+ header = self.rcp.vl[RADAR_HEADER_MSG]
+ fault = header['FLRRSnsrBlckd'] or header['FLRRSnstvFltPrsntInt'] or \
+ header['FLRRYawRtPlsblityFlt'] or header['FLRRHWFltPrsntInt'] or \
+ header['FLRRAntTngFltPrsnt'] or header['FLRRAlgnFltPrsnt']
errors = []
if not self.rcp.can_valid:
- errors.append("notValid")
+ errors.append("commIssue")
+ if fault:
+ errors.append("fault")
ret.errors = errors
currentTargets = set()
- if self.rcp.vl[NUM_TARGETS_MSG]['LRRNumObjects'] != self.num_targets:
- self.num_targets = self.rcp.vl[NUM_TARGETS_MSG]['LRRNumObjects']
+ num_targets = header['FLRRNumValidTargets']
# Not all radar messages describe targets,
- # no need to monitor all of the sself.rcp.msgs_upd
+ # no need to monitor all of the self.rcp.msgs_upd
for ii in updated_messages:
- if ii == NUM_TARGETS_MSG:
+ if ii == RADAR_HEADER_MSG:
continue
- if self.num_targets == 0:
+ if num_targets == 0:
break
cpt = self.rcp.vl[ii]
diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py
index 2bff2e7460..42eb041f3f 100755
--- a/selfdrive/car/honda/interface.py
+++ b/selfdrive/car/honda/interface.py
@@ -10,7 +10,6 @@ from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET,
from selfdrive.controls.lib.vehicle_model import VehicleModel
from selfdrive.car.honda.carstate import CarState, get_can_parser
from selfdrive.car.honda.values import CruiseButtons, CM, BP, AH, CAR, HONDA_BOSCH
-from selfdrive.controls.lib.planner import A_ACC_MAX
try:
from selfdrive.car.honda.carcontroller import CarController
@@ -128,7 +127,7 @@ class CarInterface(object):
# accelOverride is more or less the max throttle allowed to pcm: usually set to a constant
# unless aTargetMax is very high and then we scale with it; this help in quicker restart
- return float(max(0.714, a_target / A_ACC_MAX)) * min(speedLimiter, accelLimiter)
+ return float(min(speedLimiter, accelLimiter))
@staticmethod
def get_params(candidate, fingerprint):
diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py
index eec1a7e0c6..c9dbcdc7a8 100644
--- a/selfdrive/car/honda/values.py
+++ b/selfdrive/car/honda/values.py
@@ -90,7 +90,7 @@ FINGERPRINTS = {
57: 3, 145: 8, 228: 5, 229: 4, 308: 5, 316: 8, 334: 8, 339: 7, 342: 6, 344: 8, 379: 8, 380: 8, 392: 6, 399: 7, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 507: 1, 512: 6, 513: 6, 538: 3, 542: 7, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 837: 5, 856: 7, 871: 8, 882: 2, 884: 7, 891: 8, 892: 8, 923: 2, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1088: 8, 1089: 8, 1108: 8, 1125: 8, 1296: 8, 1424: 5, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1616: 5, 1618: 5, 1668: 5
}],
CAR.PILOT_2019: [{
- 57: 3, 145: 8, 228: 5, 308: 5, 316: 8, 334: 8, 342: 6, 344: 8, 379: 8, 380: 8, 399: 7, 411: 5, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 538: 3, 542: 7, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 817: 4, 819: 7, 821: 5, 825: 4, 829: 5, 837: 5, 856: 7, 871: 8, 881: 8, 882: 2, 884: 7, 891: 8, 892: 8, 923: 2, 927: 8, 929: 8, 983: 8, 985: 3, 1029: 8, 1052: 8, 1064: 7, 1088: 8, 1089: 8, 1092: 1, 1108: 8, 1110: 8, 1125: 8, 1296: 8, 1424: 5, 1445: 8, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1614: 5, 1615: 8, 1616: 5, 1617: 8, 1618: 5, 1623: 5, 1668: 5
+ 57: 3, 145: 8, 228: 5, 229: 4, 308: 5, 316: 8, 334: 8, 342: 6, 344: 8, 379: 8, 380: 8, 392: 6, 399: 7, 411: 5, 419: 8, 420: 8, 422: 8, 425: 8, 426: 8, 427: 3, 432: 7, 463: 8, 464: 8, 476: 4, 490: 8, 506: 8, 538: 3, 542: 7, 545: 5, 546: 3, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 808: 8, 817: 4, 819: 7, 821: 5, 825: 4, 829: 5, 837: 5, 856: 7, 871: 8, 881: 8, 882: 2, 884: 7, 891: 8, 892: 8, 923: 2, 927: 8, 929: 8, 963: 8, 965: 8, 966: 8, 967: 8, 983: 8, 985: 3, 1027: 5, 1029: 8, 1039: 8, 1052: 8, 1064: 7, 1088: 8, 1089: 8, 1092: 1, 1108: 8, 1110: 8, 1125: 8, 1296: 8, 1424: 5, 1445: 8, 1600: 5, 1601: 8, 1612: 5, 1613: 5, 1614: 5, 1615: 8, 1616: 5, 1617: 8, 1618: 5, 1623: 5, 1668: 5
}],
# Ridgeline w/ Added Comma Pedal Support (512L & 513L)
CAR.RIDGELINE: [{
diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py
index 4714644957..4511838020 100644
--- a/selfdrive/car/hyundai/carstate.py
+++ b/selfdrive/car/hyundai/carstate.py
@@ -44,6 +44,11 @@ def get_can_parser(CP):
("CF_Clu_AmpInfo", "CLU11", 0),
("CF_Clu_AliveCnt1", "CLU11", 0),
+ ("CF_Clu_InhibitD", "CLU15", 0),
+ ("CF_Clu_InhibitP", "CLU15", 0),
+ ("CF_Clu_InhibitN", "CLU15", 0),
+ ("CF_Clu_InhibitR", "CLU15", 0),
+
("CF_Lvr_Gear","LVR12",0),
("ACCEnable", "TCS13", 0),
@@ -204,7 +209,7 @@ class CarState(object):
self.pedal_gas = cp.vl["EMS12"]['TPS']
self.car_gas = cp.vl["EMS12"]['TPS']
- # Gear Selecton - This should be compatible with all Kia/Hyundai with Auto's
+ # Gear Selecton - This is not compatible with all Kia/Hyundai's, But is the best way for those it is compatible with
gear = cp.vl["LVR12"]["CF_Lvr_Gear"]
if gear == 5:
self.gear_shifter = "drive"
@@ -217,6 +222,18 @@ class CarState(object):
else:
self.gear_shifter = "unknown"
+ # Gear Selection via Cluster - For those Kia/Hyundai which are not fully discovered, we can use the Cluster Indicator for Gear Selection, as this seems to be standard over all cars, but is not the preferred method.
+ if cp.vl["CLU15"]["CF_Clu_InhibitD"] == 1:
+ self.gear_shifter_cluster = "drive"
+ elif cp.vl["CLU15"]["CF_Clu_InhibitN"] == 1:
+ self.gear_shifter_cluster = "neutral"
+ elif cp.vl["CLU15"]["CF_Clu_InhibitP"] == 1:
+ self.gear_shifter_cluster = "park"
+ elif cp.vl["CLU15"]["CF_Clu_InhibitR"] == 1:
+ self.gear_shifter_cluster = "reverse"
+ else:
+ self.gear_shifter_cluster = "unknown"
+
# save the entire LKAS11 and CLU11
self.lkas11 = cp_cam.vl["LKAS11"]
self.clu11 = cp.vl["CLU11"]
diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py
index 5f9d75c94b..96174ef096 100644
--- a/selfdrive/car/hyundai/interface.py
+++ b/selfdrive/car/hyundai/interface.py
@@ -95,14 +95,15 @@ class CarInterface(object):
ret.steerKpV, ret.steerKiV = [[0.25], [0.05]]
ret.minSteerSpeed = 0.
elif candidate == CAR.ELANTRA:
- ret.steerKf = 0.00004
+ ret.steerKf = 0.00006
ret.steerRateCost = 0.5
ret.mass = 1275 + std_cargo
ret.wheelbase = 2.7
- ret.steerRatio = 16.9
+ ret.steerRatio = 13.73 #Spec
+ tire_stiffness_factor = 0.385
ret.steerKiBP, ret.steerKpBP = [[0.], [0.]]
- ret.steerKpV, ret.steerKiV = [[0.20], [0.01]]
- ret.minSteerSpeed = 35 * CV.MPH_TO_MS
+ ret.steerKpV, ret.steerKiV = [[0.25], [0.05]]
+ ret.minSteerSpeed = 32 * CV.MPH_TO_MS
elif candidate == CAR.GENESIS:
ret.steerKf = 0.00005
ret.steerRateCost = 0.5
@@ -190,7 +191,10 @@ class CarInterface(object):
ret.wheelSpeeds.rr = self.CS.v_wheel_rr
# gear shifter
- ret.gearShifter = self.CS.gear_shifter
+ if self.CP.carFingerprint == CAR.ELANTRA:
+ ret.gearShifter = self.CS.gear_shifter_cluster
+ else:
+ ret.gearShifter = self.CS.gear_shifter
# gas pedal
ret.gas = self.CS.car_gas
diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py
index df0adf191d..0017c07831 100644
--- a/selfdrive/car/hyundai/values.py
+++ b/selfdrive/car/hyundai/values.py
@@ -27,7 +27,7 @@ FINGERPRINTS = {
66: 8, 67: 8, 68: 8, 127: 8, 273: 8, 274: 8, 275: 8, 339: 8, 356: 4, 399: 8, 512: 6, 544: 8, 593: 8, 608: 8, 688: 5, 790: 8, 809: 8, 897: 8, 899: 8, 902: 8, 903: 8, 905: 8, 909: 8, 916: 8, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1170: 8, 1265: 4, 1280: 1, 1282: 4, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1314: 8, 1322: 8, 1345: 8, 1349: 8, 1351: 8, 1353: 8, 1363: 8, 1366: 8, 1367: 8, 1369: 8, 1407: 8, 1415: 8, 1419: 8, 1425: 2, 1427: 6, 1440: 8, 1456: 4, 1472: 8, 1486: 8, 1487: 8, 1491: 8, 1530: 8, 1532: 5, 2001: 8, 2003: 8, 2004: 8, 2009: 8, 2012: 8, 2016: 8, 2017: 8, 2024: 8, 2025: 8
}],
CAR.GENESIS: [{
- 67: 8, 68: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 7, 593: 8, 608: 8, 688: 5, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 5, 897: 8, 902: 8, 903: 6, 916: 8, 1024: 2, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1184: 8, 1265: 4, 1280: 1, 1287: 4, 1292: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1334: 8, 1335: 8, 1345: 8, 1363: 8, 1369: 8, 1370: 8, 1371: 8, 1378: 4, 1384: 5, 1407: 8, 1419: 8, 1427: 6, 1434: 2, 1456: 4
+ 67: 8, 68: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 7, 593: 8, 608: 8, 688: 5, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 5, 897: 8, 902: 8, 903: 6, 916: 8, 1024: 2, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1184: 8, 1265: 4, 1280: 1, 1287: 4, 1292: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1334: 8, 1335: 8, 1342: 6, 1345: 8, 1363: 8, 1369: 8, 1370: 8, 1371: 8, 1378: 4, 1384: 5, 1407: 8, 1419: 8, 1427: 6, 1434: 2, 1456: 4
}],
CAR.KIA_SORENTO: [{
67: 8, 68: 8, 127: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 8, 593: 8, 608: 8, 688: 5, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 8, 897: 8, 902: 8, 903: 8, 916: 8, 1040: 8, 1042: 8, 1056: 8, 1057: 8, 1064: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1265: 4, 1280: 1, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1342: 6, 1345: 8, 1348: 8, 1363: 8, 1369: 8, 1370: 8, 1371: 8, 1384: 8, 1407: 8, 1411: 8, 1419: 8, 1425: 2, 1427: 6, 1444: 8, 1456: 4, 1470: 8, 1489: 1
diff --git a/selfdrive/car/toyota/radar_interface.py b/selfdrive/car/toyota/radar_interface.py
index 25bbfbfb39..2ae8fd3db9 100755
--- a/selfdrive/car/toyota/radar_interface.py
+++ b/selfdrive/car/toyota/radar_interface.py
@@ -10,24 +10,30 @@ import selfdrive.messaging as messaging
from selfdrive.car.toyota.values import NO_DSU_CAR
-RADAR_MSGS = list(range(0x210, 0x220))
+RADAR_A_MSGS = list(range(0x210, 0x220))
+RADAR_B_MSGS = list(range(0x220, 0x230))
def _create_radard_can_parser():
dbc_f = 'toyota_prius_2017_adas.dbc'
- msg_n = len(RADAR_MSGS)
- signals = zip(['LONG_DIST'] * msg_n + ['NEW_TRACK'] * msg_n + ['LAT_DIST'] * msg_n +
- ['REL_SPEED'] * msg_n + ['VALID'] * msg_n,
- RADAR_MSGS * 5,
- [255] * msg_n + [1] * msg_n + [0] * msg_n + [0] * msg_n + [0] * msg_n)
- checks = zip(RADAR_MSGS, [20]*msg_n)
+
+ msg_a_n = len(RADAR_A_MSGS)
+ msg_b_n = len(RADAR_B_MSGS)
+
+ signals = zip(['LONG_DIST'] * msg_a_n + ['NEW_TRACK'] * msg_a_n + ['LAT_DIST'] * msg_a_n +
+ ['REL_SPEED'] * msg_a_n + ['VALID'] * msg_a_n + ['SCORE'] * msg_b_n,
+ RADAR_A_MSGS * 5 + RADAR_B_MSGS,
+ [255] * msg_a_n + [1] * msg_a_n + [0] * msg_a_n + [0] * msg_a_n + [0] * msg_a_n + [0] * msg_b_n)
+
+ checks = zip(RADAR_A_MSGS + RADAR_B_MSGS, [20]*(msg_a_n + msg_b_n))
return CANParser(os.path.splitext(dbc_f)[0], signals, checks, 1)
+
class RadarInterface(object):
def __init__(self, CP):
# radar
self.pts = {}
- self.validCnt = {key: 0 for key in RADAR_MSGS}
+ self.seen_valid = {key: False for key in RADAR_A_MSGS}
self.track_id = 0
self.delay = 0.0 # Delay of radar
@@ -52,7 +58,7 @@ class RadarInterface(object):
tm = int(sec_since_boot() * 1e9)
updated_messages.update(self.rcp.update(tm, True))
# TODO: do not hardcode last msg
- if 0x21f in updated_messages:
+ if 0x22f in updated_messages:
break
errors = []
@@ -62,32 +68,33 @@ class RadarInterface(object):
ret.canMonoTimes = canMonoTimes
for ii in updated_messages:
- cpt = self.rcp.vl[ii]
+ if ii in RADAR_A_MSGS:
+ cpt = self.rcp.vl[ii]
- if cpt['LONG_DIST'] >=255 or cpt['NEW_TRACK']:
- self.validCnt[ii] = 0 # reset counter
+ if cpt['LONG_DIST'] >= 255 or cpt['NEW_TRACK']:
+ self.seen_valid[ii] = False # reset validity
- if cpt['VALID'] and cpt['LONG_DIST'] < 255:
- self.validCnt[ii] += 1
- else:
- self.validCnt[ii] = max(self.validCnt[ii] -1, 0)
- #print ii, self.validCnt[ii], cpt['VALID'], cpt['LONG_DIST'], cpt['LAT_DIST']
+ if cpt['LONG_DIST'] < 255 and cpt['VALID']:
+ self.seen_valid[ii] = True
- # radar point only valid if there have been enough valid measurements
- if self.validCnt[ii] > 0:
- if ii not in self.pts or cpt['NEW_TRACK']:
- self.pts[ii] = car.RadarState.RadarPoint.new_message()
- self.pts[ii].trackId = self.track_id
- self.track_id += 1
- self.pts[ii].dRel = cpt['LONG_DIST'] # from front of car
- self.pts[ii].yRel = -cpt['LAT_DIST'] # in car frame's y axis, left is positive
- self.pts[ii].vRel = cpt['REL_SPEED']
- self.pts[ii].aRel = float('nan')
- self.pts[ii].yvRel = float('nan')
- self.pts[ii].measured = bool(cpt['VALID'])
- else:
- if ii in self.pts:
- del self.pts[ii]
+ score = self.rcp.vl[ii+16]['SCORE']
+ # print ii, score, cpt['VALID'], cpt['LONG_DIST'], cpt['LAT_DIST']
+
+ # radar point only valid if it's a valid measurement and score is above 50
+ if (cpt['VALID'] or score > 50) and cpt['LONG_DIST'] < 255 and self.seen_valid[ii]:
+ if ii not in self.pts or cpt['NEW_TRACK']:
+ self.pts[ii] = car.RadarState.RadarPoint.new_message()
+ self.pts[ii].trackId = self.track_id
+ self.track_id += 1
+ self.pts[ii].dRel = cpt['LONG_DIST'] # from front of car
+ self.pts[ii].yRel = -cpt['LAT_DIST'] # in car frame's y axis, left is positive
+ self.pts[ii].vRel = cpt['REL_SPEED']
+ self.pts[ii].aRel = float('nan')
+ self.pts[ii].yvRel = float('nan')
+ self.pts[ii].measured = bool(cpt['VALID'])
+ else:
+ if ii in self.pts:
+ del self.pts[ii]
ret.points = self.pts.values()
return ret
diff --git a/selfdrive/common/version.h b/selfdrive/common/version.h
index a8edf68845..ab4726817a 100644
--- a/selfdrive/common/version.h
+++ b/selfdrive/common/version.h
@@ -1 +1 @@
-#define COMMA_VERSION "0.5.4-release"
+#define COMMA_VERSION "0.5.5-release"
diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py
index 70afd6fcc9..470be768b3 100755
--- a/selfdrive/controls/controlsd.py
+++ b/selfdrive/controls/controlsd.py
@@ -352,6 +352,7 @@ def data_send(perception_state, plan, plan_ts, CS, CI, CP, VM, state, events, ac
"alertSize": AM.alert_size,
"alertStatus": AM.alert_status,
"alertBlinkingRate": AM.alert_rate,
+ "alertType": AM.alert_type,
"awarenessStatus": max(driver_status.awareness, 0.0) if isEnabled(state) else 0.0,
"driverMonitoringOn": bool(driver_status.monitor_on),
"canMonoTimes": list(CS.canMonoTimes),
diff --git a/selfdrive/controls/lib/alertmanager.py b/selfdrive/controls/lib/alertmanager.py
index 9f92fe44c6..99bb9bfc11 100644
--- a/selfdrive/controls/lib/alertmanager.py
+++ b/selfdrive/controls/lib/alertmanager.py
@@ -18,6 +18,7 @@ AlertStatus = log.Live100Data.AlertStatus
class Alert(object):
def __init__(self,
+ alert_type,
alert_text_1,
alert_text_2,
alert_status,
@@ -30,6 +31,7 @@ class Alert(object):
duration_text,
alert_rate=0.):
+ self.alert_type = alert_type
self.alert_text_1 = alert_text_1
self.alert_text_2 = alert_text_2
self.alert_status = alert_status
@@ -60,475 +62,554 @@ class Alert(object):
class AlertManager(object):
alerts = {
-
- # Miscellaneous alerts
- "enable": Alert(
- "",
- "",
- AlertStatus.normal, AlertSize.none,
- Priority.MID, None, "beepSingle", .2, 0., 0.),
-
- "disable": Alert(
- "",
- "",
- AlertStatus.normal, AlertSize.none,
- Priority.MID, None, "beepSingle", .2, 0., 0.),
-
- "fcw": Alert(
- "BRAKE!",
- "Risk of Collision",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "fcw", "chimeRepeated", 1., 2., 2.),
-
- "steerSaturated": Alert(
- "TAKE CONTROL",
- "Turn Exceeds Steering Limit",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.LOW, "steerRequired", "chimeSingle", 1., 2., 3.),
-
- "steerTempUnavailable": Alert(
- "TAKE CONTROL",
- "Steering Temporarily Unavailable",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.LOW, "steerRequired", "chimeDouble", .4, 2., 3.),
-
- "steerTempUnavailableMute": Alert(
- "TAKE CONTROL",
- "Steering Temporarily Unavailable",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.LOW, None, None, .2, .2, .2),
-
- "preDriverDistracted": Alert(
- "KEEP EYES ON ROAD: User Appears Distracted",
- "",
- AlertStatus.normal, AlertSize.small,
- Priority.LOW, "steerRequired", None, 0., .1, .1, alert_rate=0.75),
-
- "promptDriverDistracted": Alert(
- "KEEP EYES ON ROAD",
- "User Appears Distracted",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.MID, "steerRequired", "chimeRepeated", .1, .1, .1),
-
- "driverDistracted": Alert(
- "DISENGAGE IMMEDIATELY",
- "User Was Distracted",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGH, "steerRequired", "chimeRepeated", .1, .1, .1),
-
- "preDriverUnresponsive": Alert(
- "TOUCH STEERING WHEEL: No Driver Monitoring",
- "",
- AlertStatus.normal, AlertSize.small,
- Priority.LOW, "steerRequired", None, 0., .1, .1, alert_rate=0.75),
-
- "promptDriverUnresponsive": Alert(
- "TOUCH STEERING WHEEL",
- "User Is Unresponsive",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.MID, "steerRequired", "chimeRepeated", .1, .1, .1),
-
- "driverUnresponsive": Alert(
- "DISENGAGE IMMEDIATELY",
- "User Was Unresponsive",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGH, "steerRequired", "chimeRepeated", .1, .1, .1),
-
- "driverMonitorOff": Alert(
- "DRIVER MONITOR IS UNAVAILABLE",
- "Accuracy Is Low",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, None, .4, 0., 4.),
-
- "driverMonitorOn": Alert(
- "DRIVER MONITOR IS AVAILABLE",
- "Accuracy Is High",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, None, .4, 0., 4.),
-
- "geofence": Alert(
- "DISENGAGEMENT REQUIRED",
- "Not in Geofenced Area",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.HIGH, "steerRequired", "chimeRepeated", .1, .1, .1),
-
- "startup": Alert(
- "Be ready to take over at any time",
- "Always keep hands on wheel and eyes on road",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW_LOWEST, None, None, 0., 0., 15.),
-
- "ethicalDilemma": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Ethical Dilemma Detected",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- "steerTempUnavailableNoEntry": Alert(
- "openpilot Unavailable",
- "Steering Temporarily Unavailable",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 0., 3.),
-
- "manualRestart": Alert(
- "TAKE CONTROL",
- "Resume Driving Manually",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.LOW, None, None, 0., 0., .2),
-
- "resumeRequired": Alert(
- "STOPPED",
- "Press Resume to Move",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.LOW, None, None, 0., 0., .2),
-
- "belowSteerSpeed": Alert(
- "TAKE CONTROL",
- "Steer Unavailable Below ",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.MID, "steerRequired", None, 0., 0., .1),
-
- "debugAlert": Alert(
- "DEBUG ALERT",
- "",
- AlertStatus.userPrompt, AlertSize.mid,
- Priority.LOW, None, None, .1, .1, .1),
-
- # Non-entry only alerts
- "wrongCarModeNoEntry": Alert(
- "openpilot Unavailable",
- "Main Switch Off",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 0., 3.),
-
- "dataNeededNoEntry": Alert(
- "openpilot Unavailable",
- "Data Needed for Calibration. Upload Drive, Try Again",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 0., 3.),
-
- "outOfSpaceNoEntry": Alert(
- "openpilot Unavailable",
- "Out of Storage Space",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 0., 3.),
-
- "pedalPressedNoEntry": Alert(
- "openpilot Unavailable",
- "Pedal Pressed During Attempt",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, "brakePressed", "chimeDouble", .4, 2., 3.),
-
- "speedTooLowNoEntry": Alert(
- "openpilot Unavailable",
- "Speed Too Low",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "brakeHoldNoEntry": Alert(
- "openpilot Unavailable",
- "Brake Hold Active",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "parkBrakeNoEntry": Alert(
- "openpilot Unavailable",
- "Park Brake Engaged",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "lowSpeedLockoutNoEntry": Alert(
- "openpilot Unavailable",
- "Cruise Fault: Restart the Car",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "lowBatteryNoEntry": Alert(
- "openpilot Unavailable",
- "Low Battery",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- # Cancellation alerts causing soft disabling
- "overheat": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "System Overheated",
- AlertStatus.critical, AlertSize.full,
- Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- "wrongGear": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Gear not D",
- AlertStatus.critical, AlertSize.full,
- Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- "calibrationInvalid": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Calibration Invalid: Reposition EON and Recalibrate",
- AlertStatus.critical, AlertSize.full,
- Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- "calibrationIncomplete": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Calibration in Progress",
- AlertStatus.critical, AlertSize.full,
- Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- "doorOpen": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Door Open",
- AlertStatus.critical, AlertSize.full,
- Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- "seatbeltNotLatched": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Seatbelt Unlatched",
- AlertStatus.critical, AlertSize.full,
- Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- "espDisabled": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "ESP Off",
- AlertStatus.critical, AlertSize.full,
- Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- "lowBattery": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Low Battery",
- AlertStatus.critical, AlertSize.full,
- Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
-
- # Cancellation alerts causing immediate disabling
- "radarCommIssue": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Radar Error: Restart the Car",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "radarFault": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Radar Error: Restart the Car",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "modelCommIssue": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Model Error: Check Internet Connection",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "controlsFailed": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Controls Failed",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "controlsMismatch": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Controls Mismatch",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "commIssue": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "CAN Error: Check Connections",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "steerUnavailable": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "LKAS Fault: Restart the Car",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "brakeUnavailable": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Cruise Fault: Restart the Car",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "gasUnavailable": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Gas Fault: Restart the Car",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "reverseGear": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Reverse Gear",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "cruiseDisabled": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Cruise Is Off",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- "plannerError": Alert(
- "TAKE CONTROL IMMEDIATELY",
- "Planner Solution Error",
- AlertStatus.critical, AlertSize.full,
- Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
-
- # not loud cancellations (user is in control)
- "noTarget": Alert(
- "openpilot Canceled",
- "No close lead car",
- AlertStatus.normal, AlertSize.mid,
- Priority.HIGH, None, "chimeDouble", .4, 2., 3.),
-
- "speedTooLow": Alert(
- "openpilot Canceled",
- "Speed too low",
- AlertStatus.normal, AlertSize.mid,
- Priority.HIGH, None, "chimeDouble", .4, 2., 3.),
-
- # Cancellation alerts causing non-entry
- "overheatNoEntry": Alert(
- "openpilot Unavailable",
- "System overheated",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "wrongGearNoEntry": Alert(
- "openpilot Unavailable",
- "Gear not D",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "calibrationInvalidNoEntry": Alert(
- "openpilot Unavailable",
- "Calibration Invalid: Reposition EON and Recalibrate",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "calibrationIncompleteNoEntry": Alert(
- "openpilot Unavailable",
- "Calibration in Progress",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "doorOpenNoEntry": Alert(
- "openpilot Unavailable",
- "Door open",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "seatbeltNotLatchedNoEntry": Alert(
- "openpilot Unavailable",
- "Seatbelt unlatched",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "espDisabledNoEntry": Alert(
- "openpilot Unavailable",
- "ESP Off",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "geofenceNoEntry": Alert(
- "openpilot Unavailable",
- "Not in Geofenced Area",
- AlertStatus.normal, AlertSize.mid,
- Priority.MID, None, "chimeDouble", .4, 2., 3.),
-
- "radarCommIssueNoEntry": Alert(
- "openpilot Unavailable",
- "Radar Error: Restart the Car",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "radarFaultNoEntry": Alert(
- "openpilot Unavailable",
- "Radar Error: Restart the Car",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "modelCommIssueNoEntry": Alert(
- "openpilot Unavailable",
- "Model Error: Check Internet Connection",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "controlsFailedNoEntry": Alert(
- "openpilot Unavailable",
- "Controls Failed",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "commIssueNoEntry": Alert(
- "openpilot Unavailable",
- "CAN Error: Check Connections",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "steerUnavailableNoEntry": Alert(
- "openpilot Unavailable",
- "LKAS Fault: Restart the Car",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "brakeUnavailableNoEntry": Alert(
- "openpilot Unavailable",
- "Cruise Fault: Restart the Car",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "gasUnavailableNoEntry": Alert(
- "openpilot Unavailable",
- "Gas Error: Restart the Car",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "reverseGearNoEntry": Alert(
- "openpilot Unavailable",
- "Reverse Gear",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "cruiseDisabledNoEntry": Alert(
- "openpilot Unavailable",
- "Cruise is Off",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "noTargetNoEntry": Alert(
- "openpilot Unavailable",
- "No Close Lead Car",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- "plannerErrorNoEntry": Alert(
- "openpilot Unavailable",
- "Planner Solution Error",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOW, None, "chimeDouble", .4, 2., 3.),
-
- # permanent alerts
- "steerUnavailablePermanent": Alert(
- "LKAS Fault: Restart the car to engage",
- "",
- AlertStatus.normal, AlertSize.small,
- Priority.LOW_LOWEST, None, None, 0., 0., .2),
-
- "brakeUnavailablePermanent": Alert(
- "Cruise Fault: Restart the car to engage",
- "",
- AlertStatus.normal, AlertSize.small,
- Priority.LOW_LOWEST, None, None, 0., 0., .2),
-
- "lowSpeedLockoutPermanent": Alert(
- "Cruise Fault: Restart the car to engage",
- "",
- AlertStatus.normal, AlertSize.small,
- Priority.LOW_LOWEST, None, None, 0., 0., .2),
-
- "calibrationIncompletePermanent": Alert(
- "Calibration in Progress: ",
- "Drive Above ",
- AlertStatus.normal, AlertSize.mid,
- Priority.LOWEST, None, None, 0., 0., .2),
+ alert.alert_type: alert
+ for alert in [
+ # Miscellaneous alerts
+ Alert(
+ "enable",
+ "",
+ "",
+ AlertStatus.normal, AlertSize.none,
+ Priority.MID, None, "beepSingle", .2, 0., 0.),
+
+ Alert(
+ "disable",
+ "",
+ "",
+ AlertStatus.normal, AlertSize.none,
+ Priority.MID, None, "beepSingle", .2, 0., 0.),
+
+ Alert(
+ "fcw",
+ "BRAKE!",
+ "Risk of Collision",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "fcw", "chimeRepeated", 1., 2., 2.),
+
+ Alert(
+ "steerSaturated",
+ "TAKE CONTROL",
+ "Turn Exceeds Steering Limit",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.LOW, "steerRequired", "chimeSingle", 1., 2., 3.),
+
+ Alert(
+ "steerTempUnavailable",
+ "TAKE CONTROL",
+ "Steering Temporarily Unavailable",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.LOW, "steerRequired", "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "steerTempUnavailableMute",
+ "TAKE CONTROL",
+ "Steering Temporarily Unavailable",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.LOW, None, None, .2, .2, .2),
+
+ Alert(
+ "preDriverDistracted",
+ "KEEP EYES ON ROAD: User Appears Distracted",
+ "",
+ AlertStatus.normal, AlertSize.small,
+ Priority.LOW, "steerRequired", None, 0., .1, .1, alert_rate=0.75),
+
+ Alert(
+ "promptDriverDistracted",
+ "KEEP EYES ON ROAD",
+ "User Appears Distracted",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.MID, "steerRequired", "chimeRepeated", .1, .1, .1),
+
+ Alert(
+ "driverDistracted",
+ "DISENGAGE IMMEDIATELY",
+ "User Was Distracted",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGH, "steerRequired", "chimeRepeated", .1, .1, .1),
+
+ Alert(
+ "preDriverUnresponsive",
+ "TOUCH STEERING WHEEL: No Driver Monitoring",
+ "",
+ AlertStatus.normal, AlertSize.small,
+ Priority.LOW, "steerRequired", None, 0., .1, .1, alert_rate=0.75),
+
+ Alert(
+ "promptDriverUnresponsive",
+ "TOUCH STEERING WHEEL",
+ "User Is Unresponsive",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.MID, "steerRequired", "chimeRepeated", .1, .1, .1),
+
+ Alert(
+ "driverUnresponsive",
+ "DISENGAGE IMMEDIATELY",
+ "User Was Unresponsive",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGH, "steerRequired", "chimeRepeated", .1, .1, .1),
+
+ Alert(
+ "driverMonitorOff",
+ "DRIVER MONITOR IS UNAVAILABLE",
+ "Accuracy Is Low",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, None, .4, 0., 4.),
+
+ Alert(
+ "driverMonitorOn",
+ "DRIVER MONITOR IS AVAILABLE",
+ "Accuracy Is High",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, None, .4, 0., 4.),
+
+ Alert(
+ "geofence",
+ "DISENGAGEMENT REQUIRED",
+ "Not in Geofenced Area",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.HIGH, "steerRequired", "chimeRepeated", .1, .1, .1),
+
+ Alert(
+ "startup",
+ "Be ready to take over at any time",
+ "Always keep hands on wheel and eyes on road",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW_LOWEST, None, None, 0., 0., 15.),
+
+ Alert(
+ "ethicalDilemma",
+ "TAKE CONTROL IMMEDIATELY",
+ "Ethical Dilemma Detected",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ Alert(
+ "steerTempUnavailableNoEntry",
+ "openpilot Unavailable",
+ "Steering Temporarily Unavailable",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 0., 3.),
+
+ Alert(
+ "manualRestart",
+ "TAKE CONTROL",
+ "Resume Driving Manually",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.LOW, None, None, 0., 0., .2),
+
+ Alert(
+ "resumeRequired",
+ "STOPPED",
+ "Press Resume to Move",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.LOW, None, None, 0., 0., .2),
+
+ Alert(
+ "belowSteerSpeed",
+ "TAKE CONTROL",
+ "Steer Unavailable Below ",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.MID, "steerRequired", None, 0., 0., .1),
+
+ Alert(
+ "debugAlert",
+ "DEBUG ALERT",
+ "",
+ AlertStatus.userPrompt, AlertSize.mid,
+ Priority.LOW, None, None, .1, .1, .1),
+
+ # Non-entry only alerts
+ Alert(
+ "wrongCarModeNoEntry",
+ "openpilot Unavailable",
+ "Main Switch Off",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 0., 3.),
+
+ Alert(
+ "dataNeededNoEntry",
+ "openpilot Unavailable",
+ "Data Needed for Calibration. Upload Drive, Try Again",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 0., 3.),
+
+ Alert(
+ "outOfSpaceNoEntry",
+ "openpilot Unavailable",
+ "Out of Storage Space",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 0., 3.),
+
+ Alert(
+ "pedalPressedNoEntry",
+ "openpilot Unavailable",
+ "Pedal Pressed During Attempt",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, "brakePressed", "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "speedTooLowNoEntry",
+ "openpilot Unavailable",
+ "Speed Too Low",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "brakeHoldNoEntry",
+ "openpilot Unavailable",
+ "Brake Hold Active",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "parkBrakeNoEntry",
+ "openpilot Unavailable",
+ "Park Brake Engaged",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "lowSpeedLockoutNoEntry",
+ "openpilot Unavailable",
+ "Cruise Fault: Restart the Car",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "lowBatteryNoEntry",
+ "openpilot Unavailable",
+ "Low Battery",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ # Cancellation alerts causing soft disabling
+ Alert(
+ "overheat",
+ "TAKE CONTROL IMMEDIATELY",
+ "System Overheated",
+ AlertStatus.critical, AlertSize.full,
+ Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ Alert(
+ "wrongGear",
+ "TAKE CONTROL IMMEDIATELY",
+ "Gear not D",
+ AlertStatus.critical, AlertSize.full,
+ Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ Alert(
+ "calibrationInvalid",
+ "TAKE CONTROL IMMEDIATELY",
+ "Calibration Invalid: Reposition EON and Recalibrate",
+ AlertStatus.critical, AlertSize.full,
+ Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ Alert(
+ "calibrationIncomplete",
+ "TAKE CONTROL IMMEDIATELY",
+ "Calibration in Progress",
+ AlertStatus.critical, AlertSize.full,
+ Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ Alert(
+ "doorOpen",
+ "TAKE CONTROL IMMEDIATELY",
+ "Door Open",
+ AlertStatus.critical, AlertSize.full,
+ Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ Alert(
+ "seatbeltNotLatched",
+ "TAKE CONTROL IMMEDIATELY",
+ "Seatbelt Unlatched",
+ AlertStatus.critical, AlertSize.full,
+ Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ Alert(
+ "espDisabled",
+ "TAKE CONTROL IMMEDIATELY",
+ "ESP Off",
+ AlertStatus.critical, AlertSize.full,
+ Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ Alert(
+ "lowBattery",
+ "TAKE CONTROL IMMEDIATELY",
+ "Low Battery",
+ AlertStatus.critical, AlertSize.full,
+ Priority.MID, "steerRequired", "chimeRepeated", 1., 3., 3.),
+
+ # Cancellation alerts causing immediate disabling
+ Alert(
+ "radarCommIssue",
+ "TAKE CONTROL IMMEDIATELY",
+ "Radar Error: Restart the Car",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "radarFault",
+ "TAKE CONTROL IMMEDIATELY",
+ "Radar Error: Restart the Car",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "modelCommIssue",
+ "TAKE CONTROL IMMEDIATELY",
+ "Model Error: Check Internet Connection",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "controlsFailed",
+ "TAKE CONTROL IMMEDIATELY",
+ "Controls Failed",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "controlsMismatch",
+ "TAKE CONTROL IMMEDIATELY",
+ "Controls Mismatch",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "commIssue",
+ "TAKE CONTROL IMMEDIATELY",
+ "CAN Error: Check Connections",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "steerUnavailable",
+ "TAKE CONTROL IMMEDIATELY",
+ "LKAS Fault: Restart the Car",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "brakeUnavailable",
+ "TAKE CONTROL IMMEDIATELY",
+ "Cruise Fault: Restart the Car",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "gasUnavailable",
+ "TAKE CONTROL IMMEDIATELY",
+ "Gas Fault: Restart the Car",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "reverseGear",
+ "TAKE CONTROL IMMEDIATELY",
+ "Reverse Gear",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "cruiseDisabled",
+ "TAKE CONTROL IMMEDIATELY",
+ "Cruise Is Off",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ Alert(
+ "plannerError",
+ "TAKE CONTROL IMMEDIATELY",
+ "Planner Solution Error",
+ AlertStatus.critical, AlertSize.full,
+ Priority.HIGHEST, "steerRequired", "chimeRepeated", 1., 3., 4.),
+
+ # not loud cancellations (user is in control)
+ Alert(
+ "noTarget",
+ "openpilot Canceled",
+ "No close lead car",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.HIGH, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "speedTooLow",
+ "openpilot Canceled",
+ "Speed too low",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.HIGH, None, "chimeDouble", .4, 2., 3.),
+
+ # Cancellation alerts causing non-entry
+ Alert(
+ "overheatNoEntry",
+ "openpilot Unavailable",
+ "System overheated",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "wrongGearNoEntry",
+ "openpilot Unavailable",
+ "Gear not D",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "calibrationInvalidNoEntry",
+ "openpilot Unavailable",
+ "Calibration Invalid: Reposition EON and Recalibrate",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "calibrationIncompleteNoEntry",
+ "openpilot Unavailable",
+ "Calibration in Progress",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "doorOpenNoEntry",
+ "openpilot Unavailable",
+ "Door open",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "seatbeltNotLatchedNoEntry",
+ "openpilot Unavailable",
+ "Seatbelt unlatched",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "espDisabledNoEntry",
+ "openpilot Unavailable",
+ "ESP Off",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "geofenceNoEntry",
+ "openpilot Unavailable",
+ "Not in Geofenced Area",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.MID, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "radarCommIssueNoEntry",
+ "openpilot Unavailable",
+ "Radar Error: Restart the Car",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "radarFaultNoEntry",
+ "openpilot Unavailable",
+ "Radar Error: Restart the Car",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "modelCommIssueNoEntry",
+ "openpilot Unavailable",
+ "Model Error: Check Internet Connection",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "controlsFailedNoEntry",
+ "openpilot Unavailable",
+ "Controls Failed",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "commIssueNoEntry",
+ "openpilot Unavailable",
+ "CAN Error: Check Connections",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "steerUnavailableNoEntry",
+ "openpilot Unavailable",
+ "LKAS Fault: Restart the Car",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "brakeUnavailableNoEntry",
+ "openpilot Unavailable",
+ "Cruise Fault: Restart the Car",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "gasUnavailableNoEntry",
+ "openpilot Unavailable",
+ "Gas Error: Restart the Car",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "reverseGearNoEntry",
+ "openpilot Unavailable",
+ "Reverse Gear",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "cruiseDisabledNoEntry",
+ "openpilot Unavailable",
+ "Cruise is Off",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "noTargetNoEntry",
+ "openpilot Unavailable",
+ "No Close Lead Car",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ Alert(
+ "plannerErrorNoEntry",
+ "openpilot Unavailable",
+ "Planner Solution Error",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOW, None, "chimeDouble", .4, 2., 3.),
+
+ # permanent alerts
+ Alert(
+ "steerUnavailablePermanent",
+ "LKAS Fault: Restart the car to engage",
+ "",
+ AlertStatus.normal, AlertSize.small,
+ Priority.LOW_LOWEST, None, None, 0., 0., .2),
+
+ Alert(
+ "brakeUnavailablePermanent",
+ "Cruise Fault: Restart the car to engage",
+ "",
+ AlertStatus.normal, AlertSize.small,
+ Priority.LOW_LOWEST, None, None, 0., 0., .2),
+
+ Alert(
+ "lowSpeedLockoutPermanent",
+ "Cruise Fault: Restart the car to engage",
+ "",
+ AlertStatus.normal, AlertSize.small,
+ Priority.LOW_LOWEST, None, None, 0., 0., .2),
+
+ Alert(
+ "calibrationIncompletePermanent",
+ "Calibration in Progress: ",
+ "Drive Above ",
+ AlertStatus.normal, AlertSize.mid,
+ Priority.LOWEST, None, None, 0., 0., .2),
+ ]
}
def __init__(self):
@@ -565,6 +646,7 @@ class AlertManager(object):
ca = self.activealerts[0] if self.alertPresent() else None
# start with assuming no alerts
+ self.alert_type = ""
self.alert_text_1 = ""
self.alert_text_2 = ""
self.alert_status = AlertStatus.normal
@@ -581,6 +663,7 @@ class AlertManager(object):
self.visual_alert = ca.visual_alert
if ca.start_time + ca.duration_text > cur_time:
+ self.alert_type = ca.alert_type
self.alert_text_1 = ca.alert_text_1
self.alert_text_2 = ca.alert_text_2
self.alert_status = ca.alert_status
diff --git a/selfdrive/controls/lib/lateral_mpc/Makefile b/selfdrive/controls/lib/lateral_mpc/Makefile
index 65ebd876d2..97579e751c 100644
--- a/selfdrive/controls/lib/lateral_mpc/Makefile
+++ b/selfdrive/controls/lib/lateral_mpc/Makefile
@@ -4,6 +4,7 @@ CXX = clang++
PHONELIBS = ../../../../phonelibs
+UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
CFLAGS = -O3 -fPIC -I.
@@ -13,10 +14,12 @@ QPOASES_FLAGS = -I$(PHONELIBS)/qpoases -I$(PHONELIBS)/qpoases/INCLUDE -I$(PHONEL
ACADO_FLAGS = -I$(PHONELIBS)/acado/include -I$(PHONELIBS)/acado/include/acado
-ifeq ($(UNAME_M),aarch64)
-ACADO_LIBS := -L $(PHONELIBS)/acado/aarch64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a
+ifeq ($(UNAME_S),Darwin)
+ ACADO_LIBS := -lacado_toolkit_s
+else ifeq ($(UNAME_M),aarch64)
+ ACADO_LIBS := -L $(PHONELIBS)/acado/aarch64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a
else
-ACADO_LIBS := -L $(PHONELIBS)/acado/x64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a
+ ACADO_LIBS := -L $(PHONELIBS)/acado/x64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a
endif
OBJS = \
@@ -67,7 +70,7 @@ lib_qp/%.o: $(PHONELIBS)/qpoases/SRC/%.cpp
-c -o '$@' '$<'
generator: generator.cpp
- $(CXX) -Wall -std=c++11 \
+ $(CXX) -v -Wall -std=c++11 \
generator.cpp \
-o generator \
$(ACADO_FLAGS) \
diff --git a/selfdrive/controls/lib/longitudinal_mpc/Makefile b/selfdrive/controls/lib/longitudinal_mpc/Makefile
index 77718adfb4..17f78eada9 100644
--- a/selfdrive/controls/lib/longitudinal_mpc/Makefile
+++ b/selfdrive/controls/lib/longitudinal_mpc/Makefile
@@ -3,6 +3,7 @@ CXX = clang++
PHONELIBS = ../../../../phonelibs
+UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
CFLAGS = -O3 -fPIC -I.
@@ -12,10 +13,12 @@ QPOASES_FLAGS = -I$(PHONELIBS)/qpoases -I$(PHONELIBS)/qpoases/INCLUDE -I$(PHONEL
ACADO_FLAGS = -I$(PHONELIBS)/acado/include -I$(PHONELIBS)/acado/include/acado
-ifeq ($(UNAME_M),aarch64)
-ACADO_LIBS := -L $(PHONELIBS)/acado/aarch64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a
+ifeq ($(UNAME_S),Darwin)
+ ACADO_LIBS := -lacado_toolkit_s
+else ifeq ($(UNAME_M),aarch64)
+ ACADO_LIBS := -L $(PHONELIBS)/acado/aarch64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a
else
-ACADO_LIBS := -L $(PHONELIBS)/acado/x64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a
+ ACADO_LIBS := -L $(PHONELIBS)/acado/x64/lib -l:libacado_toolkit.a -l:libacado_casadi.a -l:libacado_csparse.a
endif
OBJS = \
diff --git a/selfdrive/controls/lib/planner.py b/selfdrive/controls/lib/planner.py
index e2defeeb93..89ca649504 100755
--- a/selfdrive/controls/lib/planner.py
+++ b/selfdrive/controls/lib/planner.py
@@ -44,9 +44,6 @@ _A_TOTAL_MAX_BP = [0., 20., 40.]
_FCW_A_ACT_V = [-3., -2.]
_FCW_A_ACT_BP = [0., 30.]
-# max acceleration allowed in acc, which happens in restart
-A_ACC_MAX = max(_A_CRUISE_MAX_V_FOLLOWING)
-
def calc_cruise_accel_limits(v_ego, following):
a_cruise_min = interp(v_ego, _A_CRUISE_MIN_BP, _A_CRUISE_MIN_V)
diff --git a/selfdrive/locationd/ubloxd.py b/selfdrive/locationd/ubloxd.py
index 5b597c5be7..08a2022950 100755
--- a/selfdrive/locationd/ubloxd.py
+++ b/selfdrive/locationd/ubloxd.py
@@ -142,14 +142,16 @@ def gen_solution(msg):
'longitude': msg_data['lon']*1e-07, # longitude in degrees
'speed': msg_data['gSpeed']*1e-03, # ground speed in meters
'accuracy': msg_data['hAcc']*1e-03, # horizontal accuracy (1 sigma?)
- 'timestamp': timestamp, # UTC time in ms since start of UTC stime
+ 'timestamp': timestamp, # UTC time in ms since start of UTC stime
'vNED': [msg_data['velN']*1e-03,
msg_data['velE']*1e-03,
msg_data['velD']*1e-03], # velocity in NED frame in m/s
'speedAccuracy': msg_data['sAcc']*1e-03, # speed accuracy in m/s
'verticalAccuracy': msg_data['vAcc']*1e-03, # vertical accuracy in meters
'bearingAccuracy': msg_data['headAcc']*1e-05, # heading accuracy in degrees
- 'source': 'ublox'}
+ 'source': 'ublox',
+ 'flags': msg_data['flags'],
+ }
return log.Event.new_message(gpsLocationExternal=gps_fix)
def gen_nav_data(msg, nav_frame_buffer):
diff --git a/selfdrive/loggerd/loggerd b/selfdrive/loggerd/loggerd
index 1db19dae1c..7a058b743f 100755
Binary files a/selfdrive/loggerd/loggerd and b/selfdrive/loggerd/loggerd differ
diff --git a/selfdrive/registration.py b/selfdrive/registration.py
index 4327ed3a87..9b7e6964ef 100644
--- a/selfdrive/registration.py
+++ b/selfdrive/registration.py
@@ -7,7 +7,10 @@ from common.api import api_get
from common.params import Params
def get_imei():
- return subprocess.check_output(["getprop", "oem.device.imeicache"]).strip()
+ ret = subprocess.check_output(["getprop", "oem.device.imeicache"]).strip()
+ if ret == "":
+ ret = "000000000000000"
+ return ret
def get_serial():
return subprocess.check_output(["getprop", "ro.serialno"]).strip()
diff --git a/selfdrive/sensord/gpsd b/selfdrive/sensord/gpsd
index 9d577af8d8..cc5d8d9eb8 100755
Binary files a/selfdrive/sensord/gpsd and b/selfdrive/sensord/gpsd differ
diff --git a/selfdrive/sensord/sensord b/selfdrive/sensord/sensord
index 94cb27d1cb..63e2ac82d6 100755
Binary files a/selfdrive/sensord/sensord and b/selfdrive/sensord/sensord differ
diff --git a/selfdrive/service_list.yaml b/selfdrive/service_list.yaml
index ae2351f581..c14f913f47 100644
--- a/selfdrive/service_list.yaml
+++ b/selfdrive/service_list.yaml
@@ -70,6 +70,7 @@ uiLayoutState: [8060, true]
frontEncodeIdx: [8061, true]
orbFeaturesSummary: [8062, true]
driverMonitoring: [8063, true]
+liveParameters: [8064, true]
testModel: [8040, false]
testLiveLocation: [8045, false]
diff --git a/selfdrive/visiond/visiond b/selfdrive/visiond/visiond
index 12a057bdda..471cd66f79 100755
Binary files a/selfdrive/visiond/visiond and b/selfdrive/visiond/visiond differ