Subaru Crosstrek Torque increase

Add toggle to increase the torque for the Subaru Crosstrek.
This commit is contained in:
FrogAi
2024-04-10 19:23:19 -07:00
parent 7f4a6ef970
commit aecaa132e3
6 changed files with 13 additions and 6 deletions
+1
View File
@@ -248,6 +248,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"CEStopLightsLead", PERSISTENT},
{"Compass", PERSISTENT},
{"ConditionalExperimental", PERSISTENT},
{"CrosstrekTorque", PERSISTENT},
{"CurrentHolidayTheme", PERSISTENT},
{"CustomAlerts", PERSISTENT},
{"CustomColors", PERSISTENT},
+1 -1
View File
@@ -17,7 +17,7 @@
}
const SteeringLimits SUBARU_STEERING_LIMITS = SUBARU_STEERING_LIMITS_GENERATOR(2047, 50, 70);
const SteeringLimits SUBARU_STEERING_LIMITS = SUBARU_STEERING_LIMITS_GENERATOR(3071, 50, 70);
const SteeringLimits SUBARU_GEN2_STEERING_LIMITS = SUBARU_STEERING_LIMITS_GENERATOR(1000, 40, 40);
+4 -2
View File
@@ -11,6 +11,8 @@ class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, params, candidate: CAR, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
crosstrek_torque_increase = params.get_bool("CrosstrekTorque")
ret.carName = "subaru"
ret.radarUnavailable = True
# for HYBRID CARS to be upstreamed, we need:
@@ -51,9 +53,9 @@ class CarInterface(CarInterfaceBase):
elif candidate == CAR.IMPREZA:
ret.steerActuatorDelay = 0.4 # end-to-end angle controller
ret.lateralTuning.init('pid')
ret.lateralTuning.pid.kf = 0.00005
ret.lateralTuning.pid.kf = 0.00003333 if crosstrek_torque_increase else 0.00005
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0., 20.], [0., 20.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2, 0.3], [0.02, 0.03]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.133, 0.2], [0.0133, 0.02]] if crosstrek_torque_increase else [[0.2, 0.3], [0.02, 0.03]]
elif candidate == CAR.IMPREZA_2020:
ret.lateralTuning.init('pid')
+2
View File
@@ -26,6 +26,8 @@ class CarControllerParams:
self.STEER_DELTA_DOWN = 40
elif CP.carFingerprint == CAR.IMPREZA_2020:
self.STEER_MAX = 1439
elif CP.carFingerprint == CAR.IMPREZA and Params().get_bool("CrosstrekTorque"):
self.STEER_MAX = 3071
else:
self.STEER_MAX = 2047
@@ -115,6 +115,8 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(SettingsWindow *parent) : FrogPil
{"LongPitch", tr("Long Pitch Compensation"), tr("Smoothen out the gas and pedal controls."), ""},
{"GasRegenCmd", tr("Truck Tune"), tr("Increase the acceleration and smoothen out the brake control when coming to a stop. For use on Silverado/Sierra only."), ""},
{"CrosstrekTorque", tr("Subaru Crosstrek Torque Increase"), tr("Increases the maximum allowed torque for the Subaru Crosstrek."), ""},
{"ToyotaDoors", tr("Automatically Lock/Unlock Doors"), tr("Automatically lock the doors when in drive and unlock when in park."), ""},
{"LongitudinalTune", tr("Longitudinal Tune"), tr("Use a custom Toyota longitudinal tune.\n\nCydia = More focused on TSS-P vehicles but works for all Toyotas\n\nDragonPilot = Focused on TSS2 vehicles\n\nFrogPilot = Takes the best of both worlds with some personal tweaks focused around FrogsGoMoo's 2019 Lexus ES 350"), ""},
};
@@ -161,7 +163,7 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(SettingsWindow *parent) : FrogPil
});
}
std::set<QString> rebootKeys = {"GasRegenCmd"};
std::set<QString> rebootKeys = {"CrosstrekTorque", "GasRegenCmd"};
for (const QString &key : rebootKeys) {
QObject::connect(toggles[key.toStdString().c_str()], &ToggleControl::toggleFlipped, [this]() {
if (started) {
@@ -256,7 +258,7 @@ void FrogPilotVehiclesPanel::hideToggles() {
std::set<QString> evCarKeys = {};
std::set<QString> gmTruckKeys = {"GasRegenCmd"};
std::set<QString> imprezaKeys = {};
std::set<QString> imprezaKeys = {"CrosstrekTorque"};
std::set<QString> longitudinalKeys = {"GasRegenCmd", "LongitudinalTune", "LongPitch"};
std::set<QString> sngKeys = {};
@@ -30,7 +30,7 @@ private:
QStringList models;
std::set<QString> gmKeys = {"GasRegenCmd", "LongPitch"};
std::set<QString> subaruKeys = {};
std::set<QString> subaruKeys = {"CrosstrekTorque"};
std::set<QString> toyotaKeys = {"LongitudinalTune", "ToyotaDoors"};
std::map<std::string, ParamControl*> toggles;