示例#1
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 = "toyota"
        ret.carFingerprint = candidate

        ret.safetyModel = car.CarParams.SafetyModels.toyota

        # 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 * CV.LB_TO_KG + std_cargo
        wheelbase_civic = 2.70
        centerToFront_civic = wheelbase_civic * 0.4
        centerToRear_civic = wheelbase_civic - centerToFront_civic
        rotationalInertia_civic = 2500
        tireStiffnessFront_civic = 85400
        tireStiffnessRear_civic = 90000

        ret.steerKiBP, ret.steerKpBP = [[0.], [0.]]
        ret.steerActuatorDelay = 0.12  # Default delay, Prius has larger delay

        if candidate == CAR.PRIUS:
            ret.safetyParam = 66  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.70
            ret.steerRatio = 15.0
            ret.mass = 3045 * CV.LB_TO_KG + std_cargo
            ret.steerKpV, ret.steerKiV = [[0.4], [0.01]]
            ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594
            ret.steerRateCost = 1.5

            f = 1.43353663
            tireStiffnessFront_civic *= f
            tireStiffnessRear_civic *= f

            # Prius has a very bad actuator
            ret.steerActuatorDelay = 0.25
        elif candidate in [CAR.RAV4, CAR.RAV4H]:
            ret.safetyParam = 73  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.65
            ret.steerRatio = 14.5  # Rav4 2017
            ret.mass = 3650 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid
            ret.steerKpV, ret.steerKiV = [[0.6], [0.05]]
            ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594
            ret.steerRateCost = 1.
        elif candidate == CAR.COROLLA:
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.70
            ret.steerRatio = 17.8
            ret.mass = 2860 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid
            ret.steerKpV, ret.steerKiV = [[0.2], [0.05]]
            ret.steerKf = 0.00003  # full torque for 20 deg at 80mph means 0.00007818594
            ret.steerRateCost = 1.
        elif candidate == CAR.LEXUS_RXH:
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.79
            ret.steerRatio = 16.  # official specs say 14.8, but it does not seem right
            ret.mass = 4481 * CV.LB_TO_KG + std_cargo  # mean between min and max
            ret.steerKpV, ret.steerKiV = [[0.6], [0.1]]
            ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594
            ret.steerRateCost = .8

        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.
        if candidate in [CAR.PRIUS, CAR.RAV4H,
                         CAR.LEXUS_RXH]:  # rav4 hybrid can do stop and go
            ret.minEnableSpeed = -1.
        elif candidate in [CAR.RAV4,
                           CAR.COROLLA]:  # TODO: hack ICE to do stop and go
            ret.minEnableSpeed = 19. * CV.MPH_TO_MS

        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.
        ret.steerControlType = car.CarParams.SteerControlType.torque

        # 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 = 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
