mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-24 23:42:05 +08:00
Merge branch 'devel-en' into devel-zht
This commit is contained in:
@@ -93,10 +93,10 @@ def fingerprint(logcan, sendcan, has_relay):
|
||||
car_fingerprint = None
|
||||
done = False
|
||||
|
||||
if params.get("DragonCacheCar") == "1" and params.get("DragonCachedFP") != "" and params.get("DragonCachedModel") != "":
|
||||
car_fingerprint = pickle.loads(params.get("DragonCachedModel"))
|
||||
finger = pickle.loads(params.get("DragonCachedFP"))
|
||||
vin = pickle.loads(params.get("DragonCachedVIN"))
|
||||
if params.get("DragonCacheCar", encoding='utf8') == "1" and params.get("DragonCachedFP", encoding='utf8') != "" and params.get("DragonCachedModel", encoding='utf8') != "":
|
||||
car_fingerprint = pickle.loads(params.get("DragonCachedModel", encoding='utf8'))
|
||||
finger = pickle.loads(params.get("DragonCachedFP", encoding='utf8'))
|
||||
vin = pickle.loads(params.get("DragonCachedVIN", encoding='utf8'))
|
||||
done = True
|
||||
|
||||
while not done:
|
||||
@@ -134,9 +134,9 @@ def fingerprint(logcan, sendcan, has_relay):
|
||||
frame += 1
|
||||
|
||||
if succeeded:
|
||||
put_nonblocking("DragonCachedModel", pickle.dumps(car_fingerprint))
|
||||
put_nonblocking("DragonCachedFP", pickle.dumps(finger))
|
||||
put_nonblocking("DragonCachedVIN", pickle.dumps(vin))
|
||||
put_nonblocking("DragonCachedModel", pickle.dumps(car_fingerprint.encode('utf8')))
|
||||
put_nonblocking("DragonCachedFP", pickle.dumps(finger.encode('utf8')))
|
||||
put_nonblocking("DragonCachedVIN", pickle.dumps(vin.encode('utf8')))
|
||||
|
||||
cloudlog.warning("fingerprinted %s", car_fingerprint)
|
||||
return car_fingerprint, finger, vin
|
||||
|
||||
@@ -96,9 +96,9 @@ class CarController():
|
||||
hud_v_cruise, hud_show_lanes, hud_show_car, hud_alert):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
if frame % 500 == 0:
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl") == "0" else True
|
||||
self.dragon_enable_steering_on_signal = True if params.get("DragonEnableSteeringOnSignal", encoding='utf8') == "1" else False
|
||||
self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl", encoding='utf8') == "0" else True
|
||||
|
||||
# *** apply brake hysteresis ***
|
||||
brake, self.braking, self.brake_steady = actuator_hystereses(actuators.brake, self.braking, self.brake_steady, CS.v_ego, CS.CP.carFingerprint)
|
||||
@@ -194,10 +194,11 @@ class CarController():
|
||||
gasPressed = CS.pedal_gas > 0
|
||||
else:
|
||||
gasPressed = CS.user_gas_pressed
|
||||
dragon_apply_brake = apply_brake
|
||||
if self.dragon_allow_gas and gasPressed:
|
||||
apply_brake = 0
|
||||
dragon_apply_brake = 0
|
||||
apply_gas = 0
|
||||
can_sends.append(hondacan.create_brake_command(self.packer, apply_brake, pump_on,
|
||||
can_sends.append(hondacan.create_brake_command(self.packer, dragon_apply_brake, pump_on,
|
||||
pcm_override, pcm_cancel_cmd, hud.fcw, idx, CS.CP.carFingerprint, CS.CP.isPandaBlack))
|
||||
self.apply_brake_last = apply_brake
|
||||
|
||||
|
||||
@@ -383,9 +383,9 @@ class CarInterface(CarInterfaceBase):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - self.ts_last_check > 5.:
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl") == "0" else True
|
||||
self.dragon_enable_steering_on_signal = True if params.get("DragonEnableSteeringOnSignal", encoding='utf8') == "1" else True
|
||||
self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl", encoding='utf8') == "0" else True
|
||||
self.ts_last_check = ts
|
||||
|
||||
# ******************* do can recv *******************
|
||||
|
||||
@@ -129,10 +129,10 @@ class CarController():
|
||||
right_line, lead, left_lane_depart, right_lane_depart):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
if frame % 500 == 0:
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl") == "0" else True
|
||||
self.dragon_lane_departure_warning = False if params.get("DragonToyotaLaneDepartureWarning") == "0" else True
|
||||
self.dragon_enable_steering_on_signal = True if params.get("DragonEnableSteeringOnSignal", encoding='utf8') == "1" else False
|
||||
self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl", encoding='utf8') == "0" else True
|
||||
self.dragon_lane_departure_warning = False if params.get("DragonToyotaLaneDepartureWarning", encoding='utf8') == "0" else True
|
||||
|
||||
# *** compute control surfaces ***
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ class CarState():
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - self.ts_last_check > 5.:
|
||||
self.dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
|
||||
self.dragon_toyota_stock_dsu = True if params.get("DragonToyotaStockDSU", encoding='utf8') == "1" else False
|
||||
self.ts_last_check = ts
|
||||
|
||||
# update prevs, update must run once per loop
|
||||
|
||||
@@ -309,10 +309,10 @@ class CarInterface(CarInterfaceBase):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - self.ts_last_check > 5.:
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.dragon_toyota_stock_dsu = True if params.get("DragonToyotaStockDSU") == "1" else False
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl") == "0" else True
|
||||
self.dragon_enable_steering_on_signal = True if params.get("DragonEnableSteeringOnSignal", encoding='utf8') == "1" else False
|
||||
self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False
|
||||
self.dragon_toyota_stock_dsu = True if params.get("DragonToyotaStockDSU", encoding='utf8') == "1" else False
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl", encoding='utf8') == "0" else True
|
||||
self.ts_last_check = ts
|
||||
|
||||
# ******************* do can recv *******************
|
||||
|
||||
@@ -526,9 +526,9 @@ def controlsd_thread(sm=None, pm=None, can_sock=None):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - ts_last_check > 5.:
|
||||
dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
|
||||
dragon_lat_control = False if params.get("DragonLatCtrl") == "0" else True
|
||||
dragon_display_steering_limit_alert = False if params.get("DragonDisplaySteeringLimitAlert") == "0" else True
|
||||
dragon_toyota_stock_dsu = True if params.get("DragonToyotaStockDSU", encoding='utf8') == "1" else False
|
||||
dragon_lat_control = False if params.get("DragonLatCtrl", encoding='utf8') == "0" else True
|
||||
dragon_display_steering_limit_alert = False if params.get("DragonDisplaySteeringLimitAlert", encoding='utf8') == "0" else True
|
||||
ts_last_check = ts
|
||||
|
||||
start_time = sec_since_boot()
|
||||
|
||||
@@ -97,10 +97,10 @@ class DriverStatus():
|
||||
self.is_rhd_region_checked = False
|
||||
|
||||
# dragonpilot
|
||||
self.awareness_time = float(params.get("DragonSteeringMonitorTimer"))
|
||||
self.awareness_time = float(params.get("DragonSteeringMonitorTimer", encoding='utf8'))
|
||||
self.awareness_time = 86400 if self.awareness_time <= 0. else self.awareness_time * 60.
|
||||
self.dragon_enable_driver_safety_check = False if params.get("DragonEnableDriverSafetyCheck") == "0" else True
|
||||
self.dragon_enable_driver_monitoring = False if params.get("DragonEnableDriverMonitoring") == "0" else True
|
||||
self.dragon_enable_driver_safety_check = False if params.get("DragonEnableDriverSafetyCheck", encoding='utf8') == "0" else True
|
||||
self.dragon_enable_driver_monitoring = False if params.get("DragonEnableDriverMonitoring", encoding='utf8') == "0" else True
|
||||
|
||||
self._set_timers(active_monitoring=True)
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class LanePlanner():
|
||||
def update_lane(self, v_ego):
|
||||
ts = sec_since_boot()
|
||||
if ts - self.ts_last_check > 5.:
|
||||
self.camera_offset = int(params.get("DragonCameraOffset")) * 0.01
|
||||
self.camera_offset = int(params.get("DragonCameraOffset", encoding='utf8')) * 0.01
|
||||
self.ts_last_check = ts
|
||||
# only offset left and right lane lines; offsetting p_poly does not make sense
|
||||
self.l_poly[3] += self.camera_offset
|
||||
|
||||
@@ -27,12 +27,12 @@ gpsservice_main = "cn.dragonpilot.gpsservice.MainService"
|
||||
|
||||
def main(gctx=None):
|
||||
|
||||
dragon_enable_tomtom = True if params.get('DragonEnableTomTom') == "1" else False
|
||||
dragon_enable_autonavi = True if params.get('DragonEnableAutonavi') == "1" else False
|
||||
dragon_enable_mixplorer = True if params.get('DragonEnableMixplorer') == "1" else False
|
||||
dragon_boot_tomtom = True if params.get("DragonBootTomTom") == "1" else False
|
||||
dragon_boot_autonavi = True if params.get("DragonBootAutonavi") == "1" else False
|
||||
dragon_greypanda_mode = True if params.get("DragonGreyPandaMode") == "1" else False
|
||||
dragon_enable_tomtom = True if params.get('DragonEnableTomTom', encoding='utf8') == "1" else False
|
||||
dragon_enable_autonavi = True if params.get('DragonEnableAutonavi', encoding='utf8') == "1" else False
|
||||
dragon_enable_mixplorer = True if params.get('DragonEnableMixplorer', encoding='utf8') == "1" else False
|
||||
dragon_boot_tomtom = True if params.get("DragonBootTomTom", encoding='utf8') == "1" else False
|
||||
dragon_boot_autonavi = True if params.get("DragonBootAutonavi", encoding='utf8') == "1" else False
|
||||
dragon_greypanda_mode = True if params.get("DragonGreyPandaMode", encoding='utf8') == "1" else False
|
||||
dragon_grepanda_mode_started = False
|
||||
tomtom_is_running = False
|
||||
autonavi_is_running = False
|
||||
@@ -61,24 +61,24 @@ def main(gctx=None):
|
||||
|
||||
# allow user to manually start/stop app
|
||||
if dragon_enable_tomtom:
|
||||
status = params.get('DragonRunTomTom')
|
||||
status = params.get('DragonRunTomTom', encoding='utf8')
|
||||
if not status == "0":
|
||||
tomtom_is_running = exec_app(status, tomtom, tomtom_main)
|
||||
params.put('DragonRunTomTom', '0')
|
||||
put_nonblocking('DragonRunTomTom', '0')
|
||||
manual_tomtom = status != "0"
|
||||
|
||||
if dragon_enable_autonavi:
|
||||
status = params.get('DragonRunAutonavi')
|
||||
status = params.get('DragonRunAutonavi', encoding='utf8')
|
||||
if not status == "0":
|
||||
autonavi_is_running = exec_app(status, autonavi, autonavi_main)
|
||||
params.put('DragonRunAutonavi', '0')
|
||||
put_nonblocking('DragonRunAutonavi', '0')
|
||||
manual_autonavi = status != "0"
|
||||
|
||||
if dragon_enable_mixplorer:
|
||||
status = params.get('DragonRunMixplorer')
|
||||
status = params.get('DragonRunMixplorer', encoding='utf8')
|
||||
if not status == "0":
|
||||
mixplorer_is_running = exec_app(status, mixplorer, mixplorer_main)
|
||||
params.put('DragonRunMixplorer', '0')
|
||||
put_nonblocking('DragonRunMixplorer', '0')
|
||||
|
||||
# if manual control is set, we do not allow any of the auto actions
|
||||
auto_tomtom = not manual_tomtom and dragon_enable_tomtom and dragon_boot_tomtom
|
||||
|
||||
@@ -30,7 +30,7 @@ def main(gctx=None):
|
||||
|
||||
thermal_sock = messaging.sub_sock(service_list['thermal'].port)
|
||||
while 1:
|
||||
if params.get("DragonEnableDashcam") == "1":
|
||||
if params.get("DragonEnableDashcam", encoding='utf8') == "1":
|
||||
now = datetime.datetime.now()
|
||||
file_name = now.strftime("%Y-%m-%d_%H-%M-%S")
|
||||
os.system("screenrecord --bit-rate %s --time-limit %s %s%s.mp4 &" % (bit_rates, duration, dashcam_videos, file_name))
|
||||
|
||||
@@ -37,7 +37,7 @@ def main(gctx=None):
|
||||
time.sleep(1)
|
||||
|
||||
def get_shutdown_val():
|
||||
val = params.get("DragonAutoShutdownAt")
|
||||
val = params.get("DragonAutoShutdownAt", encoding='utf8')
|
||||
if val is None:
|
||||
return None
|
||||
else:
|
||||
|
||||
@@ -550,11 +550,11 @@ def main():
|
||||
if os.getenv("PREPAREONLY") is not None:
|
||||
return
|
||||
|
||||
if params.get("DragonEnableLogger") == "0":
|
||||
if params.get("DragonEnableLogger", encoding='utf8') == "0":
|
||||
del managed_processes['loggerd']
|
||||
del managed_processes['tombstoned']
|
||||
|
||||
if params.get("DragonEnableUploader") == "0":
|
||||
if params.get("DragonEnableUploader", encoding='utf8') == "0":
|
||||
del managed_processes['uploader']
|
||||
|
||||
# SystemExit on sigterm
|
||||
|
||||
@@ -96,7 +96,7 @@ _TEMP_THRS_L = [42.5, 57.5, 72.5, 10000]
|
||||
_FAN_SPEEDS = [0, 16384, 32768, 65535]
|
||||
# max fan speed only allowed if battery is hot
|
||||
_BAT_TEMP_THERSHOLD = 45.
|
||||
if params.get('DragonNoctuaMode') == "1":
|
||||
if params.get('DragonNoctuaMode', encoding='utf8') == "1":
|
||||
_FAN_SPEEDS = [65535, 65535, 65535, 65535]
|
||||
_BAT_TEMP_THERSHOLD = 20.
|
||||
|
||||
@@ -153,7 +153,7 @@ def thermald_thread():
|
||||
ts_last_charging_ctrl = 0.
|
||||
|
||||
ip_addr = '255.255.255.255'
|
||||
dragon_charging_ctrl = True if params.get('DragonChargingCtrl') == "1" else False
|
||||
dragon_charging_ctrl = True if params.get('DragonChargingCtrl', encoding='utf8') == "1" else False
|
||||
dragon_charging_max = int(params.get('DragonCharging'))
|
||||
dragon_discharging_min = int(params.get('DragonDisCharging'))
|
||||
charging_disabled = False
|
||||
|
||||
Reference in New Issue
Block a user