Example #1
0
    def get_params(candidate, fingerprint, vin=""):

        ret = car.CarParams.new_message()

        ret.carName = "chrysler"
        ret.carFingerprint = candidate
        ret.carVin = vin

        ret.safetyModel = car.CarParams.SafetyModel.chrysler

        # pedal
        ret.enableCruise = True

        # Speed conversion:              20, 45 mph
        ret.wheelbase = 3.089  # in meters for Pacifica Hybrid 2017
        ret.steerRatio = 16.2  # Pacifica Hybrid 2017
        ret.mass = 2858. + STD_CARGO_KG  # kg curb weight Pacifica Hybrid 2017
        ret.lateralTuning.pid.kpBP, ret.lateralTuning.pid.kiBP = [[9., 20.],
                                                                  [9., 20.]]
        ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30],
                                                                [0.03, 0.05]]
        ret.lateralTuning.pid.kf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594
        ret.steerActuatorDelay = 0.1
        ret.steerRateCost = 0.7

        if candidate in (CAR.JEEP_CHEROKEE, CAR.JEEP_CHEROKEE_2019):
            ret.wheelbase = 2.91  # in meters
            ret.steerRatio = 12.7
            ret.steerActuatorDelay = 0.2  # in seconds

        ret.centerToFront = ret.wheelbase * 0.44

        ret.minSteerSpeed = 3.8  # m/s
        ret.minEnableSpeed = -1.  # enable is done by stock ACC, so ignore this
        if candidate in (CAR.PACIFICA_2019_HYBRID, CAR.JEEP_CHEROKEE_2019):
            ret.minSteerSpeed = 17.5  # m/s 17 on the way up, 13 on the way down once engaged.
            # TODO allow 2019 cars to steer down to 13 m/s if already engaged.

        # TODO: get actual value, for now starting with reasonable value for
        # civic and scaling by mass and wheelbase
        ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase)

        # TODO: start from empirically derived lateral slip stiffness for the civic and scale by
        # mass and CG position, so all cars will have approximately similar dyn behaviors
        ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(
            ret.mass, ret.wheelbase, ret.centerToFront)

        # no rear steering, at least on the listed cars above
        ret.steerRatioRear = 0.

        # steer, gas, brake limitations VS speed
        ret.steerMaxBP = [16. * CV.KPH_TO_MS,
                          45. * CV.KPH_TO_MS]  # breakpoints at 1 and 40 kph
        ret.steerMaxV = [1., 1.]  # 2/3rd torque allowed above 45 kph
        ret.gasMaxBP = [0.]
        ret.gasMaxV = [0.5]
        ret.brakeMaxBP = [5., 20.]
        ret.brakeMaxV = [1., 0.8]

        ret.enableCamera = not check_ecu_msgs(fingerprint, ECU.CAM)
        print("ECU Camera Simulated: {0}".format(ret.enableCamera))
        ret.openpilotLongitudinalControl = False

        ret.steerLimitAlert = True
        ret.stoppingControl = False
        ret.startAccel = 0.0

        ret.longitudinalTuning.deadzoneBP = [0., 9.]
        ret.longitudinalTuning.deadzoneV = [0., .15]
        ret.longitudinalTuning.kpBP = [0., 5., 35.]
        ret.longitudinalTuning.kpV = [3.6, 2.4, 1.5]
        ret.longitudinalTuning.kiBP = [0., 35.]
        ret.longitudinalTuning.kiV = [0.54, 0.36]

        return ret
  def get_params(candidate, fingerprint):

    # kg of standard extra cargo to count for drive, gas, etc...
    std_cargo = 136

    ret = car.CarParams.new_message()

    ret.carName = "chrysler"
    ret.carFingerprint = candidate

    ret.safetyModel = car.CarParams.SafetyModels.chrysler

    # pedal
    ret.enableCruise = True

    # FIXME: hardcoding honda civic 2016 touring params so they can be used to
    # scale unknown params for other cars
    mass_civic = 2923./2.205 + std_cargo
    wheelbase_civic = 2.70
    centerToFront_civic = wheelbase_civic * 0.4
    centerToRear_civic = wheelbase_civic - centerToFront_civic
    rotationalInertia_civic = 2500
    tireStiffnessFront_civic = 85400 * 2.0
    tireStiffnessRear_civic = 90000 * 2.0

    # Speed conversion:              20, 45 mph
    ret.steerKpBP, ret.steerKiBP = [[9., 20.], [9., 20.]]
    ret.wheelbase = 3.089  # in meters for Pacifica Hybrid 2017
    ret.steerRatio = 16.2 # Pacifica Hybrid 2017
    ret.mass = 2858 + std_cargo  # kg curb weight Pacifica Hybrid 2017
    ret.steerKpV, ret.steerKiV =   [[0.15,0.30], [0.03,0.05]]
    ret.steerKf = 0.00006   # full torque for 10 deg at 80mph means 0.00007818594
    ret.steerActuatorDelay = 0.1
    ret.steerRateCost = 0.7

    if candidate == CAR.JEEP_CHEROKEE:
      ret.wheelbase = 2.91  # in meters
      ret.steerRatio = 12.7
      ret.steerActuatorDelay = 0.2  # in seconds

    ret.centerToFront = ret.wheelbase * 0.44

    ret.longPidDeadzoneBP = [0., 9.]
    ret.longPidDeadzoneV = [0., .15]

    ret.minSteerSpeed = 3.8  # m/s
    ret.minEnableSpeed = -1.   # enable is done by stock ACC, so ignore this

    centerToRear = ret.wheelbase - ret.centerToFront
    # TODO: get actual value, for now starting with reasonable value for
    # civic and scaling by mass and wheelbase
    ret.rotationalInertia = rotationalInertia_civic * \
                            ret.mass * ret.wheelbase**2 / (mass_civic * wheelbase_civic**2)

    # TODO: start from empirically derived lateral slip stiffness for the civic and scale by
    # mass and CG position, so all cars will have approximately similar dyn behaviors
    ret.tireStiffnessFront = tireStiffnessFront_civic * \
                             ret.mass / mass_civic * \
                             (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic)
    ret.tireStiffnessRear = tireStiffnessRear_civic * \
                            ret.mass / mass_civic * \
                            (ret.centerToFront / ret.wheelbase) / (centerToFront_civic / wheelbase_civic)

    # no rear steering, at least on the listed cars above
    ret.steerRatioRear = 0.

    # steer, gas, brake limitations VS speed
    ret.steerMaxBP = [16. * CV.KPH_TO_MS, 45. * CV.KPH_TO_MS]  # breakpoints at 1 and 40 kph
    ret.steerMaxV = [1., 1.]  # 2/3rd torque allowed above 45 kph
    ret.gasMaxBP = [0.]
    ret.gasMaxV = [0.5]
    ret.brakeMaxBP = [5., 20.]
    ret.brakeMaxV = [1., 0.8]

    ret.enableCamera = not check_ecu_msgs(fingerprint, ECU.CAM)
    print "ECU Camera Simulated: ", ret.enableCamera
    ret.openpilotLongitudinalControl = False

    ret.steerLimitAlert = True
    ret.stoppingControl = False
    ret.startAccel = 0.0

    ret.longitudinalKpBP = [0., 5., 35.]
    ret.longitudinalKpV = [3.6, 2.4, 1.5]
    ret.longitudinalKiBP = [0., 35.]
    ret.longitudinalKiV = [0.54, 0.36]

    return ret
