mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-21 14:02:05 +08:00
Fix python3 params.get issue
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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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