Increase stop distance
Added toggle to increase the stop distance from lead vehicles.
This commit is contained in:
@@ -309,6 +309,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"StandardFollow", PERSISTENT},
|
{"StandardFollow", PERSISTENT},
|
||||||
{"StandardJerk", PERSISTENT},
|
{"StandardJerk", PERSISTENT},
|
||||||
{"StockTune", PERSISTENT},
|
{"StockTune", PERSISTENT},
|
||||||
|
{"StoppingDistance", PERSISTENT},
|
||||||
{"UnlimitedLength", PERSISTENT},
|
{"UnlimitedLength", PERSISTENT},
|
||||||
{"UpdateSchedule", PERSISTENT},
|
{"UpdateSchedule", PERSISTENT},
|
||||||
{"UpdateTime", PERSISTENT},
|
{"UpdateTime", PERSISTENT},
|
||||||
|
|||||||
@@ -326,10 +326,10 @@ class LongitudinalMpc:
|
|||||||
lead_xv = np.column_stack((x_lead_traj, v_lead_traj))
|
lead_xv = np.column_stack((x_lead_traj, v_lead_traj))
|
||||||
return lead_xv
|
return lead_xv
|
||||||
|
|
||||||
def process_lead(self, lead):
|
def process_lead(self, lead, increased_stopping_distance):
|
||||||
v_ego = self.x0[1]
|
v_ego = self.x0[1]
|
||||||
if lead is not None and lead.status:
|
if lead is not None and lead.status:
|
||||||
x_lead = lead.dRel
|
x_lead = lead.dRel - increased_stopping_distance
|
||||||
v_lead = lead.vLead
|
v_lead = lead.vLead
|
||||||
a_lead = lead.aLeadK
|
a_lead = lead.aLeadK
|
||||||
a_lead_tau = lead.aLeadTau
|
a_lead_tau = lead.aLeadTau
|
||||||
@@ -361,8 +361,8 @@ class LongitudinalMpc:
|
|||||||
v_ego = self.x0[1]
|
v_ego = self.x0[1]
|
||||||
self.status = radarstate.leadOne.status or radarstate.leadTwo.status
|
self.status = radarstate.leadOne.status or radarstate.leadTwo.status
|
||||||
|
|
||||||
lead_xv_0 = self.process_lead(radarstate.leadOne)
|
lead_xv_0 = self.process_lead(radarstate.leadOne, frogpilot_planner.increased_stopping_distance)
|
||||||
lead_xv_1 = self.process_lead(radarstate.leadTwo)
|
lead_xv_1 = self.process_lead(radarstate.leadTwo, frogpilot_planner.increased_stopping_distance)
|
||||||
|
|
||||||
# Offset by FrogAi for FrogPilot for a more natural takeoff with a lead
|
# Offset by FrogAi for FrogPilot for a more natural takeoff with a lead
|
||||||
if frogpilot_planner.aggressive_acceleration:
|
if frogpilot_planner.aggressive_acceleration:
|
||||||
|
|||||||
@@ -135,3 +135,4 @@ class FrogPilotPlanner:
|
|||||||
self.acceleration_profile = params.get_int("AccelerationProfile") if longitudinal_tune else 0
|
self.acceleration_profile = params.get_int("AccelerationProfile") if longitudinal_tune else 0
|
||||||
self.deceleration_profile = params.get_int("DecelerationProfile") if longitudinal_tune else 0
|
self.deceleration_profile = params.get_int("DecelerationProfile") if longitudinal_tune else 0
|
||||||
self.aggressive_acceleration = longitudinal_tune and params.get_bool("AggressiveAcceleration")
|
self.aggressive_acceleration = longitudinal_tune and params.get_bool("AggressiveAcceleration")
|
||||||
|
self.increased_stopping_distance = params.get_int("StoppingDistance") * (1 if self.is_metric else CV.FOOT_TO_METER) if longitudinal_tune else 0
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
|
|||||||
{"AccelerationProfile", "Acceleration Profile", "Change the acceleration rate to be either sporty or eco-friendly.", ""},
|
{"AccelerationProfile", "Acceleration Profile", "Change the acceleration rate to be either sporty or eco-friendly.", ""},
|
||||||
{"DecelerationProfile", "Deceleration Profile", "Change the deceleration rate to be either sporty or eco-friendly.", ""},
|
{"DecelerationProfile", "Deceleration Profile", "Change the deceleration rate to be either sporty or eco-friendly.", ""},
|
||||||
{"AggressiveAcceleration", "Aggressive Acceleration With Lead", "Increase acceleration aggressiveness when following a lead vehicle from a stop.", ""},
|
{"AggressiveAcceleration", "Aggressive Acceleration With Lead", "Increase acceleration aggressiveness when following a lead vehicle from a stop.", ""},
|
||||||
|
{"StoppingDistance", "Increase Stop Distance Behind Lead", "Increase the stopping distance for a more comfortable stop from lead vehicles.", ""},
|
||||||
|
|
||||||
{"QOLControls", "Quality of Life", "Miscellaneous quality of life changes to improve your overall openpilot experience.", "../frogpilot/assets/toggle_icons/quality_of_life.png"},
|
{"QOLControls", "Quality of Life", "Miscellaneous quality of life changes to improve your overall openpilot experience.", "../frogpilot/assets/toggle_icons/quality_of_life.png"},
|
||||||
{"DisableOnroadUploads", "Disable Onroad Uploads", "Prevent large data uploads when onroad.", ""},
|
{"DisableOnroadUploads", "Disable Onroad Uploads", "Prevent large data uploads when onroad.", ""},
|
||||||
@@ -209,6 +210,8 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
|
|||||||
std::vector<QString> profileOptions{tr("Standard"), tr("Eco"), tr("Sport")};
|
std::vector<QString> profileOptions{tr("Standard"), tr("Eco"), tr("Sport")};
|
||||||
FrogPilotButtonParamControl *profileSelection = new FrogPilotButtonParamControl(param, title, desc, icon, profileOptions);
|
FrogPilotButtonParamControl *profileSelection = new FrogPilotButtonParamControl(param, title, desc, icon, profileOptions);
|
||||||
toggle = profileSelection;
|
toggle = profileSelection;
|
||||||
|
} else if (param == "StoppingDistance") {
|
||||||
|
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 10, std::map<int, QString>(), this, false, " feet");
|
||||||
|
|
||||||
} else if (param == "QOLControls") {
|
} else if (param == "QOLControls") {
|
||||||
FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||||
@@ -306,12 +309,19 @@ void FrogPilotControlsPanel::updateMetric() {
|
|||||||
double speedConversion = isMetric ? MILE_TO_KM : KM_TO_MILE;
|
double speedConversion = isMetric ? MILE_TO_KM : KM_TO_MILE;
|
||||||
params.putIntNonBlocking("CESpeed", std::nearbyint(params.getInt("CESpeed") * speedConversion));
|
params.putIntNonBlocking("CESpeed", std::nearbyint(params.getInt("CESpeed") * speedConversion));
|
||||||
params.putIntNonBlocking("CESpeedLead", std::nearbyint(params.getInt("CESpeedLead") * speedConversion));
|
params.putIntNonBlocking("CESpeedLead", std::nearbyint(params.getInt("CESpeedLead") * speedConversion));
|
||||||
|
params.putIntNonBlocking("StoppingDistance", std::nearbyint(params.getInt("StoppingDistance") * distanceConversion));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FrogPilotParamValueControl *stoppingDistanceToggle = static_cast<FrogPilotParamValueControl*>(toggles["StoppingDistance"]);
|
||||||
|
|
||||||
if (isMetric) {
|
if (isMetric) {
|
||||||
|
stoppingDistanceToggle->updateControl(0, 5, " meters");
|
||||||
} else {
|
} else {
|
||||||
|
stoppingDistanceToggle->updateControl(0, 10, " feet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stoppingDistanceToggle->refresh();
|
||||||
|
|
||||||
previousIsMetric = isMetric;
|
previousIsMetric = isMetric;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ private:
|
|||||||
std::set<QString> fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads"};
|
std::set<QString> fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads"};
|
||||||
std::set<QString> laneChangeKeys = {};
|
std::set<QString> laneChangeKeys = {};
|
||||||
std::set<QString> lateralTuneKeys = {"ForceAutoTune"};
|
std::set<QString> lateralTuneKeys = {"ForceAutoTune"};
|
||||||
std::set<QString> longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration"};
|
std::set<QString> longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration", "StoppingDistance"};
|
||||||
std::set<QString> mtscKeys = {};
|
std::set<QString> mtscKeys = {};
|
||||||
std::set<QString> qolKeys = {"DisableOnroadUploads", "HigherBitrate", "ReverseCruise"};
|
std::set<QString> qolKeys = {"DisableOnroadUploads", "HigherBitrate", "ReverseCruise"};
|
||||||
std::set<QString> speedLimitControllerKeys = {};
|
std::set<QString> speedLimitControllerKeys = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user