diff --git a/apk/com.autonavi.amapauto.apk b/apk/com.autonavi.amapauto.apk index 2242b3b30..db98c7aec 100644 Binary files a/apk/com.autonavi.amapauto.apk and b/apk/com.autonavi.amapauto.apk differ diff --git a/apk/com.mixplorer.apk b/apk/com.mixplorer.apk index 592de47d9..bd69f9c98 100644 Binary files a/apk/com.mixplorer.apk and b/apk/com.mixplorer.apk differ diff --git a/cereal/car.capnp b/cereal/car.capnp index 976a7ac91..4a5cfd0b8 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -87,6 +87,7 @@ struct CarEvent @0x9b1657f34caf3ad3 { manualSteeringRequired @62; manualSteeringRequiredBlinkersOn @63; leadCarMoving @64; + leadCarDetected @65; } } diff --git a/selfdrive/can/process_dbc.py b/selfdrive/can/process_dbc.py index c1da3ce45..dc544f741 100755 --- a/selfdrive/can/process_dbc.py +++ b/selfdrive/can/process_dbc.py @@ -28,7 +28,7 @@ def main(): msgs = [(address, msg_name, msg_size, sorted(msg_sigs, key=lambda s: s.name not in ("COUNTER", "CHECKSUM"))) # process counter and checksums first for address, ((msg_name, msg_size), msg_sigs) in sorted(can_dbc.msgs.items()) if msg_sigs] - def_vals = {a: set(b) for a,b in can_dbc.def_vals.items()} #remove duplicates + def_vals = {a: sorted(set(b)) for a, b in can_dbc.def_vals.items()} # remove duplicates def_vals = sorted(def_vals.items()) if can_dbc.name.startswith(("honda_", "acura_")): diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index c708b9b4b..10cd731b1 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -198,7 +198,12 @@ FINGERPRINTS = { # 2019 Taiwan Altis Hybrid { 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 765: 8, 800: 8, 810: 2, 829: 2, 830: 7, 835: 8, 836: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 885: 8, 896: 8, 898: 8, 918: 7, 921: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 987: 8, 993: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1082: 8, 1112: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1172: 8, 1235: 8, 1237: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1745: 8, 1775: 8, 1779: 8 - }], + }, + # 2019 Chinese Levin Hybrid + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 401: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 643: 7, 713: 8, 728: 8, 740: 5, 742: 8, 743: 8, 761: 8, 765: 8, 800: 8, 810: 2, 812: 8, 829: 2, 830: 7, 835: 8, 836: 8, 865: 8, 869: 7, 870: 7, 871: 2, 877: 8, 881: 8, 885: 8, 896: 8, 898: 8, 921: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 993: 8, 1002: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1172: 8, 1235: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1594: 8, 1595: 8, 1600: 8, 1649: 8, 1745: 8, 1775: 8, 1779: 8 + } + ], CAR.LEXUS_ES_TSS2: [ { # 2019 Lexus ES200 from Shell diff --git a/selfdrive/common/visionbuf_cl.c b/selfdrive/common/visionbuf_cl.c new file mode 100644 index 000000000..58c66a854 --- /dev/null +++ b/selfdrive/common/visionbuf_cl.c @@ -0,0 +1,89 @@ +#include "visionbuf.h" + +#include +#include +#include + +#ifdef __APPLE__ +#include +#else +#include +#endif + +VisionBuf visionbuf_allocate(size_t len) { + // const size_t alignment = 4096; + // void* addr = aligned_alloc(alignment, alignment * ((len - 1) / alignment + 1)); + void* addr = calloc(1, len); + + return (VisionBuf){ + .len = len, .addr = addr, .handle = 1, .fd = -1, + }; +} + +cl_mem visionbuf_to_cl(const VisionBuf* buf, cl_device_id device_id, cl_context ctx) { + // HACK because this platform is just for convenience + VisionBuf *w_buf = (VisionBuf*)buf; + cl_mem ret; + *w_buf = visionbuf_allocate_cl(buf->len, device_id, ctx, &ret); + return ret; +} + +VisionBuf visionbuf_allocate_cl(size_t len, cl_device_id device_id, cl_context ctx, cl_mem *out_mem) { + int err; + assert(out_mem); + +#if __OPENCL_VERSION__ >= 200 + void* host_ptr = + clSVMAlloc(ctx, CL_MEM_READ_WRITE | CL_MEM_SVM_FINE_GRAIN_BUFFER, len, 0); + assert(host_ptr); +#else + void* host_ptr = calloc(1, len); + + cl_command_queue q = clCreateCommandQueue(ctx, device_id, 0, &err); + assert(err == 0); +#endif + + cl_mem mem = clCreateBuffer(ctx, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, len, host_ptr, &err); + assert(err == 0); + + *out_mem = mem; + + return (VisionBuf){ + .len = len, .addr = host_ptr, .handle = 0, .fd = -1, + .device_id = device_id, .ctx = ctx, .buf_cl = mem, + +#if __OPENCL_VERSION__ < 200 + .copy_q = q, +#endif + + }; +} + +void visionbuf_sync(const VisionBuf* buf, int dir) { + int err = 0; + if (!buf->buf_cl) return; + +#if __OPENCL_VERSION__ < 200 + if (dir == VISIONBUF_SYNC_FROM_DEVICE) { + err = clEnqueueReadBuffer(buf->copy_q, buf->buf_cl, CL_FALSE, 0, buf->len, buf->addr, 0, NULL, NULL); + } else { + err = clEnqueueWriteBuffer(buf->copy_q, buf->buf_cl, CL_FALSE, 0, buf->len, buf->addr, 0, NULL, NULL); + } + assert(err == 0); + clFinish(buf->copy_q); +#endif +} + +void visionbuf_free(const VisionBuf* buf) { + if (buf->handle) { + free(buf->addr); + } else { + int err = clReleaseMemObject(buf->buf_cl); + assert(err == 0); +#if __OPENCL_VERSION__ >= 200 + clSVMFree(buf->ctx, buf->addr); +#else + free(buf->addr); +#endif + } +} diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 846a3c5f4..5bbfc9516 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -575,8 +575,11 @@ def controlsd_thread(sm=None, pm=None, can_sock=None): # when we detect lead car over a sec and the lead car is started moving, we are ready to send alerts # once the condition is triggered, we want to keep the trigger - if dragon_stopped_has_lead_count >= 50 and abs(sm['plan'].vTargetFuture) >= 0.1: - events.append(create_event('leadCarMoving', [ET.WARNING])) + if dragon_stopped_has_lead_count >= 50: + if abs(sm['plan'].vTargetFuture) >= 0.1: + events.append(create_event('leadCarMoving', [ET.WARNING])) + else: + events.append(create_event('leadCarDetected', [ET.WARNING])) # we remove alert once our car is moving if CS.vEgo > 0.: diff --git a/selfdrive/controls/lib/alerts.py b/selfdrive/controls/lib/alerts.py index c6e58226e..0337a85f2 100644 --- a/selfdrive/controls/lib/alerts.py +++ b/selfdrive/controls/lib/alerts.py @@ -740,8 +740,14 @@ ALERTS = [ Priority.LOW, VisualAlert.none, AudibleAlert.none, .0, .1, .1, alert_rate=0.25), Alert( "leadCarMoving", - "LEAD CAR IS MOVING", - "Resume Driving Manually", - AlertStatus.userPrompt, AlertSize.mid, + "Lead Car Is Moving", + "", + AlertStatus.userPrompt, AlertSize.small, Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, .1, .1), + Alert( + "leadCarDetected", + "Lead Car Detected", + "", + AlertStatus.normal, AlertSize.small, + Priority.LOW, VisualAlert.none, AudibleAlert.none, .0, .1, .1, alert_rate=0.25), ] diff --git a/selfdrive/dragonpilot/appd/appd.py b/selfdrive/dragonpilot/appd/appd.py index df0140971..d1e04ba58 100644 --- a/selfdrive/dragonpilot/appd/appd.py +++ b/selfdrive/dragonpilot/appd/appd.py @@ -14,11 +14,11 @@ params = Params() tomtom = "com.tomtom.speedcams.android.map" tomtom_main = "com.tomtom.speedcams.android.activities.SpeedCamActivity" -# v4.3.0.600100 Beta +# v4.3.0.600310 R2098NSLAE autonavi = "com.autonavi.amapauto" autonavi_main = "com.autonavi.amapauto.MainMapActivity" -# v6.39.2 +# v6.40.3 mixplorer = "com.mixplorer" mixplorer_main = "com.mixplorer.activities.BrowseActivity" diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 6517f9645..c9f8f4198 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -385,8 +385,8 @@ def manager_thread(): running_list = [" running %s %s" % (p, running[p]) for p in running] cloudlog.debug('\n'.join(running_list)) - # is this still needed? - if params.get("DoUninstall") == "1": + # Exit main loop when uninstall is needed + if params.get("DoUninstall", encoding='utf8') == "1": break def get_installed_apks(): @@ -572,7 +572,7 @@ def main(): finally: cleanup_all_processes(None, None) - if params.get("DoUninstall") == "1": + if params.get("DoUninstall", encoding='utf8') == "1": uninstall() if __name__ == "__main__": diff --git a/selfdrive/thermald.py b/selfdrive/thermald.py index 878e32f9d..23d1fa0d0 100755 --- a/selfdrive/thermald.py +++ b/selfdrive/thermald.py @@ -217,11 +217,10 @@ def thermald_thread(): max_comp_temp = max(max_cpu_temp, msg.thermal.mem / 10., msg.thermal.gpu / 10.) bat_temp = msg.thermal.bat/1000. - if health is not None: - if health.health.hwType == log.HealthData.HwType.uno: - fan_speed = handle_fan_uno(max_cpu_temp, bat_temp, fan_speed) - else: - fan_speed = handle_fan_eon(max_cpu_temp, bat_temp, fan_speed) + if health is not None and health.health.hwType == log.HealthData.HwType.uno: + fan_speed = handle_fan_uno(max_cpu_temp, bat_temp, fan_speed) + else: + fan_speed = handle_fan_eon(max_cpu_temp, bat_temp, fan_speed) msg.thermal.fanSpeed = fan_speed diff --git a/selfdrive/visiond/build_from_src.mk b/selfdrive/visiond/build_from_src.mk index 639f0a95d..725b345fa 100644 --- a/selfdrive/visiond/build_from_src.mk +++ b/selfdrive/visiond/build_from_src.mk @@ -54,9 +54,9 @@ else OPENCL_LIBS = -lOpenCL - TF_FLAGS = -I$(EXTERNAL)/tensorflow/include - TF_LIBS = -L$(EXTERNAL)/tensorflow/lib -ltensorflow \ - -Wl,-rpath $(EXTERNAL)/tensorflow/lib + #TF_FLAGS = -I$(EXTERNAL)/tensorflow/include + #TF_LIBS = -L$(EXTERNAL)/tensorflow/lib -ltensorflow \ + # -Wl,-rpath $(EXTERNAL)/tensorflow/lib SNPE_FLAGS = -I$(PHONELIBS)/snpe/include/ SNPE_LIBS = -L$(PHONELIBS)/snpe/x86_64-linux-clang/ \ @@ -69,7 +69,7 @@ else PLATFORM_OBJS = cameras/camera_frame_stream.o \ ../common/visionbuf_cl.o \ ../common/visionimg.o \ - runners/tfmodel.o + # runners/tfmodel.o endif SSL_FLAGS = -I/usr/include/openssl/ diff --git a/selfdrive/visiond/cameras/camera_frame_stream.h b/selfdrive/visiond/cameras/camera_frame_stream.h index 6351a183d..5cb7e27c5 100644 --- a/selfdrive/visiond/cameras/camera_frame_stream.h +++ b/selfdrive/visiond/cameras/camera_frame_stream.h @@ -33,6 +33,8 @@ typedef struct CameraState { int fps; float digital_gain; + float cur_gain_frac; + mat3 transform; } CameraState;