示例#2
0
    def get_params(candidate, fingerprint, vin=""):

        ret = car.CarParams.new_message()

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

        ret.safetyModel = car.CarParams.SafetyModel.toyota

        # pedal
        ret.enableCruise = not ret.enableGasInterceptor

        ret.steerActuatorDelay = 0.12  # Default delay, Prius has larger delay
        if candidate != CAR.PRIUS:
            ret.lateralTuning.init('pid')
            ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.],
                                                                      [0.]]

        if candidate == CAR.PRIUS:
            stop_and_go = True
            ret.safetyParam = 66  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.70
            ret.steerRatio = 15.00  # unknown end-to-end spec
            tire_stiffness_factor = 0.6371  # hand-tune
            ret.mass = 3045. * CV.LB_TO_KG + STD_CARGO_KG

            ret.lateralTuning.init('indi')
            ret.lateralTuning.indi.innerLoopGain = 4.0
            ret.lateralTuning.indi.outerLoopGain = 3.0
            ret.lateralTuning.indi.timeConstant = 1.0
            ret.lateralTuning.indi.actuatorEffectiveness = 1.0

            ret.steerActuatorDelay = 0.5

        elif candidate in [CAR.RAV4, CAR.RAV4H]:
            stop_and_go = True if (candidate in CAR.RAV4H) else False
            ret.safetyParam = 73
            ret.wheelbase = 2.65
            ret.steerRatio = 16.30  # 14.5 is spec end-to-end
            tire_stiffness_factor = 0.5533
            ret.mass = 3650. * CV.LB_TO_KG + STD_CARGO_KG  # mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6],
                                                                    [0.05]]
            ret.lateralTuning.pid.kf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594

        elif candidate == CAR.COROLLA:
            stop_and_go = False
            ret.safetyParam = 100
            ret.wheelbase = 2.70
            ret.steerRatio = 17.8
            tire_stiffness_factor = 0.444  # not optimized yet
            ret.mass = 2860. * CV.LB_TO_KG + STD_CARGO_KG  # mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2],
                                                                    [0.05]]
            ret.lateralTuning.pid.kf = 0.00003  # full torque for 20 deg at 80mph means 0.00007818594

        elif candidate == CAR.LEXUS_RXH:
            stop_and_go = True
            ret.safetyParam = 73
            ret.wheelbase = 2.79
            ret.steerRatio = 16.  # 14.8 is spec end-to-end
            tire_stiffness_factor = 0.444  # not optimized yet
            ret.mass = 4481. * CV.LB_TO_KG + STD_CARGO_KG  # mean between min and max
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6],
                                                                    [0.1]]
            ret.lateralTuning.pid.kf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594

        elif candidate in [CAR.CHR, CAR.CHRH]:
            stop_and_go = True
            ret.safetyParam = 73
            ret.wheelbase = 2.63906
            ret.steerRatio = 13.6
            tire_stiffness_factor = 0.7933
            ret.mass = 3300. * CV.LB_TO_KG + STD_CARGO_KG
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.723],
                                                                    [0.0428]]
            ret.lateralTuning.pid.kf = 0.00006

        elif candidate in [CAR.CAMRY, CAR.CAMRYH]:
            stop_and_go = True
            ret.safetyParam = 73
            ret.wheelbase = 2.82448
            ret.steerRatio = 13.7
            tire_stiffness_factor = 0.7933
            ret.mass = 3400. * CV.LB_TO_KG + STD_CARGO_KG  #mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6],
                                                                    [0.1]]
            ret.lateralTuning.pid.kf = 0.00006

        elif candidate in [CAR.HIGHLANDER, CAR.HIGHLANDERH]:
            stop_and_go = True
            ret.safetyParam = 73
            ret.wheelbase = 2.78
            ret.steerRatio = 16.0
            tire_stiffness_factor = 0.8
            ret.mass = 4607. * CV.LB_TO_KG + STD_CARGO_KG  #mean between normal and hybrid limited
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[
                0.18
            ], [0.015]]  # community tuning
            ret.lateralTuning.pid.kf = 0.00012  # community tuning

        elif candidate == CAR.AVALON:
            stop_and_go = False
            ret.safetyParam = 73
            ret.wheelbase = 2.82
            ret.steerRatio = 14.8  #Found at https://pressroom.toyota.com/releases/2016+avalon+product+specs.download
            tire_stiffness_factor = 0.7983
            ret.mass = 3505. * CV.LB_TO_KG + STD_CARGO_KG  # mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.17],
                                                                    [0.03]]
            ret.lateralTuning.pid.kf = 0.00006

        elif candidate == CAR.RAV4_TSS2:
            stop_and_go = True
            ret.safetyParam = 73
            ret.wheelbase = 2.68986
            ret.steerRatio = 14.3
            tire_stiffness_factor = 0.7933
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6],
                                                                    [0.1]]
            ret.mass = 3370. * CV.LB_TO_KG + STD_CARGO_KG
            ret.lateralTuning.pid.kf = 0.00007818594

        elif candidate == CAR.COROLLA_TSS2:
            stop_and_go = True
            ret.safetyParam = 73
            ret.wheelbase = 2.63906
            ret.steerRatio = 13.9
            tire_stiffness_factor = 0.444  # not optimized yet
            ret.mass = 3060. * CV.LB_TO_KG + STD_CARGO_KG
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6],
                                                                    [0.1]]
            ret.lateralTuning.pid.kf = 0.00007818594

        elif candidate == CAR.LEXUS_ESH_TSS2:
            stop_and_go = True
            ret.safetyParam = 73
            ret.wheelbase = 2.8702
            ret.steerRatio = 16.0  # not optimized
            tire_stiffness_factor = 0.444  # not optimized yet
            ret.mass = 3704. * CV.LB_TO_KG + STD_CARGO_KG
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6],
                                                                    [0.1]]
            ret.lateralTuning.pid.kf = 0.00007818594

        elif candidate == CAR.SIENNA:
            stop_and_go = True
            ret.safetyParam = 73
            ret.wheelbase = 3.03
            ret.steerRatio = 16.0
            tire_stiffness_factor = 0.444
            ret.mass = 4590. * CV.LB_TO_KG + STD_CARGO_KG
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3],
                                                                    [0.05]]
            ret.lateralTuning.pid.kf = 0.00007818594

        ret.steerRateCost = 1.
        ret.centerToFront = ret.wheelbase * 0.44

        #detect the Pedal address
        ret.enableGasInterceptor = 0x201 in fingerprint

        # 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 = -1. if (
            stop_and_go or ret.enableGasInterceptor) else 19. * CV.MPH_TO_MS

        # 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,
            tire_stiffness_factor=tire_stiffness_factor)

        # no rear steering, at least on the listed cars above
        ret.steerRatioRear = 0.
        ret.steerControlType = car.CarParams.SteerControlType.torque

        # 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.brakeMaxBP = [0.]
        ret.brakeMaxV = [1.]

        ret.enableCamera = not check_ecu_msgs(fingerprint, ECU.CAM)
        ret.enableDsu = not check_ecu_msgs(fingerprint, ECU.DSU)
        ret.enableApgs = False  #not check_ecu_msgs(fingerprint, ECU.APGS)
        ret.openpilotLongitudinalControl = ret.enableCamera and ret.enableDsu
        cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera)
        cloudlog.warn("ECU DSU Simulated: %r", ret.enableDsu)
        cloudlog.warn("ECU APGS Simulated: %r", ret.enableApgs)
        cloudlog.warn("ECU Gas Interceptor: %r", ret.enableGasInterceptor)

        ret.steerLimitAlert = False

        ret.longitudinalTuning.deadzoneBP = [0., 9.]
        ret.longitudinalTuning.deadzoneV = [0., .15]
        ret.longitudinalTuning.kpBP = [0., 5., 35.]
        ret.longitudinalTuning.kiBP = [0., 35.]
        ret.stoppingControl = False
        ret.startAccel = 0.0

        if ret.enableGasInterceptor:
            ret.gasMaxBP = [0., 9., 35]
            ret.gasMaxV = [0.2, 0.5, 0.7]
            ret.longitudinalTuning.kpV = [1.2, 0.8, 0.5]
            ret.longitudinalTuning.kiV = [0.18, 0.12]
        else:
            ret.gasMaxBP = [0.]
            ret.gasMaxV = [0.5]
            ret.longitudinalTuning.kpV = [3.6, 2.4, 1.5]
            ret.longitudinalTuning.kiV = [0.54, 0.36]

        return ret
