Skip to content

Commit

Permalink
January 20, 2024 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogAi committed Jan 20, 2024
1 parent 527f49a commit 22f3f58
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions selfdrive/frogpilot/ui/control_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.", ""},
Expand Down Expand Up @@ -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<int, QString>(), this, false);
toggle = new FrogPilotParamValueControlFloat(param, title, desc, icon, steerRatioStock * 0.75, steerRatioStock * 1.25, std::map<int, QString>(), this, false, "", 10.0);

} else if (param == "LongitudinalTune") {
FrogPilotParamManageControl *longitudinalTuneToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
Expand Down Expand Up @@ -429,7 +429,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
void FrogPilotControlsPanel::updateCarToggles() {
FrogPilotParamValueControlFloat *steerRatioToggle = static_cast<FrogPilotParamValueControlFloat*>(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();
}
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/frogpilot/ui/control_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
};
2 changes: 1 addition & 1 deletion selfdrive/locationd/paramsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 22f3f58

Please sign in to comment.