Custom driving personality profiles
Added toggles to customize the driving personality profiles.
This commit is contained in:
BIN
selfdrive/frogpilot/assets/toggle_icons/icon_custom.png
Normal file
BIN
selfdrive/frogpilot/assets/toggle_icons/icon_custom.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -101,6 +101,14 @@ class FrogPilotPlanner:
|
||||
if not params.get_bool("ExperimentalMode"):
|
||||
params.put_bool("ExperimentalMode", True)
|
||||
|
||||
self.custom_personalities = params.get_bool("CustomPersonalities")
|
||||
self.aggressive_follow = params.get_int("AggressiveFollow") / 10
|
||||
self.standard_follow = params.get_int("StandardFollow") / 10
|
||||
self.relaxed_follow = params.get_int("RelaxedFollow") / 10
|
||||
self.aggressive_jerk = params.get_int("AggressiveJerk") / 10
|
||||
self.standard_jerk = params.get_int("StandardJerk") / 10
|
||||
self.relaxed_jerk = params.get_int("RelaxedJerk") / 10
|
||||
|
||||
lateral_tune = params.get_bool("LateralTune")
|
||||
self.average_desired_curvature = params.get_bool("AverageCurvature") and lateral_tune
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
|
||||
{"CEStopLights", "Stop Lights and Stop Signs", "Switch to 'Experimental Mode' when a stop light or stop sign is detected.", ""},
|
||||
{"CESignal", "Turn Signal When Below Highway Speeds", "Switch to 'Experimental Mode' when using turn signals below highway speeds to help assit with turns.", ""},
|
||||
|
||||
{"CustomPersonalities", "Custom Driving Personalities", "Customize the driving personality profiles to your driving style.", "../frogpilot/assets/toggle_icons/icon_custom.png"},
|
||||
|
||||
{"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.", ""},
|
||||
|
||||
@@ -72,6 +74,46 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
|
||||
std::vector<QString> stopLightToggleNames{tr("With Lead")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, stopLightToggles, stopLightToggleNames);
|
||||
|
||||
} else if (param == "CustomPersonalities") {
|
||||
FrogPilotParamManageControl *customPersonalitiesToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(customPersonalitiesToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(false);
|
||||
}
|
||||
aggressiveProfile->setVisible(true);
|
||||
standardProfile->setVisible(true);
|
||||
relaxedProfile->setVisible(true);
|
||||
});
|
||||
toggle = customPersonalitiesToggle;
|
||||
|
||||
FrogPilotParamValueControl *aggressiveFollow = new FrogPilotParamValueControl("AggressiveFollow", "Follow",
|
||||
"Set the 'Aggressive' personality' following distance. Represents seconds to follow behind the lead vehicle.\n\nStock: 1.25 seconds.", "../frogpilot/assets/other_images/aggressive.png",
|
||||
10, 50, std::map<int, QString>(), this, false, " sec", 10);
|
||||
FrogPilotParamValueControl *aggressiveJerk = new FrogPilotParamValueControl("AggressiveJerk", " Jerk",
|
||||
"Configure brake/gas pedal responsiveness for the 'Aggressive' personality. Higher values yield a more 'relaxed' response.\n\nStock: 0.5.", "", 1, 50,
|
||||
std::map<int, QString>(), this, false, "", 10);
|
||||
aggressiveProfile = new FrogPilotDualParamControl(aggressiveFollow, aggressiveJerk, this, true);
|
||||
addItem(aggressiveProfile);
|
||||
|
||||
FrogPilotParamValueControl *standardFollow = new FrogPilotParamValueControl("StandardFollow", "Follow",
|
||||
"Set the 'Standard' personality following distance. Represents seconds to follow behind the lead vehicle.\n\nStock: 1.45 seconds.", "../frogpilot/assets/other_images/standard.png",
|
||||
10, 50, std::map<int, QString>(), this, false, " sec", 10);
|
||||
FrogPilotParamValueControl *standardJerk = new FrogPilotParamValueControl("StandardJerk", " Jerk",
|
||||
"Adjust brake/gas pedal responsiveness for the 'Standard' personality. Higher values yield a more 'relaxed' response.\n\nStock: 1.0.", "", 1, 50,
|
||||
std::map<int, QString>(), this, false, "", 10);
|
||||
standardProfile = new FrogPilotDualParamControl(standardFollow, standardJerk, this, true);
|
||||
addItem(standardProfile);
|
||||
|
||||
FrogPilotParamValueControl *relaxedFollow = new FrogPilotParamValueControl("RelaxedFollow", "Follow",
|
||||
"Set the 'Relaxed' personality following distance. Represents seconds to follow behind the lead vehicle.\n\nStock: 1.75 seconds.", "../frogpilot/assets/other_images/relaxed.png",
|
||||
10, 50, std::map<int, QString>(), this, false, " sec", 10);
|
||||
FrogPilotParamValueControl *relaxedJerk = new FrogPilotParamValueControl("RelaxedJerk", " Jerk",
|
||||
"Set brake/gas pedal responsiveness for the 'Relaxed' personality. Higher values yield a more 'relaxed' response.\n\nStock: 1.0.", "", 1, 50,
|
||||
std::map<int, QString>(), this, false, "", 10);
|
||||
relaxedProfile = new FrogPilotDualParamControl(relaxedFollow, relaxedJerk, this, true);
|
||||
addItem(relaxedProfile);
|
||||
|
||||
} else if (param == "LateralTune") {
|
||||
FrogPilotParamManageControl *lateralTuneToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(lateralTuneToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
@@ -179,15 +221,21 @@ void FrogPilotControlsPanel::updateMetric() {
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::parentToggleClicked() {
|
||||
aggressiveProfile->setVisible(false);
|
||||
conditionalSpeedsImperial->setVisible(false);
|
||||
conditionalSpeedsMetric->setVisible(false);
|
||||
standardProfile->setVisible(false);
|
||||
relaxedProfile->setVisible(false);
|
||||
|
||||
this->openParentToggle();
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::hideSubToggles() {
|
||||
aggressiveProfile->setVisible(false);
|
||||
conditionalSpeedsImperial->setVisible(false);
|
||||
conditionalSpeedsMetric->setVisible(false);
|
||||
standardProfile->setVisible(false);
|
||||
relaxedProfile->setVisible(false);
|
||||
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
bool subToggles = conditionalExperimentalKeys.find(key.c_str()) != conditionalExperimentalKeys.end() ||
|
||||
|
||||
@@ -22,8 +22,11 @@ private:
|
||||
void updateMetric();
|
||||
void updateToggles();
|
||||
|
||||
FrogPilotDualParamControl *aggressiveProfile;
|
||||
FrogPilotDualParamControl *conditionalSpeedsImperial;
|
||||
FrogPilotDualParamControl *conditionalSpeedsMetric;
|
||||
FrogPilotDualParamControl *standardProfile;
|
||||
FrogPilotDualParamControl *relaxedProfile;
|
||||
|
||||
std::set<QString> conditionalExperimentalKeys;
|
||||
std::set<QString> fireTheBabysitterKeys;
|
||||
|
||||
Reference in New Issue
Block a user