示例#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 = "toyota"
        ret.carFingerprint = candidate

        ret.safetyModel = car.CarParams.SafetyModels.toyota

        # pedal
        ret.enableCruise = not ret.enableGasInterceptor

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

        ret.steerKiBP, ret.steerKpBP = [[0.], [0.]]
        ret.steerActuatorDelay = 0.12  # Default delay, Prius has larger delay

        if candidate == CAR.PRIUS:
            stop_and_go = True
            ret.safetyParam = 66  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.70
            ret.steerRatio = 15.00  # unknown end-to-end spec
            tire_stiffness_factor = 0.6371  # hand-tune
            ret.mass = 3045 * CV.LB_TO_KG + std_cargo
            ret.steerKpV, ret.steerKiV = [[0.4], [0.01]]
            ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594
            # TODO: Prius seem to have very laggy actuators. Understand if it is lag or hysteresis
            ret.steerActuatorDelay = 0.25

        elif candidate in [CAR.RAV4, CAR.RAV4H]:
            stop_and_go = True if (candidate in CAR.RAV4H) else False
            ret.safetyParam = 73  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.65
            ret.steerRatio = 16.30  # 14.5 is spec end-to-end
            tire_stiffness_factor = 0.5533
            ret.mass = 3650 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid
            ret.steerKpV, ret.steerKiV = [[0.6], [0.05]]
            ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594

        elif candidate == CAR.COROLLA:
            stop_and_go = False
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.70
            ret.steerRatio = 17.8
            tire_stiffness_factor = 0.444
            ret.mass = 2860 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid
            ret.steerKpV, ret.steerKiV = [[0.2], [0.05]]
            ret.steerKf = 0.00003  # full torque for 20 deg at 80mph means 0.00007818594

        elif candidate == CAR.LEXUS_RXH:
            stop_and_go = True
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.79
            ret.steerRatio = 16.  # 14.8 is spec end-to-end
            tire_stiffness_factor = 0.444  # not optimized yet
            ret.mass = 4481 * CV.LB_TO_KG + std_cargo  # mean between min and max
            ret.steerKpV, ret.steerKiV = [[0.6], [0.1]]
            ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594

        elif candidate in [CAR.CHR, CAR.CHRH]:
            stop_and_go = True
            ret.safetyParam = 100
            ret.wheelbase = 2.63906
            ret.steerRatio = 13.6
            tire_stiffness_factor = 0.7933
            ret.mass = 3300. * CV.LB_TO_KG + std_cargo
            ret.steerKpV, ret.steerKiV = [[0.723], [0.0428]]
            ret.steerKf = 0.00006

        elif candidate in [CAR.CAMRY, CAR.CAMRYH]:
            stop_and_go = True
            ret.safetyParam = 100
            ret.wheelbase = 2.82448
            ret.steerRatio = 13.7
            tire_stiffness_factor = 0.7933
            ret.mass = 3400 * CV.LB_TO_KG + std_cargo  #mean between normal and hybrid
            ret.steerKpV, ret.steerKiV = [[0.6], [0.1]]
            ret.steerKf = 0.00006

        elif candidate in [CAR.HIGHLANDER, CAR.HIGHLANDERH]:
            stop_and_go = True
            ret.safetyParam = 100
            ret.wheelbase = 2.78
            ret.steerRatio = 16.0
            tire_stiffness_factor = 0.444  # not optimized yet
            ret.mass = 4607 * CV.LB_TO_KG + std_cargo  #mean between normal and hybrid limited
            ret.steerKpV, ret.steerKiV = [[0.6], [0.05]]
            ret.steerKf = 0.00006

        ret.steerRateCost = 1.
        ret.centerToFront = ret.wheelbase * 0.44

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

        #detect the Pedal address
        ret.enableGasInterceptor = 0x201 in fingerprint

        # 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 = -1. if (
            stop_and_go or ret.enableGasInterceptor) else 19. * CV.MPH_TO_MS

        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 * tire_stiffness_factor) * \
                                 ret.mass / mass_civic * \
                                 (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic)
        ret.tireStiffnessRear = (tireStiffnessRear_civic * tire_stiffness_factor) * \
                                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.
        ret.steerControlType = car.CarParams.SteerControlType.torque

        # 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.brakeMaxBP = [5., 20.]
        ret.brakeMaxV = [1., 0.8]

        ret.enableCamera = not check_ecu_msgs(fingerprint, ECU.CAM)
        ret.enableDsu = not check_ecu_msgs(fingerprint, ECU.DSU)
        ret.enableApgs = False  #not check_ecu_msgs(fingerprint, ECU.APGS)
        ret.openpilotLongitudinalControl = ret.enableCamera and ret.enableDsu
        cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera)
        cloudlog.warn("ECU DSU Simulated: %r", ret.enableDsu)
        cloudlog.warn("ECU APGS Simulated: %r", ret.enableApgs)
        cloudlog.warn("ECU Gas Interceptor: %r", ret.enableGasInterceptor)

        ret.steerLimitAlert = False
        ret.longitudinalKpBP = [0., 5., 35.]
        ret.longitudinalKiBP = [0., 35.]
        ret.stoppingControl = False

        if ret.enableGasInterceptor:
            ret.gasMaxBP = [0., 9., 35]
            ret.gasMaxV = [0.2, 0.5, 0.7]
            ret.longitudinalKpV = [1.2, 0.8, 0.5]
            ret.longitudinalKiV = [0.18, 0.12]
        else:
            ret.gasMaxBP = [0.]
            ret.gasMaxV = [0.5]
            ret.longitudinalKpV = [3.6, 2.4, 1.5]
            ret.longitudinalKiV = [0.54, 0.36]

        return ret
