dragonpilot 0.7.7.3

========================
* Fixed steering monitor timer param.
* Fixed screen frozen issue when "screen off while driving" toggle is enabled. (Thanks to @salmankhan, @stevej99, @bobbydough)
* Re-added Dev Mini UI. (Thanks to @Ninjaa)
* Added ability (dp_reset_live_param_on_start) to reset LiveParameters on each start. (Thanks @eisenheim)
* Fixed error cuased by enabling both dp_toyota_zss and dp_lqr at the same time. (Thanks to @bobbydough)
* Added ability (dp_gpxd) to export GPS track into GPX files (/sdcard/gpx_logs/). (Thanks to @mageymoo1)
* Used lane width estimate value from Germany. (Thanks to @arne182)
This commit is contained in:
Rick Lan
2020-08-21 11:51:42 +10:00
parent fc73a3b5ee
commit 899f68dabf
15 changed files with 275 additions and 56 deletions
+17
View File
@@ -1,3 +1,20 @@
dragonpilot 0.7.7.3
========================
* 修正方向盤監控。
* Fixed steering monitor timer param.
* 修正行駛時關閉畫面導致當機的錯誤。(感謝 @salmankhan, @stevej99, @bobbydough 回報)
* Fixed screen frozen issue when "screen off while driving" toggle is enabled. (Thanks to @salmankhan, @stevej99, @bobbydough)
* 加回 Dev Mini UI 開關。(感謝 @Ninjaa 建議)
* Re-added Dev Mini UI. (Thanks to @Ninjaa)
* 新增 (dp_reset_live_parameters_on_start) 每次發車重設 LiveParameters 值。(感謝 @eisenheim)
* Added ability (dp_reset_live_param_on_start) to reset LiveParameters on each start. (Thanks @eisenheim)
* 修正同時開啟 dp_toyota_zss 和 dp_lqr 產生的錯誤。(感謝 @bobbydough)
* Fixed error cuased by enabling both dp_toyota_zss and dp_lqr at the same time. (Thanks to @bobbydough)
* 新增 (dp_gpxd) 將 GPS 軌跡導出至 GPX 格式 (/sdcard/gpx_logs/)的功能。 (感謝 @mageymoo1)
* Added ability (dp_gpxd) to export GPS track into GPX files (/sdcard/gpx_logs/). (Thanks to @mageymoo1)
* 使用德國的車道寬度估算值。 (感謝 @arne182)
* Used lane width estimate value from Germany. (Thanks to @arne182)
dragonpilot 0.7.7.2
========================
* 加入 d_poly offset。 (感謝 @ShaneSmiskol)
+32
View File
@@ -1,3 +1,35 @@
2020-08-18 (0.7.7.0)
========================
* gpxd 不再切換至 GCJ-02 格式。(感謝 @arne182 建議)
* gpxd no longer switch to GCJ-02 format automatically. (Thanks to @arne182)
* 修正方向盤監控。
* Fixed steering monitor timer param.
* 修正行駛時關閉畫面導致當機的錯誤。(感謝 @salmankhan, @stevej99, @bobbydough 回報)
* Fixed screen frozen issue when "screen off while driving" toggle is enabled. (Thanks to @salmankhan, @stevej99, @bobbydough)
* 加回 Dev Mini UI 開關。(感謝 @Ninjaa 建議)
* Re-added Dev Mini UI. (Thanks to @Ninjaa)
2020-08-17 (0.7.7.0)
========================
* gpxd 只儲存高精度數據。(感謝 @arne182)
* gpxd now only stored high accuracy data. (Thanks to @arne182)
* gpxd 加入自動切換成 GCJ-02 格式。
* added ability to switch to GCJ-02 format in gpxd.
* 新增 (dp_reset_live_parameters_on_start) 每次發車重設 LiveParameters 值。(感謝 @eisenheim)
* Added ability (dp_reset_live_param_on_start) to reset LiveParameters on each start. (Thanks @eisenheim)
2020-08-12 (0.7.7.0)
========================
* 修正同時開啟 dp_toyota_zss 和 dp_lqr 產生的錯誤。(感謝 @bobbydough)
* Fixed error cuased by enabling both dp_toyota_zss and dp_lqr at the same time. (Thanks to @bobbydough)
2020-08-12 (0.7.7.0)
========================
* 新增 (dp_gpxd) 將 GPS 軌跡導出至 GPX 格式 (/sdcard/gpx_logs/)的功能。 (感謝 @mageymoo1)
* Added ability (dp_gpxd) to export GPS track into GPX files (/sdcard/gpx_logs/). (Thanks to @mageymoo1)
* 使用德國的車道寬度估算值。 (感謝 @arne182)
* Used lane width estimate value from Germany. (Thanks to @arne182)
2020-08-11 (0.7.7.0)
========================
* 加入 d_poly offset。 (感謝 @ShaneSmiskol)
Binary file not shown.
+34 -33
View File
@@ -2081,11 +2081,11 @@ struct DragonConf {
dpSteeringLimitAlert @12 :Bool;
dpSteeringOnSignal @13 :Bool;
dpSignalOffDelay @14 :UInt8;
dpAssistedLcMinMph @15 :UInt8;
dpAssistedLcMinMph @15 :Float32;
dpAutoLc @16 :Bool;
dpAutoLcCont @17 :Bool;
dpAutoLcMinMph @18 :UInt8;
dpAutoLcDelay @19 :UInt8;
dpAutoLcMinMph @18 :Float32;
dpAutoLcDelay @19 :Float32;
dpSlowOnCurve @20 :Bool;
dpAllowGas @21 :Bool;
dpMaxCtrlSpeed @22 :Float32;
@@ -2108,34 +2108,35 @@ struct DragonConf {
dpUiPath @39 :Bool;
dpUiLead @40 :Bool;
dpUiDev @41 :Bool;
dpUiBlinker @42 :Bool;
dpUiBrightness @43 :UInt8;
dpUiVolumeBoost @44 :Int8;
dpAppAutoUpdate @45 :Bool;
dpAppExtGps @46 :Bool;
dpAppTomtom @47 :Bool;
dpAppTomtomAuto @48 :Bool;
dpAppTomtomManual @49 :Int8;
dpAppAutonavi @50 :Bool;
dpAppAutonaviAuto @51 :Bool;
dpAppAutonaviManual @52 :Int8;
dpAppAegis @53 :Bool;
dpAppAegisAuto @54 :Bool;
dpAppAegisManual @55 :Int8;
dpAppMixplorer @56 :Bool;
dpAppMixplorerManual @57 :Int8;
dpToyotaLdw @58 :Bool;
dpToyotaSng @59 :Bool;
dpToyotaLowestCruiseOverride @60 :Bool;
dpToyotaLowestCruiseOverrideAt @61 :Float32;
dpToyotaLowestCruiseOverrideSpeed @62 :Float32;
dpIpAddr @63 :Text;
dpCameraOffset @64 :Int8;
dpLocale @65 :Text;
dpChargingCtrl @66 :Bool;
dpChargingAt @67 :UInt8;
dpDischargingAt @68 :UInt8;
dpIsUpdating @69 :Bool;
dpThermalStarted @70 :Bool;
dpThermalOverheat @71 :Bool;
dpUiDevMini @42 :Bool;
dpUiBlinker @43 :Bool;
dpUiBrightness @44 :UInt8;
dpUiVolumeBoost @45 :Int8;
dpAppAutoUpdate @46 :Bool;
dpAppExtGps @47 :Bool;
dpAppTomtom @48 :Bool;
dpAppTomtomAuto @49 :Bool;
dpAppTomtomManual @50 :Int8;
dpAppAutonavi @51 :Bool;
dpAppAutonaviAuto @52 :Bool;
dpAppAutonaviManual @53 :Int8;
dpAppAegis @54 :Bool;
dpAppAegisAuto @55 :Bool;
dpAppAegisManual @56 :Int8;
dpAppMixplorer @57 :Bool;
dpAppMixplorerManual @58 :Int8;
dpToyotaLdw @59 :Bool;
dpToyotaSng @60 :Bool;
dpToyotaLowestCruiseOverride @61 :Bool;
dpToyotaLowestCruiseOverrideAt @62 :Float32;
dpToyotaLowestCruiseOverrideSpeed @63 :Float32;
dpIpAddr @64 :Text;
dpCameraOffset @65 :Int8;
dpLocale @66 :Text;
dpChargingCtrl @67 :Bool;
dpChargingAt @68 :UInt8;
dpDischargingAt @69 :UInt8;
dpIsUpdating @70 :Bool;
dpThermalStarted @71 :Bool;
dpThermalOverheat @72 :Bool;
}
+8 -6
View File
@@ -22,6 +22,7 @@ confs = [
{'name': 'dp_upload_on_mobile', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_uploader', 'vals': [True]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_upload_on_hotspot', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_uploader', 'vals': [True]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_updated', 'default': True, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_gpxd', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_hotspot_on_boot', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# lat ctrl
{'name': 'dp_lat_ctrl', 'default': True, 'type': 'Bool', 'conf_type': ['param', 'struct']},
@@ -29,15 +30,15 @@ confs = [
{'name': 'dp_steering_on_signal', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_lat_ctrl', 'vals': [True]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_signal_off_delay', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 10, 'conf_type': ['param', 'struct']},
# assist/auto lane change
{'name': 'dp_assisted_lc_min_mph', 'default': 45, 'type': 'UInt8', 'min': 0, 'max': 255, 'conf_type': ['param', 'struct']},
{'name': 'dp_assisted_lc_min_mph', 'default': 45, 'type': 'Float32', 'min': 0, 'max': 255., 'conf_type': ['param', 'struct']},
{'name': 'dp_auto_lc', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_auto_lc_cont', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_auto_lc', 'vals': [True]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_auto_lc_min_mph', 'default': 60, 'type': 'UInt8', 'min': 0, 'max': 255, 'depends': [{'name': 'dp_auto_lc', 'vals': [True]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_auto_lc_delay', 'default': 3, 'type': 'UInt8', 'min': 0, 'max': 10, 'depends': [{'name': 'dp_auto_lc', 'vals': [True]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_auto_lc_min_mph', 'default': 60, 'type': 'Float32', 'min': 0, 'max': 255., 'depends': [{'name': 'dp_auto_lc', 'vals': [True]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_auto_lc_delay', 'default': 3, 'type': 'Float32', 'min': 0, 'max': 10., 'depends': [{'name': 'dp_auto_lc', 'vals': [True]}], 'conf_type': ['param', 'struct']},
# long ctrl
{'name': 'dp_slow_on_curve', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_atl', 'vals': [False]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_allow_gas', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_atl', 'vals': [False]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_max_ctrl_speed', 'default': 92, 'type': 'Float32', 'conf_type': ['param', 'struct']},
{'name': 'dp_max_ctrl_speed', 'default': 92., 'type': 'Float32', 'conf_type': ['param', 'struct']},
{'name': 'dp_lead_car_alert', 'default': False, 'type': 'Bool', 'conf_type': ['param', 'struct']},
{'name': 'dp_dynamic_follow', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 4, 'depends': [{'name': 'dp_atl', 'vals': [False]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_accel_profile', 'default': 0, 'type': 'UInt8', 'min': 0, 'max': 3, 'depends': [{'name': 'dp_atl', 'vals': [False]}], 'conf_type': ['param', 'struct']},
@@ -81,8 +82,8 @@ confs = [
{'name': 'dp_toyota_sng', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_atl', 'vals': [False]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_toyota_zss', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_toyota_lowest_cruise_override', 'default': False, 'type': 'Bool', 'depends': [{'name': 'dp_atl', 'vals': [False]}], 'conf_type': ['param', 'struct']},
{'name': 'dp_toyota_lowest_cruise_override_at', 'default': 44, 'type': 'Float32', 'depends': [{'name': 'dp_toyota_lowest_cruise_override', 'vals': [True]}], 'min': 44, 'max': 46, 'conf_type': ['param', 'struct']},
{'name': 'dp_toyota_lowest_cruise_override_speed', 'default': 32, 'type': 'Float32', 'depends': [{'name': 'dp_toyota_lowest_cruise_override_speed', 'vals': [True]}], 'min': 27, 'max': 44, 'conf_type': ['param', 'struct']},
{'name': 'dp_toyota_lowest_cruise_override_at', 'default': 44, 'type': 'Float32', 'depends': [{'name': 'dp_toyota_lowest_cruise_override', 'vals': [True]}], 'min': 0, 'max': 255., 'conf_type': ['param', 'struct']},
{'name': 'dp_toyota_lowest_cruise_override_speed', 'default': 32, 'type': 'Float32', 'depends': [{'name': 'dp_toyota_lowest_cruise_override_speed', 'vals': [True]}], 'min': 0, 'max': 255., 'conf_type': ['param', 'struct']},
# custom car
{'name': 'dp_car_selected', 'default': '', 'type': 'Text', 'conf_type': ['param']},
{'name': 'dp_car_list', 'default': '', 'type': 'Text', 'conf_type': ['param']},
@@ -104,6 +105,7 @@ confs = [
{'name': 'dp_sr_learner', 'default': True, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_lqr', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
{'name': 'dp_reset_live_param_on_start', 'default': False, 'type': 'Bool', 'conf_type': ['param']},
# including thermal data
{'name': 'dp_thermal_started', 'default': False, 'type': 'Bool', 'conf_type': ['struct']},
+2 -1
View File
@@ -296,7 +296,8 @@ class CarInterface(CarInterfaceBase):
if candidate == CAR.PRIUS and Params().get('dp_toyota_zss') == b'1':
ret.mass = 3370. * CV.LB_TO_KG + STD_CARGO_KG
ret.lateralTuning.indi.timeConstant = 0.1
if Params().get('dp_lqr') == b'0':
ret.lateralTuning.indi.timeConstant = 0.1
ret.steerRateCost = 0.5
# TODO: get actual value, for now starting with reasonable value for
+5 -3
View File
@@ -43,6 +43,7 @@ class Controls:
gc.disable()
set_realtime_priority(53)
set_core_affinity(3)
params = Params()
# Setup sockets
self.pm = pm
@@ -52,8 +53,10 @@ class Controls:
self.sm = sm
if self.sm is None:
self.sm = messaging.SubMaster(['dragonConf', 'thermal', 'health', 'frame', 'model', 'liveCalibration',
'dMonitoringState', 'plan', 'pathPlan', 'liveLocationKalman'])
socks = ['dragonConf', 'thermal', 'health', 'frame', 'model', 'liveCalibration',
'dMonitoringState', 'plan', 'pathPlan', 'liveLocationKalman']
ignore_alive = None if params.get('dp_driver_monitor') == b'1' else ['dMonitoringState']
self.sm = messaging.SubMaster(socks, ignore_alive=ignore_alive)
self.can_sock = can_sock
if can_sock is None:
@@ -69,7 +72,6 @@ class Controls:
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], has_relay)
# read params
params = Params()
self.is_metric = params.get("IsMetric", encoding='utf8') == "1"
self.is_ldw_enabled = params.get("IsLdwEnabled", encoding='utf8') == "1"
internet_needed = False #(params.get("Offroad_ConnectivityNeeded", encoding='utf8') is not None) and (params.get("DisableUpdates") != b"1")
+3 -3
View File
@@ -54,9 +54,9 @@ class LanePlanner():
self.p_poly = [0., 0., 0., 0.]
self.d_poly = [0., 0., 0., 0.]
self.lane_width_estimate = 3.7
self.lane_width_estimate = 2.85
self.lane_width_certainty = 1.0
self.lane_width = 3.7
self.lane_width = 2.85
self.l_prob = 0.
self.r_prob = 0.
@@ -103,7 +103,7 @@ class LanePlanner():
self.lane_width_certainty += 0.05 * (self.l_prob * self.r_prob - self.lane_width_certainty)
current_lane_width = abs(self.l_poly[3] - self.r_poly[3])
self.lane_width_estimate += 0.005 * (current_lane_width - self.lane_width_estimate)
speed_lane_width = interp(v_ego, [0., 31.], [2.8, 3.5])
speed_lane_width = interp(v_ego, [0., 14., 20.], [2.5, 3., 3.5]) # German Standards
self.lane_width = self.lane_width_certainty * self.lane_width_estimate + \
(1 - self.lane_width_certainty) * speed_lane_width
+153
View File
@@ -0,0 +1,153 @@
#!/usr/bin/env python3.7
'''
GPS cord converter: https://gist.github.com/jp1017/71bd0976287ce163c11a7cb963b04dd8
'''
import cereal.messaging as messaging
import os
import time
import datetime
import signal
import threading
import math
pi = 3.1415926535897932384626
x_pi = 3.14159265358979324 * 3000.0 / 180.0
a = 6378245.0
ee = 0.00669342162296594323
GPX_LOG_PATH = '/sdcard/gpx_logs/'
LOG_DELAY = 0.1 # secs, lower for higher accuracy, 0.1 seems fine
LOG_LENGTH = 30 # mins, higher means it keeps more data in the memory, will take more time to write into a file too.
LOST_SIGNAL_COUNT_LENGTH = 30 # secs, if we lost signal for this long, perform output to data
MIN_MOVE_SPEED_KMH = 5 # km/h, min speed to trigger logging
# do not change
LOST_SIGNAL_COUNT_MAX = LOST_SIGNAL_COUNT_LENGTH / LOG_DELAY # secs,
LOGS_PER_FILE = LOG_LENGTH * 60 / LOG_DELAY # e.g. 3 * 60 / 0.1 = 1800 points per file
MIN_MOVE_SPEED_MS = MIN_MOVE_SPEED_KMH / 3.6
class WaitTimeHelper:
ready_event = threading.Event()
shutdown = False
def __init__(self):
signal.signal(signal.SIGTERM, self.graceful_shutdown)
signal.signal(signal.SIGINT, self.graceful_shutdown)
signal.signal(signal.SIGHUP, self.graceful_shutdown)
def graceful_shutdown(self, signum, frame):
self.shutdown = True
self.ready_event.set()
def main():
# init
sm = messaging.SubMaster(['gpsLocationExternal'])
log_count = 0
logs = list()
lost_signal_count = 0
wait_helper = WaitTimeHelper()
started_time = datetime.datetime.utcnow().isoformat()
# outside_china_checked = False
# outside_china = False
while True:
sm.update()
if sm.updated['gpsLocationExternal']:
gps = sm['gpsLocationExternal']
# do not log when no fix or accuracy is too low, add lost_signal_count
if gps.flags % 2 == 0 or gps.accuracy > 5.:
if log_count > 0:
lost_signal_count += 1
else:
lng = gps.longitude
lat = gps.latitude
# if not outside_china_checked:
# outside_china = out_of_china(lng, lat)
# outside_china_checked = True
# if not outside_china:
# lng, lat = wgs84togcj02(lng, lat)
logs.append([datetime.datetime.utcfromtimestamp(gps.timestamp*0.001).isoformat(), lat, lng, gps.altitude])
log_count += 1
lost_signal_count = 0
'''
write to log if
1. reach per file limit
2. lost signal for a certain time (e.g. under cover car park?)
'''
if log_count > 0 and (log_count >= LOGS_PER_FILE or lost_signal_count >= LOST_SIGNAL_COUNT_MAX):
# output
to_gpx(logs, started_time)
lost_signal_count = 0
log_count = 0
logs.clear()
started_time = datetime.datetime.utcnow().isoformat()
time.sleep(LOG_DELAY)
if wait_helper.shutdown:
break
# when process end, we store any logs.
if log_count > 0:
to_gpx(logs, started_time)
'''
check to see if it's in china
'''
def out_of_china(lng, lat):
if lng < 72.004 or lng > 137.8347:
return True
elif lat < 0.8293 or lat > 55.8271:
return True
return False
def transform_lat(lng, lat):
ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * math.sqrt(abs(lng))
ret += (20.0 * math.sin(6.0 * lng * pi) + 20.0 * math.sin(2.0 * lng * pi)) * 2.0 / 3.0
ret += (20.0 * math.sin(lat * pi) + 40.0 * math.sin(lat / 3.0 * pi)) * 2.0 / 3.0
ret += (160.0 * math.sin(lat / 12.0 * pi) + 320 * math.sin(lat * pi / 30.0)) * 2.0 / 3.0
return ret
def transform_lng(lng, lat):
ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * math.sqrt(abs(lng))
ret += (20.0 * math.sin(6.0 * lng * pi) + 20.0 * math.sin(2.0 * lng * pi)) * 2.0 / 3.0
ret += (20.0 * math.sin(lng * pi) + 40.0 * math.sin(lng / 3.0 * pi)) * 2.0 / 3.0
ret += (150.0 * math.sin(lng / 12.0 * pi) + 300.0 * math.sin(lng / 30.0 * pi)) * 2.0 / 3.0
return ret
'''
Convert wgs84 to gcj02 (
'''
def wgs84togcj02(lng, lat):
if out_of_china(lng, lat):
return lng, lat
dlat = transform_lat(lng - 105.0, lat - 35.0)
dlng = transform_lng(lng - 105.0, lat - 35.0)
radlat = lat / 180.0 * pi
magic = math.sin(radlat)
magic = 1 - ee * magic * magic
sqrtmagic = math.sqrt(magic)
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi)
dlng = (dlng * 180.0) / (a / sqrtmagic * math.cos(radlat) * pi)
mglat = lat + dlat
mglng = lng + dlng
return mglng, mglat
'''
write logs to a gpx file
'''
def to_gpx(logs, filename):
if not os.path.exists(GPX_LOG_PATH):
os.makedirs(GPX_LOG_PATH)
with open('%s%sZ.gpx' % (GPX_LOG_PATH, filename.replace(':','-')), 'w') as f:
f.write("%s\n" % '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>')
f.write("%s\n" % '<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1">')
f.write("\t<trk>\n")
f.write("\t\t<trkseg>\n")
for trkpt in logs:
f.write("\t\t\t<trkpt time=\"%sZ\" lat=\"%s\" lon=\"%s\" ele=\"%s\" />\n" % (trkpt[0], trkpt[1], trkpt[2], trkpt[3]))
f.write("\t\t</trkseg>\n")
f.write("\t</trk>\n")
f.write("%s\n" % '</gpx>')
if __name__ == "__main__":
main()
+1 -1
View File
@@ -82,7 +82,7 @@ def main(sm=None, pm=None):
CP = car.CarParams.from_bytes(params_reader.get("CarParams", block=True))
cloudlog.info("paramsd got CarParams")
params = params_reader.get("LiveParameters")
params = params_reader.get("LiveParameters") if params_reader.get('dp_reset_live_param_on_start') == b'0' else None
# Check if car model matches
if params is not None:
+8 -5
View File
@@ -202,6 +202,7 @@ managed_processes = {
"driverview": "selfdrive.monitoring.driverview",
"systemd": "selfdrive.dragonpilot.systemd",
"appd": "selfdrive.dragonpilot.appd",
"gpxd": "selfdrive.dragonpilot.gpxd",
}
daemon_processes = {
@@ -267,6 +268,7 @@ if ANDROID:
'clocksd',
'gpsd',
'dmonitoringmodeld',
'gpxd',
]
def register_managed_process(name, desc, car_started=False):
@@ -590,18 +592,19 @@ def main():
# dp
del managed_processes['tombstoned']
if params.get("dp_logger") == b'0':
if params.get("dp_logger") == b'0' or \
params.get("dp_atl") == b'1' or \
params.get("dp_steering_monitor") == b'0':
del managed_processes['loggerd']
del managed_processes['logmessaged']
del managed_processes['proclogd']
del managed_processes['logcatd']
del managed_processes['deleter']
if params.get("dp_uploader") == b'0' or \
params.get("dp_atl") == b'1' or \
params.get("dp_steering_monitor") == b'0':
if params.get("dp_uploader") == b'0':
del managed_processes['uploader']
if params.get("dp_updated") == b'0':
del managed_processes['updated']
if params.get('dp_gpxd') == b'0':
del managed_processes['gpxd']
# SystemExit on sigterm
signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(1))
+6
View File
@@ -8,6 +8,8 @@ from selfdrive.controls.lib.events import Events
from selfdrive.monitoring.driver_monitor import DriverStatus, MAX_TERMINAL_ALERTS, MAX_TERMINAL_DURATION
from selfdrive.locationd.calibration_helpers import Calibration
from common.realtime import DT_DMON
from common.realtime import sec_since_boot
import time
def dmonitoringd_thread(sm=None, pm=None):
gc.disable()
@@ -51,6 +53,7 @@ def dmonitoringd_thread(sm=None, pm=None):
# 10Hz <- dmonitoringmodeld
while True:
start_time = sec_since_boot()
sm.update()
# dp
@@ -121,6 +124,9 @@ def dmonitoringd_thread(sm=None, pm=None):
"isPreview": False,
}
pm.send('dMonitoringState', dat)
diff = sec_since_boot() - start_time
if not sm['dragonConf'].dpDriverMonitor and diff < 0.1:
time.sleep(0.1-diff)
def main(sm=None, pm=None):
dmonitoringd_thread(sm, pm)
+1 -1
View File
@@ -1063,7 +1063,7 @@ static void ui_draw_vision_footer(UIState *s) {
if (s->scene.dpUiDev) {
ui_draw_bbui(s);
}
if (s->scene.dpUiDev || s->scene.dpDashcam || s->scene.dpAppWaze) {
if (s->scene.dpUiDevMini) {
ui_draw_infobar(s);
}
+4 -3
View File
@@ -334,7 +334,7 @@ void handle_message(UIState *s, SubMaster &sm) {
if (alert_sound == AudibleAlert::NONE) {
s->sound.stop();
} else {
if (s->scene.dpUiScreenOffDriving) {
if (s->scene.dpUiScreenOffDriving && !s->awake) {
set_awake(s, true);
}
s->sound.play(alert_sound);
@@ -446,6 +446,7 @@ void handle_message(UIState *s, SubMaster &sm) {
scene.dpUiPath = data.getDpUiPath();
scene.dpUiLead = data.getDpUiLead();
scene.dpUiDev = data.getDpUiDev();
scene.dpUiDevMini = data.getDpUiDevMini();
scene.dpUiBlinker = data.getDpUiBlinker();
scene.dpUiBrightness = data.getDpUiBrightness();
scene.dpUiVolumeBoost = data.getDpUiVolumeBoost();
@@ -843,7 +844,7 @@ int main(int argc, char* argv[]) {
// dp
s->scene.dp_alert_rate = 0;
s->scene.dp_alert_type = 1;
if (s->scene.dpUiScreenOffDriving) {
if (s->scene.dpUiScreenOffDriving && !s->awake) {
set_awake(s, true);
}
@@ -954,7 +955,7 @@ int main(int argc, char* argv[]) {
if (s->controls_timeout > 0) {
s->controls_timeout--;
} else if (s->started) {
} else if (s->started && !s->scene.dpUiScreenOffReversing && !s->scene.dpUiScreenOffDriving) {
if (!s->controls_seen) {
// car is started, but controlsState hasn't been seen at all
s->scene.alert_text1 = "openpilot Unavailable";
+1
View File
@@ -159,6 +159,7 @@ typedef struct UIScene {
bool dpUiPath;
bool dpUiLead;
bool dpUiDev;
bool dpUiDevMini;
bool dpUiBlinker;
int dpUiBrightness;
int dpUiVolumeBoost;