def main(): params = Params() dongle_id = params.get("DongleId", encoding='utf-8') crash.init() crash.bind_user(id=dongle_id) crash.bind_extra(dirty=dirty, origin=origin, branch=branch, commit=commit, device=HARDWARE.get_device_type()) ws_uri = ATHENA_HOST + "/ws/v2/" + dongle_id api = Api(dongle_id) conn_retries = 0 while 1: try: ws = create_connection(ws_uri, cookie="jwt=" + api.get_token(), enable_multithread=True) cloudlog.event("athenad.main.connected_ws", ws_uri=ws_uri) ws.settimeout(1) conn_retries = 0 handle_long_poll(ws) except (KeyboardInterrupt, SystemExit): break except Exception: crash.capture_exception() cloudlog.exception("athenad.main.exception") conn_retries += 1 params.delete("LastAthenaPingTime") time.sleep(backoff(conn_retries))
def manager_init(should_register=True): if should_register: reg_res = register() if reg_res: dongle_id, dongle_secret = reg_res else: raise Exception("server registration failed") else: dongle_id = "c" * 16 # set dongle id cloudlog.info("dongle id is " + dongle_id) os.environ['DONGLE_ID'] = dongle_id cloudlog.info("dirty is %d" % dirty) if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=True) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=True) os.umask(0) try: os.mkdir(ROOT, 0o777) except OSError: pass
def main(gctx=None): params = Params() dongle_id = params.get("DongleId") access_token = params.get("AccessToken") ws_uri = ATHENA_HOST + "/ws/" + dongle_id crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=True) crash.install() conn_retries = 0 while 1: try: print("connecting to %s" % ws_uri) ws = create_connection(ws_uri, cookie="jwt=" + access_token, enable_multithread=True) ws.settimeout(1) conn_retries = 0 handle_long_poll(ws) except (KeyboardInterrupt, SystemExit): break except Exception: conn_retries += 1 traceback.print_exc() time.sleep(backoff(conn_retries))
def manager_init(): global gctx reg_res = register() if reg_res: dongle_id, dongle_secret = reg_res else: raise Exception("server registration failed") # set dongle id cloudlog.info("dongle id is " + dongle_id) os.environ['DONGLE_ID'] = dongle_id dirty = subprocess.call( ["git", "diff-index", "--quiet", "origin/release", "--"]) != 0 cloudlog.info("dirty is %d" % dirty) if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty) os.umask(0) try: os.mkdir(ROOT, 0777) except OSError: pass # set gctx gctx = {}
def main(gctx=None): params = Params() dongle_id = params.get("DongleId") ws_uri = ATHENA_HOST + "/ws/v2/" + dongle_id crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=True) crash.install() private_key = open("/persist/comma/id_rsa").read() api = Api(dongle_id, private_key) conn_retries = 0 while 1: try: print("connecting to %s" % ws_uri) ws = create_connection(ws_uri, cookie="jwt=" + api.get_token(), enable_multithread=True) ws.settimeout(1) conn_retries = 0 handle_long_poll(ws) except (KeyboardInterrupt, SystemExit): break except Exception: conn_retries += 1 traceback.print_exc() time.sleep(backoff(conn_retries)) params.delete("AthenadPid")
def manager_init(should_register=True): if should_register: reg_res = register() if reg_res: dongle_id = reg_res else: raise Exception("server registration failed") else: dongle_id = "c"*16 # set dongle id cloudlog.info("dongle id is " + dongle_id) os.environ['DONGLE_ID'] = dongle_id cloudlog.info("dirty is %d" % dirty) if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=True) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=True) os.umask(0) try: os.mkdir(ROOT, 0o777) except OSError: pass # ensure shared libraries are readable by apks if ANDROID: os.chmod(BASEDIR, 0o755) os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755)
def manager_init(): params = Params() params.manager_start() default_params = [ ("CompletedTrainingVersion", "0"), ("HasAcceptedTerms", "0"), ("IsUploadRawEnabled", "1"), ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')), ("OpenpilotEnabledToggle", "1"), ] if params.get_bool("RecordFrontLock"): params.put_bool("RecordFront", True) # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put_bool("Passive", bool(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") os.umask(0) # Make sure we can create files with 777 permissions # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set dongle id reg_res = register(show_spinner=True) if reg_res: dongle_id = reg_res else: raise Exception("server registration failed") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog and loggerd if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, device=HARDWARE.get_device_type())
def main(gctx=None): params = Params() dongle_id = params.get("DongleId") crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=True) crash.install() main_thread = threading.Thread(target=mapsd_thread) main_thread.daemon = True main_thread.start() q_thread = threading.Thread(target=query_thread) q_thread.daemon = True q_thread.start() while True: time.sleep(0.1)
def manager_init(should_register=False): params = Params() # apparently not registering in registration.py requires us to do this here if should_register: reg_res = register() if reg_res: dongle_id, dongle_secret = reg_res else: raise Exception("server registration failed") else: # apparently not registering in registration.py requires us to do this here params.put("Version", version) params.put("TermsVersion", terms_version) params.put("TrainingVersion", training_version) params.put("GitCommit", get_git_commit()) params.put("GitBranch", get_git_branch()) params.put("GitRemote", get_git_remote()) params.put("SubscriberInfo", get_subscriber_info()) dongle_id = params.get('DongleId') if dongle_id: dongle_id = dongle_id.decode("utf-8") else: dongle_id = str("c"*16) # set dongle id cloudlog.info("dongle id is " + dongle_id) os.environ['DONGLE_ID'] = dongle_id cloudlog.info("dirty is %d" % dirty) if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=True) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=True) os.umask(0) try: os.mkdir(ROOT, 0o777) except OSError: pass # ensure shared libraries are readable by apks if ANDROID: os.chmod(BASEDIR, 0o755) os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755)
def manager_init(): global gctx reg_res = register() if reg_res: dongle_id, dongle_secret = reg_res else: raise Exception("server registration failed") # set dongle id cloudlog.info("dongle id is " + dongle_id) os.environ['DONGLE_ID'] = dongle_id if "-private" in subprocess.check_output( ["git", "config", "--get", "remote.origin.url"]): upstream = "origin/master" else: if 'chffrplus' in version: upstream = "origin/release" else: upstream = "origin/release2" dirty = subprocess.call(["git", "diff-index", "--quiet", upstream, "--" ]) != 0 cloudlog.info("dirty is %d" % dirty) if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=EON) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=EON) os.umask(0) try: os.mkdir(ROOT, 0777) except OSError: pass # set gctx gctx = {}
def main(): params = Params() dongle_id = params.get("DongleId").decode('utf-8') cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty) crash.install() try: while 1: cloudlog.info("starting athena daemon") proc = Process(name='athenad', target=launcher, args=('selfdrive.athena.athenad',)) proc.start() proc.join() cloudlog.event("athenad exited", exitcode=proc.exitcode) time.sleep(5) except Exception: cloudlog.exception("manage_athenad.exception") finally: params.delete(ATHENA_MGR_PID_PARAM)
def manager_init(): # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set dongle id reg_res = register() if reg_res: dongle_id = reg_res else: raise Exception("server registration failed") os.environ['DONGLE_ID'] = dongle_id if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=True) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=True) os.umask(0) try: os.mkdir(ROOT, 0o777) except OSError: pass # ensure shared libraries are readable by apks if EON: os.chmod(BASEDIR, 0o755) os.chmod("/dev/shm", 0o777) os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755)
def main(): params = Params() dongle_id = params.get("DongleId") crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, is_eon=True) crash.install() # setup shared parameters last_gps = None query_lock = threading.Lock() last_query_result = None last_query_pos = None cache_valid = False traffic_status = 'None' traffic_confidence = 100 last_not_none_signal = 'None' speedLimittraffic = 0 speedLimittrafficvalid = False speedLimittrafficAdvisory = 0 speedLimittrafficAdvisoryvalid = False sharedParams = {'last_gps' : last_gps, 'query_lock' : query_lock, 'last_query_result' : last_query_result, \ 'last_query_pos' : last_query_pos, 'cache_valid' : cache_valid, 'traffic_status' : traffic_status, \ 'traffic_confidence' : traffic_confidence, 'last_not_none_signal' : last_not_none_signal, \ 'speedLimittraffic' : speedLimittraffic, 'speedLimittrafficvalid' : speedLimittrafficvalid, \ 'speedLimittrafficAdvisory' : speedLimittrafficAdvisory, 'speedLimittrafficAdvisoryvalid' : speedLimittrafficAdvisoryvalid} qt = QueryThread(1, "QueryThread", sharedParams=sharedParams) mt = MapsdThread(2, "MapsdThread", sharedParams=sharedParams) mggps = MessagedGPSThread(3, "MessagedGPSThread", sharedParams=sharedParams) mgarne = MessagedArneThread(4, "MessagedArneThread", sharedParams=sharedParams) qt.start() mt.start() mggps.start() mgarne.start()
def manager_init(): # update system time from panda set_time(cloudlog) # save boot log subprocess.call("./bootlog", cwd=os.path.join(BASEDIR, "selfdrive/loggerd")) params = Params() params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START) default_params = [ ("CompletedTrainingVersion", "0"), ("HasAcceptedTerms", "0"), ("OpenpilotEnabledToggle", "1"), ] if not PC: default_params.append(("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8'))) if params.get_bool("RecordFrontLock"): params.put_bool("RecordFront", True) if not params.get_bool("DisableRadar_Allow"): params.delete("DisableRadar") # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put_bool("Passive", bool(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set version params params.put("Version", version) params.put("TermsVersion", terms_version) params.put("TrainingVersion", training_version) params.put("GitCommit", get_git_commit(default="")) params.put("GitBranch", get_git_branch(default="")) params.put("GitRemote", get_git_remote(default="")) # set dongle id reg_res = register(show_spinner=True) if reg_res: dongle_id = reg_res else: serial = params.get("HardwareSerial") raise Exception(f"Registration failed for device {serial}") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) if comma_remote and not (os.getenv("NOLOG") or os.getenv("NOCRASH") or PC): crash.init() crash.bind_user(id=dongle_id) crash.bind_extra(dirty=dirty, origin=origin, branch=branch, commit=commit, device=HARDWARE.get_device_type())
def manager_init(): # update system time from panda set_time(cloudlog) params = Params() params.manager_start() default_params = [ ("CompletedTrainingVersion", "0"), ("HasAcceptedTerms", "0"), ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')), ("OpenpilotEnabledToggle", "1"), ] if TICI: default_params.append(("IsUploadRawEnabled", "1")) if params.get_bool("RecordFrontLock"): params.put_bool("RecordFront", True) # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put_bool("Passive", bool(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") os.umask(0) # Make sure we can create files with 777 permissions # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set version params params.put("Version", version) params.put("TermsVersion", terms_version) params.put("TrainingVersion", training_version) params.put("GitCommit", get_git_commit(default="")) params.put("GitBranch", get_git_branch(default="")) params.put("GitRemote", get_git_remote(default="")) # set dongle id dongle_id = register(show_spinner=True) if dongle_id is not None: os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) if not (dongle_id is None or os.getenv("NOLOG") or os.getenv("NOCRASH") or PC): crash.init() crash.bind_user(id=dongle_id) crash.bind_extra(dirty=dirty, origin=origin, branch=branch, commit=commit, device=HARDWARE.get_device_type())
def manager_init(): params = Params() params.manager_start() default_params = [ ("CommunityFeaturesToggle", "0"), ("EndToEndToggle", "0"), ("CompletedTrainingVersion", "0"), ("IsRHD", "0"), ("IsMetric", "1"), ("RecordFront", "0"), ("HasAcceptedTerms", "0"), ("HasCompletedSetup", "0"), ("IsUploadRawEnabled", "1"), ("IsLdwEnabled", "0"), ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')), ("OpenpilotEnabledToggle", "1"), ("VisionRadarToggle", "0"), ("IsDriverViewEnabled", "0"), ("IsOpenpilotViewEnabled", "0"), ("OpkrAutoShutdown", "2"), ("OpkrAutoScreenDimming", "0"), ("OpkrUIBrightness", "0"), ("OpkrUIBrightness", "0"), ("OpkrUIVolumeBoost", "0"), ("OpkrEnableDriverMonitoring", "1"), ("OpkrEnableLogger", "0"), ("OpkrEnableGetoffAlert", "1"), ("OpkrAutoResume", "1"), ("OpkrVariableCruise", "1"), ("OpkrLaneChangeSpeed", "45"), ("OpkrAutoLaneChangeDelay", "0"), ("OpkrSteerAngleCorrection", "0"), ("PutPrebuiltOn", "0"), ("FingerprintIssuedFix", "0"), ("LdwsCarFix", "0"), ("LateralControlMethod", "0"), ("CruiseStatemodeSelInit", "1"), ("InnerLoopGain", "35"), ("OuterLoopGain", "20"), ("TimeConstant", "14"), ("ActuatorEffectiveness", "20"), ("Scale", "1750"), ("LqrKi", "10"), ("DcGain", "30"), ("IgnoreZone", "1"), ("PidKp", "20"), ("PidKi", "40"), ("PidKd", "150"), ("PidKf", "5"), ("CameraOffsetAdj", "60"), ("SteerRatioAdj", "150"), ("SteerRatioMaxAdj", "180"), ("SteerActuatorDelayAdj", "0"), ("SteerRateCostAdj", "45"), ("SteerLimitTimerAdj", "40"), ("TireStiffnessFactorAdj", "85"), ("SteerMaxBaseAdj", "300"), ("SteerMaxAdj", "384"), ("SteerDeltaUpBaseAdj", "3"), ("SteerDeltaUpAdj", "3"), ("SteerDeltaDownBaseAdj", "7"), ("SteerDeltaDownAdj", "7"), ("SteerMaxvAdj", "10"), ("OpkrBatteryChargingControl", "1"), ("OpkrBatteryChargingMin", "70"), ("OpkrBatteryChargingMax", "80"), ("LeftCurvOffsetAdj", "0"), ("RightCurvOffsetAdj", "0"), ("DebugUi1", "0"), ("DebugUi2", "0"), ("OpkrBlindSpotDetect", "1"), ("OpkrMaxAngleLimit", "90"), ("OpkrSpeedLimitOffset", "0"), ("LimitSetSpeedCamera", "0"), ("LimitSetSpeedCameraDist", "0"), ("OpkrLiveSteerRatio", "1"), ("OpkrVariableSteerMax", "1"), ("OpkrVariableSteerDelta", "0"), ("FingerprintTwoSet", "1"), ("OpkrVariableCruiseProfile", "0"), ("OpkrLiveTune", "0"), ("OpkrDrivingRecord", "0"), ("OpkrTurnSteeringDisable", "0"), ("CarModel", ""), ("OpkrHotspotOnBoot", "0"), ("OpkrSSHLegacy", "1"), ("ShaneFeedForward", "0"), ("CruiseOverMaxSpeed", "0"), ("OpkrMapDecelOnly", "0"), ("JustDoGearD", "0"), ("LanelessMode", "0"), ("ComIssueGone", "0"), ("MaxSteer", "384"), ("MaxRTDelta", "112"), ("MaxRateUp", "3"), ("MaxRateDown", "7"), ("SteerThreshold", "150"), ] if params.get("RecordFrontLock", encoding='utf-8') == "1": params.put("RecordFront", "1") # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put("Passive", str(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") if EON: update_apks() os.umask(0) # Make sure we can create files with 777 permissions # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set dongle id reg_res = register(show_spinner=True) if reg_res: dongle_id = reg_res else: raise Exception("server registration failed") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog and loggerd if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, device=HARDWARE.get_device_type()) # ensure shared libraries are readable by apks if EON: os.chmod(BASEDIR, 0o755) os.chmod("/dev/shm", 0o777) os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755)
def manager_init(): # update system time from panda set_time(cloudlog) params = Params() params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START) default_params = [ ("CompletedTrainingVersion", "0"), ("HasAcceptedTerms", "0"), ("HandsOnWheelMonitoring", "0"), ("OpenpilotEnabledToggle", "1"), ("ShowDebugUI", "1"), ("SpeedLimitControl", "1"), ("SpeedLimitPercOffset", "1"), ("TurnSpeedControl", "1"), ("TurnVisionControl", "1"), ("GMAutoHold", "1"), ("CruiseSpeedOffset", "1"), ("StockSpeedAdjust", "1"), ("CustomSounds", "0"), ("SilentEngageDisengage", "0"), ("AccelModeButton", "0"), ("AccelMode", "0"), ("EndToEndToggle", "1"), ("LanelessMode", "2"), ("NudgelessLaneChange", "0"), ("Coasting", "0"), ("RegenBraking", "0"), ("OnePedalMode", "0"), ("OnePedalModeSimple", "0"), ("OnePedalModeEngageOnGas", "0"), ("OnePedalBrakeMode", "0"), ("OnePedalPauseBlinkerSteering", "1"), ("FollowLevel", "2"), ("CoastingBrakeOverSpeed", "0"), ("FrictionBrakePercent", "0"), ("BrakeIndicator", "1"), ("DisableOnroadUploads", "0"), ("MeasureNumSlots", "0"), ("MeasureSlot00", "12"), # right column: percent grade ("MeasureSlot01", "10"), # altitude ("MeasureSlot02", "2"), # steering torque ("MeasureSlot03", "3"), # engine rpm ("MeasureSlot04", "7"), # engine coolant temperature ("MeasureSlot05", "16"), # lead dist [s] ("MeasureSlot06", "15"), # lead dist [m] ("MeasureSlot07", "20"), # lead rel spd [mph] ("MeasureSlot08", "21"), # lead spd [mph] ("MeasureSlot09", "23"), # device cpu percent and temp ] if not PC: default_params.append( ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8'))) if params.get_bool("RecordFrontLock"): params.put_bool("RecordFront", True) # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # parameters set by Enviroment Varables if os.getenv("HANDSMONITORING") is not None: params.put_bool("HandsOnWheelMonitoring", bool(int(os.getenv("HANDSMONITORING")))) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put_bool("Passive", bool(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set version params params.put("Version", version) params.put("TermsVersion", terms_version) params.put("TrainingVersion", training_version) params.put("GitCommit", get_git_commit(default="")) params.put("GitBranch", get_git_branch(default="")) params.put("GitRemote", get_git_remote(default="")) # set dongle id reg_res = register(show_spinner=True) if reg_res: dongle_id = reg_res else: serial = params.get("HardwareSerial") raise Exception(f"Registration failed for device {serial}") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) if comma_remote and not (os.getenv("NOLOG") or os.getenv("NOCRASH") or PC): crash.init() crash.bind_user(id=dongle_id) crash.bind_extra(dirty=dirty, origin=origin, branch=branch, commit=commit, device=HARDWARE.get_device_type())
def manager_init(): # update system time from panda set_time(cloudlog) # save boot log subprocess.call("./bootlog", cwd=os.path.join(BASEDIR, "selfdrive/loggerd")) params = Params() params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START) default_params = [ ("CommunityFeaturesToggle", "1"), ("jvePilot.carState.accEco", "1"), ("jvePilot.settings.accEco.speedAheadLevel1", "7"), ("jvePilot.settings.accEco.speedAheadLevel2", "5"), ("jvePilot.settings.autoFollow", "1"), ("jvePilot.settings.autoFollow.speed1-2Bars", "15"), ("jvePilot.settings.autoFollow.speed2-3Bars", "30"), ("jvePilot.settings.autoFollow.speed3-4Bars", "65"), ("jvePilot.settings.autoResume", "1"), ("jvePilot.settings.disableOnGas", "0"), ("jvePilot.settings.audioAlertOnSteeringLoss", "1"), ("jvePilot.settings.deviceOffset", "0.00"), ("jvePilot.settings.reverseAccSpeedChange", "1"), ("jvePilot.settings.slowInCurves", "1"), ("jvePilot.settings.slowInCurves.speedRatio", "1.0"), ("jvePilot.settings.slowInCurves.speedDropOff", "2.0"), ("jvePilot.settings.slowInCurves.speedDropOffAngle", "0.0"), ("CompletedTrainingVersion", "0"), ("HasAcceptedTerms", "0"), ("OpenpilotEnabledToggle", "1"), ] if not PC: default_params.append( ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8'))) if params.get_bool("RecordFrontLock"): params.put_bool("RecordFront", True) if not params.get_bool("DisableRadar_Allow"): params.delete("DisableRadar") # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put_bool("Passive", bool(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set version params params.put("Version", get_version()) params.put("TermsVersion", terms_version) params.put("TrainingVersion", training_version) params.put("GitCommit", get_commit(default="")) params.put("GitBranch", get_short_branch(default="")) params.put("GitRemote", get_origin(default="")) # set dongle id reg_res = register(show_spinner=True) if reg_res: dongle_id = reg_res else: serial = params.get("HardwareSerial") raise Exception(f"Registration failed for device {serial}") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog if not get_dirty(): os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=get_version(), dirty=get_dirty(), device=HARDWARE.get_device_type()) if get_comma_remote() and not (os.getenv("NOLOG") or os.getenv("NOCRASH") or PC): crash.init() crash.bind_user(id=dongle_id) crash.bind_extra(dirty=get_dirty(), origin=get_origin(), branch=get_short_branch(), commit=get_commit(), device=HARDWARE.get_device_type())
def manager_init(spinner=None): params = Params() params.manager_start() default_params = [ ("CommunityFeaturesToggle", "0"), ("CompletedTrainingVersion", "0"), ("IsRHD", "0"), ("IsMetric", "1"), ("RecordFront", "0"), ("HasAcceptedTerms", "0"), ("HasCompletedSetup", "0"), ("IsUploadRawEnabled", "1"), ("IsLdwEnabled", "1"), ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')), ("OpenpilotEnabledToggle", "1"), ("VisionRadarToggle", "0"), ("LaneChangeEnabled", "1"), ("IsDriverViewEnabled", "0"), ("LimitSetSpeed", "0"), ("IsOpenpilotViewEnabled", "0"), ("OpkrAutoShutdown", "2"), ("OpkrAutoScreenOff", "0"), ("OpkrUIBrightness", "0"), ("OpkrEnableDriverMonitoring", "1"), ("OpkrEnableLogger", "0"), ("OpkrEnableGetoffAlert", "1"), ("OpkrAutoResume", "1"), ("OpkrVariableCruise", "1"), ("OpkrLaneChangeSpeed", "45"), ("OpkrAutoLaneChangeDelay", "0"), ("OpkrSteerAngleCorrection", "0"), ("PutPrebuiltOn", "0"), ("FingerprintIssuedFix", "0"), ("LdwsCarFix", "0"), ("LateralControlMethod", "0"), ("CruiseStatemodeSelInit", "1"), ("InnerLoopGain", "35"), ("OuterLoopGain", "20"), ("TimeConstant", "14"), ("ActuatorEffectiveness", "20"), ("Scale", "1750"), ("LqrKi", "10"), ("DcGain", "30"), ("IgnoreZone", "1"), ("PidKp", "30"), ("PidKi", "50"), ("PidKd", "150"), ("PidKf", "5"), ("CameraOffsetAdj", "60"), ("SteerRatioAdj", "150"), ("SteerRatioMaxAdj", "180"), ("SteerActuatorDelayAdj", "0"), ("SteerRateCostAdj", "45"), ("SteerLimitTimerAdj", "40"), ("TireStiffnessFactorAdj", "85"), ("SteerMaxAdj", "450"), ("SteerMaxBaseAdj", "280"), ("SteerDeltaUpAdj", "3"), ("SteerDeltaDownAdj", "7"), ("SteerMaxvAdj", "10"), ("OpkrBatteryChargingControl", "1"), ("OpkrBatteryChargingMin", "70"), ("OpkrBatteryChargingMax", "80"), ("OpkrUiOpen", "0"), ("OpkrDriveOpen", "0"), ("OpkrTuneOpen", "0"), ("OpkrControlOpen", "0"), ("LeftCurvOffsetAdj", "0"), ("RightCurvOffsetAdj", "0"), ("DebugUi1", "0"), ("DebugUi2", "0"), ("OpkrBlindSpotDetect", "1"), ("OpkrMaxAngleLimit", "90"), ("OpkrAutoResumeOption", "1"), ("OpkrSpeedLimitOffset", "0"), ("LimitSetSpeedCamera", "0"), ("LimitSetSpeedCameraDist", "0"), ("OpkrLiveSteerRatio", "1"), ("OpkrVariableSteerMax", "1"), ("OpkrVariableSteerDelta", "0"), ("FingerprintTwoSet", "1"), ("OpkrVariableCruiseProfile", "0"), ("OpkrLiveTune", "0"), ("OpkrDrivingRecord", "0"), ("OpkrTurnSteeringDisable", "0"), ("CarModel", ""), ("OpkrSafetyCamera", "0"), ("OpkrHotspotOnBoot", "0"), ("UserOption1", "0"), ("UserOption2", "0"), ("UserOption3", "0"), ("UserOption4", "0"), ("UserOption5", "0"), ("UserOption6", "0"), ("UserOption7", "0"), ("UserOption8", "0"), ("UserOption9", "0"), ("UserOption10", "0"), ("UserOptionName1", "설정속도를 현재속도에 동기화"), ("UserOptionName2", "Shane's FeedForward 활성화"), ("UserOptionName3", "저속 조향각 제한 활성화"), ("UserOptionName4", "가변크루즈 사용시 카메라감속만 사용"), ("UserOptionName5", ""), ("UserOptionName6", ""), ("UserOptionName7", ""), ("UserOptionName8", ""), ("UserOptionName9", ""), ("UserOptionName10", ""), ("UserOptionNameDescription1", "가변 크루즈 사용시 운전자 가속으로 인해 현재속도가 설정속도보다 높아질 경우 설정속도를 현재속도와 동기화 합니다."), ("UserOptionNameDescription2", "PID제어 사용시 Shane's FeedForward를 활성화 합니다. 직선구간에서는 토크를 낮추고 곡선구간에서는 토크를 높여 핸들 움직임을 능동적으로 합니다."), ("UserOptionNameDescription3", "저속 주행시 급격한 필요조향각 변화 시 현재조향각 변화를 제한하여 스티어링의 과도한 조향을 억제 합니다"), ("UserOptionNameDescription4", "가변크루즈 사용시 카메라감속기능만 사용합니다. 차간거리 및 커브구간 가속/감속 기능은 사용하지 않습니다. ※오파모드에서는 동작하지 않습니다."), ("UserOptionNameDescription5", ""), ("UserOptionNameDescription6", ""), ("UserOptionNameDescription7", ""), ("UserOptionNameDescription8", ""), ("UserOptionNameDescription9", ""), ("UserOptionNameDescription10", ""), ] # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put("Passive", str(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") if EON: update_apks() os.umask(0) # Make sure we can create files with 777 permissions # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set dongle id reg_res = register(spinner) if reg_res: dongle_id = reg_res else: raise Exception("server registration failed") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog and loggerd if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, device=HARDWARE.get_device_type()) # ensure shared libraries are readable by apks if EON: os.chmod(BASEDIR, 0o755) os.chmod("/dev/shm", 0o777) os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755)
def manager_init(spinner=None): params = Params() params.manager_start() default_params = [ ("CommunityFeaturesToggle", "0"), ("CompletedTrainingVersion", "0"), ("IsRHD", "0"), ("IsMetric", "0"), ("RecordFront", "0"), ("HasAcceptedTerms", "0"), ("HasCompletedSetup", "0"), ("IsUploadRawEnabled", "1"), ("IsLdwEnabled", "1"), ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')), ("OpenpilotEnabledToggle", "1"), ("VisionRadarToggle", "0"), ("LaneChangeEnabled", "1"), ("IsDriverViewEnabled", "0"), ] # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put("Passive", str(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") if EON: update_apks() os.umask(0) # Make sure we can create files with 777 permissions # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set dongle id reg_res = register(spinner) if reg_res: dongle_id = reg_res else: raise Exception("server registration failed") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog and loggerd if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, device=HARDWARE.get_device_type()) # ensure shared libraries are readable by apks if EON: os.chmod(BASEDIR, 0o755) os.chmod("/dev/shm", 0o777) os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755)
def manager_init(): # update system time from panda set_time(cloudlog) params = Params() params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START) default_params = [ ("CompletedTrainingVersion", "0"), ("HasAcceptedTerms", "0"), ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')), ("OpenpilotEnabledToggle", "1"), ("IsOpenpilotViewEnabled", "0"), ("OpkrAutoShutdown", "2"), ("OpkrAutoScreenOff", "0"), ("OpkrUIBrightness", "0"), ("OpkrUIBrightness", "0"), ("OpkrUIVolumeBoost", "0"), ("OpkrEnableDriverMonitoring", "1"), ("OpkrEnableLogger", "0"), ("OpkrEnableUploader", "0"), ("OpkrEnableGetoffAlert", "1"), ("OpkrAutoResume", "1"), ("OpkrVariableCruise", "1"), ("OpkrLaneChangeSpeed", "45"), ("OpkrAutoLaneChangeDelay", "0"), ("OpkrSteerAngleCorrection", "0"), ("PutPrebuiltOn", "0"), ("LdwsCarFix", "0"), ("LateralControlMethod", "0"), ("CruiseStatemodeSelInit", "1"), ("InnerLoopGain", "35"), ("OuterLoopGain", "20"), ("TimeConstant", "14"), ("ActuatorEffectiveness", "20"), ("Scale", "1500"), ("LqrKi", "15"), ("DcGain", "27"), ("IgnoreZone", "1"), ("PidKp", "20"), ("PidKi", "40"), ("PidKd", "150"), ("PidKf", "5"), ("CameraOffsetAdj", "60"), ("SteerRatioAdj", "155"), ("SteerRatioMaxAdj", "175"), ("SteerActuatorDelayAdj", "15"), ("SteerRateCostAdj", "35"), ("SteerLimitTimerAdj", "40"), ("TireStiffnessFactorAdj", "85"), ("SteerMaxBaseAdj", "300"), ("SteerMaxAdj", "384"), ("SteerDeltaUpBaseAdj", "3"), ("SteerDeltaUpAdj", "3"), ("SteerDeltaDownBaseAdj", "7"), ("SteerDeltaDownAdj", "7"), ("SteerMaxvAdj", "13"), ("OpkrBatteryChargingControl", "1"), ("OpkrBatteryChargingMin", "70"), ("OpkrBatteryChargingMax", "80"), ("LeftCurvOffsetAdj", "0"), ("RightCurvOffsetAdj", "0"), ("DebugUi1", "0"), ("DebugUi2", "0"), ("LongLogDisplay", "0"), ("OpkrBlindSpotDetect", "1"), ("OpkrMaxAngleLimit", "90"), ("OpkrSpeedLimitOffset", "0"), ("LimitSetSpeedCamera", "0"), ("LimitSetSpeedCameraDist", "0"), ("OpkrLiveSteerRatio", "1"), ("OpkrVariableSteerMax", "1"), ("OpkrVariableSteerDelta", "0"), ("FingerprintTwoSet", "1"), ("OpkrVariableCruiseProfile", "0"), ("OpkrLiveTune", "0"), ("OpkrDrivingRecord", "0"), ("OpkrTurnSteeringDisable", "0"), ("CarModel", ""), ("CarModelAbb", ""), ("OpkrHotspotOnBoot", "0"), ("OpkrSSHLegacy", "1"), ("ShaneFeedForward", "0"), ("CruiseOverMaxSpeed", "0"), ("JustDoGearD", "0"), ("LanelessMode", "0"), ("ComIssueGone", "0"), ("MaxSteer", "384"), ("MaxRTDelta", "112"), ("MaxRateUp", "3"), ("MaxRateDown", "7"), ("SteerThreshold", "150"), ("RecordingCount", "100"), ("RecordingQuality", "1"), ("CruiseGapAdjust", "0"), ("AutoEnable", "1"), ("CruiseAutoRes", "0"), ("AutoResOption", "0"), ("SteerWindDown", "0"), ("OpkrMonitoringMode", "0"), ("OpkrMonitorEyesThreshold", "75"), ("OpkrMonitorNormalEyesThreshold", "50"), ("OpkrMonitorBlinkThreshold", "50"), ("MadModeEnabled", "1"), ("OpkrFanSpeedGain", "0"), ("WhitePandaSupport", "0"), ("SteerWarningFix", "0"), ] if TICI: default_params.append(("IsUploadRawEnabled", "0")) if params.get_bool("RecordFrontLock"): params.put_bool("RecordFront", True) # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put_bool("Passive", bool(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") if EON: update_apks() os.umask(0) # Make sure we can create files with 777 permissions # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set version params params.put("Version", version) params.put("TermsVersion", terms_version) params.put("TrainingVersion", training_version) params.put("GitCommit", get_git_commit(default="")) params.put("GitBranch", get_git_branch(default="")) params.put("GitRemote", get_git_remote(default="")) # set dongle id reg_res = register(show_spinner=True) if reg_res: dongle_id = reg_res elif not reg_res: dongle_id = "" else: serial = params.get("HardwareSerial") raise Exception(f"Registration failed for device {serial}") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) # ensure shared libraries are readable by apks if EON: os.chmod(BASEDIR, 0o755) os.chmod("/dev/shm", 0o777) os.chmod(os.path.join(BASEDIR, "cereal"), 0o755) #if not (os.getenv("NOLOG") or os.getenv("NOCRASH") or PC): # crash.init() crash.bind_user(id=dongle_id) crash.bind_extra(dirty=dirty, origin=origin, branch=branch, commit=commit, device=HARDWARE.get_device_type()) os.system("/data/openpilot/gitcommit.sh")
def manager_init(): # update system time from panda set_time(cloudlog) params = Params() params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START) default_params = [ ("OpenpilotEnabledToggle", "1"), ("CommunityFeaturesToggle", "1"), ("IsMetric", "1"), # HKG ("UseClusterSpeed", "1"), ("LongControlEnabled", "0"), ("MadModeEnabled", "1"), ("IsLdwsCar", "0"), ("LaneChangeEnabled", "0"), ("AutoLaneChangeEnabled", "0"), ("SccSmootherSlowOnCurves", "0"), ("SccSmootherSyncGasPressed", "0"), ("StockNaviDecelEnabled", "0"), ("ShowDebugUI", "0"), ("CustomLeadMark", "0") ] if not PC: default_params.append( ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8'))) if params.get_bool("RecordFrontLock"): params.put_bool("RecordFront", True) # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put_bool("Passive", bool(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set version params params.put("Version", version) params.put("TermsVersion", terms_version) params.put("TrainingVersion", training_version) params.put("GitCommit", get_git_commit(default="")) params.put("GitBranch", get_git_branch(default="")) params.put("GitRemote", get_git_remote(default="")) # set dongle id reg_res = register(show_spinner=True) if reg_res: dongle_id = reg_res else: serial = params.get("HardwareSerial") raise Exception(f"Registration failed for device {serial}") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) if comma_remote and not (os.getenv("NOLOG") or os.getenv("NOCRASH") or PC): crash.init() crash.bind_user(id=dongle_id) crash.bind_extra(dirty=dirty, origin=origin, branch=branch, commit=commit, device=HARDWARE.get_device_type())
def manager_init(): params = Params() params.manager_start() default_params = [ ("CommunityFeaturesToggle", "0"), ("EndToEndToggle", "0"), ("CompletedTrainingVersion", "0"), ("IsRHD", "0"), ("IsMetric", "0"), ("RecordFront", "0"), ("HasAcceptedTerms", "0"), ("HasCompletedSetup", "0"), ("IsUploadRawEnabled", "1"), ("IsLdwEnabled", "0"), ("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')), ("OpenpilotEnabledToggle", "1"), ("LongControlEnabled", "0"), ("VisionRadarToggle", "0"), ("RadarDisableEnabled", "0"), ("MdpsHarnessEnabled", "0"), ("SccEnabled", "1"), ("EnableOPwithCC", "1"), ("SccHarnessPresent", "0"), ("IsDriverViewEnabled", "0"), ("LkasFullRangeAvailable", "1"), ("ChryslerMangoMode", "1"), ] if params.get("RecordFrontLock", encoding='utf-8') == "1": params.put("RecordFront", "1") # set unset params for k, v in default_params: if params.get(k) is None: params.put(k, v) # is this dashcam? if os.getenv("PASSIVE") is not None: params.put("Passive", str(int(os.getenv("PASSIVE")))) if params.get("Passive") is None: raise Exception("Passive must be set to continue") os.umask(0) # Make sure we can create files with 777 permissions # Create folders needed for msgq try: os.mkdir("/dev/shm") except FileExistsError: pass except PermissionError: print("WARNING: failed to make /dev/shm") # set dongle id reg_res = register(show_spinner=True) if reg_res: dongle_id = reg_res else: raise Exception("server registration failed") os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog and loggerd if not dirty: os.environ['CLEAN'] = '1' cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, device=HARDWARE.get_device_type()) crash.bind_user(id=dongle_id) crash.bind_extra(version=version, dirty=dirty, device=HARDWARE.get_device_type())