Example #3
0
    def get_params(candidate, fingerprint):

        # kg of standard extra cargo to count for drive, gas, etc...
        std_cargo = 136

        ret = car.CarParams.new_message()

        ret.carName = "chrysler"
        ret.carFingerprint = candidate

        ret.safetyModel = car.CarParams.SafetyModels.chrysler

        # pedal
        ret.enableCruise = True

        # FIXME: hardcoding honda civic 2016 touring params so they can be used to
        # scale unknown params for other cars
        mass_civic = 2923. / 2.205 + std_cargo
        wheelbase_civic = 2.70
        centerToFront_civic = wheelbase_civic * 0.4
        centerToRear_civic = wheelbase_civic - centerToFront_civic
        rotationalInertia_civic = 2500
        tireStiffnessFront_civic = 85400 * 2.0
        tireStiffnessRear_civic = 90000 * 2.0

        # Speed conversion:                0,  20,  45,  75 mph
        ret.steerKpBP, ret.steerKiBP = [[0., 9., 20., 34.], [0., 9., 20., 34.]]
        ret.safetyParam = 73  # see conversion factor for STEER_TORQUE_EPS in dbc file
        ret.wheelbase = 3.089  # in meters for Pacifica Hybrid 2017
        ret.steerRatio = 16.2  # Pacifica Hybrid 2017
        ret.mass = 2858 + std_cargo  # kg curb weight Pacifica Hybrid 2017
        ret.steerKpV, ret.steerKiV = [[0.15, 0.15, 0.34, 0.34],
                                      [0.03, 0.03, 0.03, 0.03]]
        ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594
        ret.steerActuatorDelay = 0.1
        ret.steerRateCost = 1.

        ret.centerToFront = ret.wheelbase * 0.44

        ret.longPidDeadzoneBP = [0., 9.]
        ret.longPidDeadzoneV = [0., .15]

        # min speed to enable ACC. if car can do stop and go, then set enabling speed
        # to a negative value, so it won't matter.
        ret.minEnableSpeed = 5. * CV.MPH_TO_MS  # -1 for stop-and-go

        centerToRear = ret.wheelbase - ret.centerToFront
        # TODO: get actual value, for now starting with reasonable value for
        # civic and scaling by mass and wheelbase
        ret.rotationalInertia = rotationalInertia_civic * \
                                ret.mass * ret.wheelbase**2 / (mass_civic * wheelbase_civic**2)

        # TODO: start from empirically derived lateral slip stiffness for the civic and scale by
        # mass and CG position, so all cars will have approximately similar dyn behaviors
        ret.tireStiffnessFront = tireStiffnessFront_civic * \
                                 ret.mass / mass_civic * \
                                 (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic)
        ret.tireStiffnessRear = tireStiffnessRear_civic * \
                                ret.mass / mass_civic * \
                                (ret.centerToFront / ret.wheelbase) / (centerToFront_civic / wheelbase_civic)

        # no rear steering, at least on the listed cars above
        ret.steerRatioRear = 0.

        # steer, gas, brake limitations VS speed
        ret.steerMaxBP = [16. * CV.KPH_TO_MS,
                          45. * CV.KPH_TO_MS]  # breakpoints at 1 and 40 kph
        ret.steerMaxV = [1., 1.]  # 2/3rd torque allowed above 45 kph
        ret.gasMaxBP = [0.]
        ret.gasMaxV = [0.5]
        ret.brakeMaxBP = [5., 20.]
        ret.brakeMaxV = [1., 0.8]

        ret.enableCamera = not check_ecu_msgs(fingerprint, candidate, ECU.CAM)
        ret.enableDsu = False  #not check_ecu_msgs(fingerprint, candidate, ECU.DSU)
        ret.enableApgs = False  #not check_ecu_msgs(fingerprint, candidate, ECU.APGS)
        print "ECU Camera Simulated: ", ret.enableCamera
        print "ECU DSU Simulated: ", ret.enableDsu
        print "ECU APGS Simulated: ", ret.enableApgs

        ret.steerLimitAlert = False
        ret.stoppingControl = False
        ret.startAccel = 0.0

        ret.longitudinalKpBP = [0., 5., 35.]
        ret.longitudinalKpV = [3.6, 2.4, 1.5]
        ret.longitudinalKiBP = [0., 35.]
        ret.longitudinalKiV = [0.54, 0.36]

        return ret