mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-25 11:52:20 +08:00
Driving Model Selector v2
This commit is contained in:
@@ -2,6 +2,10 @@ sunnypilot - 0.9.6.1 (2023-xx-xx)
|
||||
========================
|
||||
* UPDATED: Dynamic Experimental Control (DEC)
|
||||
* Synced with dragonpilot-community/dragonpilot:lp-dp-beta2 commit 578d38b
|
||||
* UPDATED: Driving Model Selector v2
|
||||
* Driving models sort in descending order based on availability date
|
||||
* Experimental/unmerged driving models are only available in "dev-c3" branch
|
||||
* To select and use experimental driving models, navigate to "Software" panel, select the "dev-c3" branch, and check for update
|
||||
* UPDATED: Vision-based Turn Speed Control (V-TSC) implementation
|
||||
* Refactored implementation thanks to pfeiferj!
|
||||
* More accurate and consistent velocity calculation to achieve smoother longitudinal control in curves
|
||||
|
||||
@@ -78,5 +78,5 @@ std::vector<Model> ModelsFetcher::getModelsFromURL(const QString&url) {
|
||||
}
|
||||
|
||||
std::vector<Model> ModelsFetcher::getModelsFromURL() {
|
||||
return getModelsFromURL("https://docs.sunnypilot.ai/models.json");
|
||||
return getModelsFromURL("https://docs.sunnypilot.ai/models_v2.json");
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
fullName = json["full_name"].toString();
|
||||
fileName = json["file_name"].toString();
|
||||
downloadUri = json["download_uri"].toString();
|
||||
index = json["index"].toString();
|
||||
environment = json["environment"].toString();
|
||||
}
|
||||
|
||||
QJsonObject toJson() const {
|
||||
@@ -34,6 +36,8 @@ public:
|
||||
json["full_name"] = fullName;
|
||||
json["file_name"] = fileName;
|
||||
json["download_uri"] = downloadUri;
|
||||
json["index"] = index;
|
||||
json["environment"] = environment;
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -41,6 +45,8 @@ public:
|
||||
QString fullName;
|
||||
QString fileName;
|
||||
QString downloadUri;
|
||||
QString index;
|
||||
QString environment;
|
||||
};
|
||||
|
||||
class ModelsFetcher : public QObject {
|
||||
|
||||
@@ -56,12 +56,26 @@ void SoftwarePanelSP::handleCurrentModelLblBtnClicked() {
|
||||
|
||||
checkNetwork();
|
||||
const auto currentModelName = QString::fromStdString(params.get("DrivingModelName"));
|
||||
const bool is_release_sp = params.getBool("IsReleaseSPBranch");
|
||||
const auto models = models_fetcher.getModelsFromURL();
|
||||
QStringList modelNames;
|
||||
|
||||
// Collecting model names
|
||||
for (const auto &model: models) {
|
||||
modelNames.push_back(model.displayName);
|
||||
QMap<QString, QString> index_to_model;
|
||||
|
||||
// Collecting indices with display names
|
||||
for (const auto &model : models) {
|
||||
if ((is_release_sp && model.environment == "release") || !is_release_sp) {
|
||||
index_to_model.insert(model.index, model.displayName);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList modelNames;
|
||||
QStringList indices = index_to_model.keys();
|
||||
std::sort(indices.begin(), indices.end(), [&](const QString &index1, const QString &index2) {
|
||||
return index1.toInt() > index2.toInt();
|
||||
});
|
||||
|
||||
for (const QString &index : indices) {
|
||||
modelNames.push_back(index_to_model[index]);
|
||||
}
|
||||
|
||||
currentModelLblBtn->setEnabled(!is_onroad);
|
||||
|
||||
Reference in New Issue
Block a user