diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 8b0d8695ec7b6e..de6b35aee9459f 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -1011,7 +1011,7 @@ def update_frogpilot_params(self): self.green_light_alert = self.params.get_bool("GreenLightAlert") lateral_tune = self.params.get_bool("LateralTune") - self.steer_ratio = self.params.get_float("SteerRatioStock") + self.steer_ratio = self.params.get_float("SteerRatio") if lateral_tune else self.params.get_float("SteerRatioStock") longitudinal_tune = self.params.get_bool("LongitudinalTune") self.sport_plus = self.params.get_int("AccelerationProfile") == 3 and longitudinal_tune diff --git a/selfdrive/frogpilot/ui/control_settings.cc b/selfdrive/frogpilot/ui/control_settings.cc index 104496ec22cc49..fbb93a164bcdb2 100644 --- a/selfdrive/frogpilot/ui/control_settings.cc +++ b/selfdrive/frogpilot/ui/control_settings.cc @@ -28,7 +28,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil {"LateralTune", "Lateral Tuning", "Modify openpilot's steering behavior.", "../frogpilot/assets/toggle_icons/icon_lateral_tune.png"}, {"AverageCurvature", "Average Desired Curvature", "Use Pfeiferj's distance-based curvature adjustment for improved curve handling.", ""}, {"NNFF", "NNFF - Neural Network Feedforward", "Use Twilsonco's Neural Network Feedforward for enhanced precision in lateral control.", ""}, - {"SteerRatio", steerRatioStock != 0 ? QString("Steer Ratio (Default: " + QString::number(steerRatioStock) + ")") : "Steer Ratio", "Set a custom steer ratio for your vehicle controls.", ""}, + {"SteerRatio", steerRatioStock != 0 ? QString("Steer Ratio (Default: %1)").arg(steerRatioStock, 0, 'f', 2) : "Steer Ratio", "Set a custom steer ratio for your vehicle controls.", ""}, {"LongitudinalTune", "Longitudinal Tuning", "Modify openpilot's acceleration and braking behavior.", "../frogpilot/assets/toggle_icons/icon_longitudinal_tune.png"}, {"AccelerationProfile", "Acceleration Profile", "Change the acceleration rate to be either sporty or eco-friendly.", ""}, @@ -195,7 +195,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil }); toggle = lateralTuneToggle; } else if (param == "SteerRatio") { - toggle = new FrogPilotParamValueControlFloat(param, title, desc, icon, steerRatioStock * 0.75, steerRatioStock * 1.25, std::map(), this, false); + toggle = new FrogPilotParamValueControlFloat(param, title, desc, icon, steerRatioStock * 0.75, steerRatioStock * 1.25, std::map(), this, false, "", 10.0); } else if (param == "LongitudinalTune") { FrogPilotParamManageControl *longitudinalTuneToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); @@ -429,7 +429,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil void FrogPilotControlsPanel::updateCarToggles() { FrogPilotParamValueControlFloat *steerRatioToggle = static_cast(toggles["SteerRatio"]); steerRatioStock = params.getFloat("SteerRatioStock"); - steerRatioToggle->setTitle(steerRatioStock != 0 ? QString("Steer Ratio (Default: " + QString::number(steerRatioStock) + ")") : QString("Steer Ratio")); + steerRatioToggle->setTitle(steerRatioStock != 0 ? QString("Steer Ratio (Default: %1)").arg(steerRatioStock, 0, 'f', 2) : QString("Steer Ratio")); steerRatioToggle->updateControl(steerRatioStock * 0.75, steerRatioStock * 1.25, "", 10.0); steerRatioToggle->refresh(); } diff --git a/selfdrive/frogpilot/ui/control_settings.h b/selfdrive/frogpilot/ui/control_settings.h index bbd3a786e547a9..b0292492e62d1f 100644 --- a/selfdrive/frogpilot/ui/control_settings.h +++ b/selfdrive/frogpilot/ui/control_settings.h @@ -49,5 +49,5 @@ class FrogPilotControlsPanel : public FrogPilotListWidget { Params paramsMemory{"/dev/shm/params"}; bool isMetric = params.getBool("IsMetric"); - int steerRatioStock = params.getFloat("SteerRatioStock"); + float steerRatioStock = params.getFloat("SteerRatioStock"); }; diff --git a/selfdrive/locationd/paramsd.py b/selfdrive/locationd/paramsd.py index 678fc6bb66b5ae..bf3f4f345af7d5 100755 --- a/selfdrive/locationd/paramsd.py +++ b/selfdrive/locationd/paramsd.py @@ -136,7 +136,7 @@ def main(): steer_ratio_stock = params_reader.get_float("SteerRatioStock") if steer_ratio_stock != CP.steerRatio: - params_reader.put_int("SteerRatio", CP.steerRatio * 100) + params_reader.put_float("SteerRatio", CP.steerRatio) params_reader.put_float("SteerRatioStock", CP.steerRatio) params_reader.put_bool("DoReboot", True)