示例#4
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 = "toyota"
        ret.radarName = "toyota"
        ret.carFingerprint = candidate

        ret.safetyModel = car.CarParams.SafetyModels.toyota

        ret.enableSteer = True
        ret.enableBrake = True

        # 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
        tireStiffnessRear_civic = 90000

        stop_and_go = True
        ret.mass = 3045. / 2.205 + std_cargo
        ret.wheelbase = 2.70
        ret.centerToFront = ret.wheelbase * 0.44
        ret.steerRatio = 14.5  #Rav4 2017, TODO: find exact value for Prius
        ret.steerKp, ret.steerKi = 0.6, 0.05
        ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594

        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.
        if candidate == CAR.PRIUS:
            ret.minEnableSpeed = -1.
        elif candidate == CAR.RAV4:  # TODO: hack Rav4 to do stop and go
            ret.minEnableSpeed = 19. * CV.MPH_TO_MS

        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 = 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.enableGas = True

        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
示例#5
0
                            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.
    ret.steerControlType = car.CarParams.SteerControlType.torque

    # 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 = not check_ecu_msgs(fingerprint, candidate, ECU.DSU)
    ret.enableApgs = False #not check_ecu_msgs(fingerprint, candidate, ECU.APGS)
    cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera)
    cloudlog.warn("ECU DSU Simulated: %r", ret.enableDsu)
    cloudlog.warn("ECU APGS Simulated: %r", 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]
