Ejemplo n.º 1
0
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

  # ensure shared libraries are readable by apks
  os.chmod(BASEDIR, 0o755)
  os.chmod(os.path.join(BASEDIR, "cereal"), 0o755)
  os.chmod(os.path.join(BASEDIR, "cereal", "libmessaging_shared.so"), 0o755)
Ejemplo n.º 2
0
def manager_init(should_register=True):
    global gctx

    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

    # set gctx
    gctx = {}
Ejemplo n.º 3
0
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 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())
Ejemplo n.º 4
0
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 = {}
Ejemplo n.º 5
0
def manager_init():
  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

  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)
Ejemplo n.º 6
0
def manager_init():
  global gctx, fake_uploader

  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
  os.environ['DONGLE_SECRET'] = dongle_secret

  cloudlog.bind_global(dongle_id=dongle_id)
  common.crash.bind_user(dongle_id=dongle_id)

  fake_uploader = Uploader(dongle_id, dongle_secret, ROOT)

  # set gctx
  gctx = {
    "calibration": {
      "initial_homography": [1.15728010e+00, -4.69379619e-02, 7.46450623e+01,
                             7.99253014e-02, 1.06372458e+00, 5.77762553e+01,
                             9.35543519e-05, -1.65429898e-04, 9.98062699e-01]
    }
  }
Ejemplo n.º 7
0
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
    os.environ['DONGLE_SECRET'] = dongle_secret

    cloudlog.bind_global(dongle_id=dongle_id)
    common.crash.bind_user(dongle_id=dongle_id)

    # set gctx
    gctx = {
        "calibration": {
            "initial_homography": [
                1.15728010e+00, -4.69379619e-02, 7.46450623e+01,
                7.99253014e-02, 1.06372458e+00, 5.77762553e+01, 9.35543519e-05,
                -1.65429898e-04, 9.98062699e-01
            ]
        }
    }

    # hook to kill all processes
    signal.signal(signal.SIGINT, cleanup_all_processes)
    signal.signal(signal.SIGTERM, cleanup_all_processes)
Ejemplo n.º 8
0
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)
Ejemplo n.º 9
0
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 = {}
Ejemplo n.º 10
0
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

    cloudlog.bind_global(dongle_id=dongle_id, version=version)
    crash.bind_user(id=dongle_id)
    crash.bind_extra(version=version)

    os.system("mkdir -p " + ROOT)

    # set gctx
    gctx = {}
Ejemplo n.º 11
0
def manager_init(should_register=True):
  # Create folders needed for msgq
  try:
    os.mkdir("/dev/shm")
  except FileExistsError:
    pass
  except PermissionError:
    print("WARNING: failed to make /dev/shm")

  if should_register:
    reg_res = register()
    if reg_res:
      dongle_id = reg_res
    else:
      dongle_id = "c"*16
  else:
    dongle_id = "c"*16
  # set dongle id
  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)
Ejemplo n.º 12
0
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)
Ejemplo n.º 13
0
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())
Ejemplo n.º 14
0
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)
Ejemplo n.º 15
0
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)
Ejemplo n.º 16
0
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())