示例#6
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 = "toyota"
        ret.carFingerprint = candidate

        ret.safetyModel = car.CarParams.SafetyModels.toyota

        # 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 * CV.LB_TO_KG + std_cargo
        wheelbase_civic = 2.70
        centerToFront_civic = wheelbase_civic * 0.4
        centerToRear_civic = wheelbase_civic - centerToFront_civic
        rotationalInertia_civic = 2500
        tireStiffnessFront_civic = 192150
        tireStiffnessRear_civic = 202500

        ret.steerKiBP, ret.steerKpBP = [[0.], [0.]]
        ret.steerActuatorDelay = 0.12  # Default delay, Prius has larger delay

        if candidate == CAR.PRIUS:  # experimenting with different values for 2018 prime
            ret.safetyParam = 66  # was 66
            ret.wheelbase = 2.70  # 2.70 verified correct for 2018 prime
            ret.steerRatio = 13.4  # was 15.59, updated for prime per @larryjustin
            tire_stiffness_factor = 0.7933
            ret.mass = 3370 * CV.LB_TO_KG + std_cargo  # was 3045,  updated for prime per @larryjustin
            ret.steerKpV, ret.steerKiV = [
                [0.3], [0.06]
            ]  # was 0.4, 0.01. For minor corrections, car was overshooting. Turn down K, bump I.
            ret.steerKf = 0.00008  # was 0.00006; need more torque to keep car on the road.
            # TODO: Prius seem to have very laggy actuators. Understand if it is lag or hysteresis
            # ret.steerActuatorDelay = 0.25                # was 0.25

        elif candidate in [CAR.RAV4, CAR.RAV4H]:
            ret.safetyParam = 73  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.65
            ret.steerRatio = 16.30  # 14.5 is spec end-to-end
            tire_stiffness_factor = 0.5533
            ret.mass = 3650 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid
            ret.steerKpV, ret.steerKiV = [[0.6], [0.05]]
            ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594

        elif candidate == CAR.COROLLA:
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.70
            ret.steerRatio = 17.8
            tire_stiffness_factor = 0.444
            ret.mass = 2860 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid
            ret.steerKpV, ret.steerKiV = [[0.2], [0.05]]
            ret.steerKf = 0.00003  # full torque for 20 deg at 80mph means 0.00007818594

        elif candidate == CAR.LEXUS_RXH:
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.79
            ret.steerRatio = 16.  # 14.8 is spec end-to-end
            tire_stiffness_factor = 0.444  # not optimized yet
            ret.mass = 4481 * CV.LB_TO_KG + std_cargo  # mean between min and max
            ret.steerKpV, ret.steerKiV = [[0.6], [0.1]]
            ret.steerKf = 0.00006  # full torque for 10 deg at 80mph means 0.00007818594

        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.
        if candidate in [CAR.PRIUS, CAR.RAV4H,
                         CAR.LEXUS_RXH]:  # rav4 hybrid can do stop and go
            ret.minEnableSpeed = -1.
        elif candidate in [CAR.RAV4,
                           CAR.COROLLA]:  # TODO: hack ICE to do stop and go
            ret.minEnableSpeed = 19. * CV.MPH_TO_MS

        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 * tire_stiffness_factor) * \
                                 ret.mass / mass_civic * \
                                 (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic)
        ret.tireStiffnessRear = (tireStiffnessRear_civic * tire_stiffness_factor) * \
                                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.
        ret.steerControlType = car.CarParams.SteerControlType.torque

        # 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 = not check_ecu_msgs(fingerprint, candidate, ECU.DSU)
        ret.enableApgs = False  #not check_ecu_msgs(fingerprint, candidate, ECU.APGS)
        cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera)
        cloudlog.warn("ECU DSU Simulated: %r", ret.enableDsu)
        cloudlog.warn("ECU APGS Simulated: %r", 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
示例#7
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 = "toyota"
        ret.carFingerprint = candidate

        ret.safetyModel = car.CarParams.SafetyModels.toyota

        # pedal
        ret.enableCruise = not ret.enableGasInterceptor

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

        #ret.steerKiBP, ret.steerKpBP = [[0.], [0.]]
        #ret.steerActuatorDelay = 0.001  # Default delay, Prius has larger delay

        ret.longitudinalTuning.deadzoneBP = [0., 9.]
        ret.longitudinalTuning.deadzoneV = [0., .15]
        ret.longitudinalTuning.kpBP = [0., 5., 55.]
        ret.longitudinalTuning.kiBP = [0., 55.]
        ret.stoppingControl = False
        ret.startAccel = 0.0

        if ret.enableGasInterceptor:
            ret.gasMaxBP = [0., 9., 55]
            ret.gasMaxV = [0.2, 0.5, 0.7]
            ret.longitudinalTuning.kpV = [1.0, 0.66, 0.42]  # braking tune
            ret.longitudinalTuning.kiV = [0.135, 0.09]
        else:
            ret.gasMaxBP = [0.]
            ret.gasMaxV = [0.5]
            ret.longitudinalTuning.kpV = [2.0, 1.0,
                                          0.5]  # braking tune from rav4h
            ret.longitudinalTuning.kiV = [0.30, 0.20]

        ret.steerActuatorDelay = 0.12  # Default delay, Prius has larger delay
        if candidate != CAR.PRIUS:
            ret.lateralTuning.init('pid')
            ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.],
                                                                      [0.]]

        if candidate == CAR.PRIUS:
            stop_and_go = True
            ret.safetyParam = 66  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.70
            ret.steerRatio = 15.00  # unknown end-to-end spec
            tire_stiffness_factor = 0.6371  # hand-tune
            ret.mass = 3045 * CV.LB_TO_KG + std_cargo

            ret.lateralTuning.init('indi')
            ret.lateralTuning.indi.innerLoopGain = 4.0
            ret.lateralTuning.indi.outerLoopGain = 3.0
            ret.lateralTuning.indi.timeConstant = 1.0
            ret.lateralTuning.indi.actuatorEffectiveness = 1.0

            ret.steerActuatorDelay = 0.5
            ret.steerRateCost = 0.5

        elif candidate in [CAR.RAV4]:
            stop_and_go = True if ret.enableGasInterceptor else False
            ret.safetyParam = 73  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.66  # 2.65 default
            ret.steerRatio = 17.28  # Rav4 0.5.10 tuning value
            ret.mass = 4100. / 2.205 + std_cargo  # mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[
                0.3
            ], [0.03]]  #0.6 0.05 default
            ret.wheelbase = 2.65
            tire_stiffness_factor = 0.5533
            ret.lateralTuning.pid.kf = 0.00001  # full torque for 10 deg at 80mph means 0.00007818594

        elif candidate in [CAR.RAV4H]:
            stop_and_go = True
            ret.safetyParam = 73  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.65  # 2.65 default
            ret.steerRatio = 16.53  # 0.5.10 tuning
            ret.mass = 4100. / 2.205 + std_cargo  # mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[
                0.3
            ], [0.03]]  #0.6 0.05 default
            ret.wheelbase = 2.65
            tire_stiffness_factor = 0.5533
            ret.lateralTuning.pid.kf = 0.0001  # full torque for 10 deg at 80mph means 0.00007818594

        elif candidate == CAR.RAV4_2019:
            stop_and_go = True
            ret.safetyParam = 100
            ret.wheelbase = 2.68986
            ret.steerRatio = 17.0
            tire_stiffness_factor = 0.7933
            ret.mass = 3370. * CV.LB_TO_KG + std_cargo
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3],
                                                                    [0.05]]
            ret.lateralTuning.pid.kf = 0.0001

        elif candidate == CAR.COROLLA_HATCH:
            stop_and_go = True
            ret.safetyParam = 100
            ret.wheelbase = 2.63906
            ret.steerRatio = 13.9
            tire_stiffness_factor = 0.444
            ret.mass = 3060. * CV.LB_TO_KG + std_cargo
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.17],
                                                                    [0.03]]
            ret.lateralTuning.pid.kf = 0.00007818594

        elif candidate == CAR.COROLLA:
            stop_and_go = True if ret.enableGasInterceptor else False
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.70
            ret.steerRatio = 17.84  # 0.5.10
            tire_stiffness_factor = 1.01794
            ret.mass = 2860 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2],
                                                                    [0.05]]
            ret.lateralTuning.pid.kf = 0.00003909297  # full torque for 20 deg at 80mph means 0.00007818594

        elif candidate in [CAR.LEXUS_RXH, CAR.LEXUS_RX]:
            stop_and_go = True
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.79
            ret.steerRatio = 18.6  # 0.5.10
            tire_stiffness_factor = 0.517  # 0.5.10
            ret.mass = 4481 * CV.LB_TO_KG + std_cargo  # mean between min and max
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2],
                                                                    [0.02]]
            ret.lateralTuning.pid.kf = 0.00007  # full torque for 10 deg at 80mph means 0.00007818594

        elif candidate == CAR.LEXUS_IS:
            stop_and_go = False
            ret.safetyParam = 100
            ret.wheelbase = 2.79908
            ret.steerRatio = 13.3  #from Q
            tire_stiffness_factor = 0.444  #from Q
            ret.mass = 3737 * CV.LB_TO_KG + std_cargo  # mean between min and max
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.19],
                                                                    [0.04]
                                                                    ]  #from Q
            ret.lateralTuning.pid.kf = 0.00006  #from Q

        elif candidate == CAR.LEXUS_ISH:
            stop_and_go = True
            ret.safetyParam = 66
            ret.wheelbase = 2.80  # in spec
            ret.steerRatio = 13.3  # in spec
            tire_stiffness_factor = 0.444  # from camry
            ret.mass = 3736.8 * CV.LB_TO_KG + std_cargo  # in spec, mean of is300 (1680 kg) / is300h (1720 kg) / is350 (1685 kg)
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.19],
                                                                    [0.04]]
            ret.lateralTuning.pid.kf = 0.00006  # from camry

        elif candidate in [CAR.CHR, CAR.CHRH]:
            stop_and_go = True
            ret.safetyParam = 100
            ret.wheelbase = 2.63906
            ret.steerRatio = 15.6
            tire_stiffness_factor = 0.7933
            ret.mass = 3300. * CV.LB_TO_KG + std_cargo
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.723],
                                                                    [0.0428]]
            ret.lateralTuning.pid.kf = 0.00006

        elif candidate in [CAR.CAMRY, CAR.CAMRYH]:
            stop_and_go = True
            ret.safetyParam = 100
            ret.wheelbase = 2.82448
            ret.steerRatio = 17.7  # 0.5.10
            tire_stiffness_factor = 0.7933
            ret.mass = 3400 * CV.LB_TO_KG + std_cargo  #mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3],
                                                                    [0.03]]
            ret.lateralTuning.pid.kf = 0.0001

        elif candidate in [CAR.HIGHLANDER, CAR.HIGHLANDERH]:
            stop_and_go = True
            ret.safetyParam = 100
            ret.wheelbase = 2.78
            ret.steerRatio = 17.36  # 0.5.10
            tire_stiffness_factor = 0.444  # not optimized yet
            ret.mass = 4607 * CV.LB_TO_KG + std_cargo  #mean between normal and hybrid limited
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.18],
                                                                    [0.0075]]
            ret.lateralTuning.pid.kf = 0.00015

        elif candidate == CAR.AVALON:
            stop_and_go = False
            ret.safetyParam = 73  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.17],
                                                                    [0.03]]
            ret.lateralTuning.pid.kf = 0.00006
            ret.wheelbase = 2.82
            ret.steerRatio = 14.8  #Found at https://pressroom.toyota.com/releases/2016+avalon+product+specs.download
            tire_stiffness_factor = 0.7983
            ret.mass = 3505 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid

        elif candidate == CAR.OLD_CAR:
            stop_and_go = True
            ret.safetyParam = 100  # see conversion factor for STEER_TORQUE_EPS in dbc file
            ret.wheelbase = 2.455
            ret.steerRatio = 17.
            tire_stiffness_factor = 0.444
            ret.mass = 6200 * CV.LB_TO_KG + std_cargo  # mean between normal and hybrid
            ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.10],
                                                                    [0.04]]
            ret.lateralTuning.pid.kf = 0.00004  # full torque for 20 deg at 80mph means 0.00007818594
            if ret.enableGasInterceptor:
                ret.gasMaxV = [0.2, 0.5, 0.7]
                ret.longitudinalTuning.kpV = [1.2, 0.8, 0.5]
                ret.longitudinalTuning.kiV = [0.18, 0.12]
            else:
                ret.gasMaxV = [0.2, 0.5, 0.7]
                ret.longitudinalTuning.kpV = [3.6, 1.1, 1.0]
                ret.longitudinalTuning.kiV = [0.5, 0.24]

        if candidate == CAR.OLD_CAR:
            ret.centerToFront = ret.wheelbase * 0.5
        else:
            ret.centerToFront = ret.wheelbase * 0.44

        ret.steerRateCost = 1.

        #detect the Pedal address
        ret.enableGasInterceptor = 0x201 in fingerprint

        # 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 = -1. if (
            stop_and_go or ret.enableGasInterceptor) else 19. * CV.MPH_TO_MS

        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 * tire_stiffness_factor) * \
                                 ret.mass / mass_civic * \
                                 (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic)
        ret.tireStiffnessRear = (tireStiffnessRear_civic * tire_stiffness_factor) * \
                                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.
        ret.steerControlType = car.CarParams.SteerControlType.torque

        # 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., 9., 35.]
        #ret.gasMaxV = [0.2, 0.5, 0.7]
        ret.brakeMaxBP = [5., 20.]
        ret.brakeMaxV = [1., 0.8]

        ret.enableCamera = not check_ecu_msgs(fingerprint, ECU.CAM)
        ret.enableDsu = not check_ecu_msgs(fingerprint, ECU.DSU)
        ret.enableApgs = False  #not check_ecu_msgs(fingerprint, ECU.APGS)
        ret.openpilotLongitudinalControl = ret.enableCamera and ret.enableDsu
        cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera)
        cloudlog.warn("ECU DSU Simulated: %r", ret.enableDsu)
        cloudlog.warn("ECU APGS Simulated: %r", ret.enableApgs)
        cloudlog.warn("ECU Gas Interceptor: %r", ret.enableGasInterceptor)

        ret.steerLimitAlert = False

        ret.longitudinalTuning.deadzoneBP = [0., 9.]
        ret.longitudinalTuning.deadzoneV = [0., .15]
        ret.longitudinalTuning.kpBP = [0., 5., 35.]
        ret.longitudinalTuning.kiBP = [0., 35.]
        ret.stoppingControl = False
        ret.startAccel = 0.0

        #if ret.enableGasInterceptor:
        #  ret.gasMaxBP = [0., 9., 35]
        #  ret.gasMaxV = [0.2, 0.5, 0.7]
        #  ret.longitudinalTuning.kpV = [1.2, 0.8, 0.5]
        #  ret.longitudinalTuning.kiV = [0.18, 0.12]
        #else:
        #  ret.gasMaxBP = [0.]
        #  ret.gasMaxV = [0.5]
        #  ret.longitudinalTuning.kpV = [3.6, 2.4, 1.5]
        #  ret.longitudinalTuning.kiV = [0.54, 0.36]

        return ret