Merge branch 'master-priv' into more-responsive-model-fetcher

This commit is contained in:
Jason Wen
2024-05-23 13:56:56 -04:00
7 changed files with 35 additions and 18 deletions
+9 -8
View File
@@ -227,7 +227,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"CarModelText", PERSISTENT | BACKUP},
{"ChevronInfo", PERSISTENT | BACKUP},
{"CustomBootScreen", PERSISTENT | BACKUP},
{"CustomDrivingModel", PERSISTENT},
{"CustomDrivingModel", PERSISTENT | CLEAR_ON_BRANCH_SWITCH},
{"CustomMapboxTokenPk", PERSISTENT | BACKUP},
{"CustomMapboxTokenSk", PERSISTENT | BACKUP},
{"CustomOffsets", PERSISTENT | BACKUP},
@@ -236,11 +236,10 @@ std::unordered_map<std::string, uint32_t> keys = {
{"DevUIInfo", PERSISTENT | BACKUP},
{"DisableOnroadUploads", PERSISTENT | BACKUP},
{"DisengageLateralOnBrake", PERSISTENT | BACKUP},
{"DrivingModelGeneration", PERSISTENT},
{"DrivingModelMetadataText", PERSISTENT},
{"DrivingModelName", PERSISTENT},
{"DrivingModelText", PERSISTENT},
{"DrivingModelUrl", PERSISTENT},
{"DrivingModelGeneration", PERSISTENT | CLEAR_ON_BRANCH_SWITCH},
{"DrivingModelMetadataText", PERSISTENT | CLEAR_ON_BRANCH_SWITCH},
{"DrivingModelName", PERSISTENT | CLEAR_ON_BRANCH_SWITCH},
{"DrivingModelText", PERSISTENT | CLEAR_ON_BRANCH_SWITCH},
{"DynamicExperimentalControl", PERSISTENT | BACKUP},
{"DynamicLaneProfile", PERSISTENT | BACKUP},
{"EnableAmap", PERSISTENT | BACKUP},
@@ -263,6 +262,8 @@ std::unordered_map<std::string, uint32_t> keys = {
{"HotspotOnBoot", PERSISTENT},
{"HotspotOnBootConfirmed", PERSISTENT},
{"LastCarModel", PERSISTENT | BACKUP},
{"LastGitBranch", PERSISTENT},
{"LastGitRemote", PERSISTENT},
{"LastSpeedLimitSignTap", PERSISTENT},
{"LastSunnylinkPingTime", CLEAR_ON_MANAGER_START},
{"LiveTorque", PERSISTENT | BACKUP},
@@ -274,8 +275,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"MapTargetVelocities", PERSISTENT},
{"Map3DBuildings", PERSISTENT | BACKUP},
{"MaxTimeOffroad", PERSISTENT | BACKUP},
{"NavModelText", PERSISTENT | BACKUP},
{"NavModelUrl", PERSISTENT | BACKUP},
{"NavModelText", PERSISTENT | CLEAR_ON_BRANCH_SWITCH},
{"NNFF", PERSISTENT | BACKUP},
{"NNFFCarModel", PERSISTENT | BACKUP},
{"OnroadScreenOff", PERSISTENT | BACKUP},
@@ -323,6 +323,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"VisionCurveLaneless", PERSISTENT | BACKUP},
{"VwAccType", PERSISTENT | BACKUP},
{"VwCCOnly", PERSISTENT | BACKUP},
{"Offroad_BranchSwitchResetParams", CLEAR_ON_MANAGER_START}, // TODO: SP: use this for alert on main menu
{"Offroad_ForceStatus", CLEAR_ON_MANAGER_START},
{"Offroad_SupersededUpdate", PERSISTENT},
+1
View File
@@ -17,6 +17,7 @@ enum ParamKeyType {
DONT_LOG = 0x20,
DEVELOPMENT_ONLY = 0x40,
BACKUP = 0x80,
CLEAR_ON_BRANCH_SWITCH = 0x100,
ALL = 0xFFFFFFFF
};
+6
View File
@@ -32,6 +32,9 @@ def manager_init() -> None:
if build_metadata.release_channel:
params.clear_all(ParamKeyType.DEVELOPMENT_ONLY)
if params.get("LastGitBranch") != build_metadata.channel or params.get("LastGitRemote") != build_metadata.openpilot.git_origin:
params.clear_all(ParamKeyType.CLEAR_ON_BRANCH_SWITCH)
default_params: list[tuple[str, str | bytes]] = [
("CompletedTrainingVersion", "0"),
("DisengageOnAccelerator", "0"),
@@ -56,6 +59,7 @@ def manager_init() -> None:
("ChevronInfo", "1"),
("MadsCruiseMain", "1"),
("CustomBootScreen", "0"),
("CustomDrivingModel", "0"),
("CustomOffsets", "0"),
("DevUIInfo", "0"),
("DisableOnroadUploads", "0"),
@@ -137,6 +141,8 @@ def manager_init() -> None:
params.put("GitCommitDate", build_metadata.openpilot.git_commit_date)
params.put("GitBranch", build_metadata.channel)
params.put("GitRemote", build_metadata.openpilot.git_origin)
params.put("LastGitBranch", build_metadata.channel)
params.put("LastGitRemote", build_metadata.openpilot.git_origin)
params.put_bool("IsTestedBranch", build_metadata.tested_channel)
params.put_bool("IsReleaseBranch", build_metadata.release_channel)
params.put_bool("IsReleaseSPBranch", build_metadata.release_sp_channel)
+7 -7
View File
@@ -79,7 +79,7 @@ class ModelState:
'lateral_control_params': np.zeros(ModelConstants.LATERAL_CONTROL_PARAMS_LEN, dtype=np.float32),
'prev_desired_curvs': np.zeros(ModelConstants.PREV_DESIRED_CURVS_LEN, dtype=np.float32),
}
if self.model_gen != 4:
if self.model_gen not in (0, 4):
_inputs_2 = {
'nav_features': np.zeros(ModelConstants.NAV_FEATURE_LEN, dtype=np.float32),
'nav_instructions': np.zeros(ModelConstants.NAV_INSTRUCTION_LEN, dtype=np.float32),
@@ -133,7 +133,7 @@ class ModelState:
self.inputs['traffic_convention'][:] = inputs['traffic_convention']
if not (self.custom_model and self.model_gen == 1):
self.inputs['lateral_control_params'][:] = inputs['lateral_control_params']
if self.custom_model and self.model_gen != 4:
if self.custom_model and self.model_gen not in (0, 4):
self.inputs['nav_features'][:] = inputs['nav_features']
self.inputs['nav_instructions'][:] = inputs['nav_instructions']
@@ -205,7 +205,7 @@ def main(demo=False):
# messaging
extended_svs = ["lateralPlanDEPRECATED", "lateralPlanSPDEPRECATED"]
if custom_model and model_gen != 4:
if custom_model and model_gen not in (0, 4):
extended_svs += ["navModelDEPRECATED", "navInstruction"]
pm = PubMaster(["modelV2", "modelV2SP", "cameraOdometry"])
sm = SubMaster(["deviceState", "carState", "roadCameraState", "liveCalibration", "driverMonitoringState", "carControl"] + extended_svs)
@@ -223,7 +223,7 @@ def main(demo=False):
live_calib_seen = False
if custom_model and model_gen == 1:
driving_style = np.array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], dtype=np.float32)
if custom_model and model_gen != 4:
if custom_model and model_gen not in (0, 4):
nav_features = np.zeros(ModelConstants.NAV_FEATURE_LEN, dtype=np.float32)
nav_instructions = np.zeros(ModelConstants.NAV_INSTRUCTION_LEN, dtype=np.float32)
buf_main, buf_extra = None, None
@@ -299,7 +299,7 @@ def main(demo=False):
timestamp_llk = 0
nav_enabled = False
if custom_model and model_gen != 4:
if custom_model and model_gen not in (0, 4):
# Enable/disable nav features
timestamp_llk = sm["navModelDEPRECATED"].locationMonoTime
nav_valid = sm.valid["navModelDEPRECATED"] # and (nanos_since_boot() - timestamp_llk < 1e9)
@@ -345,7 +345,7 @@ def main(demo=False):
_inputs = {
'lateral_control_params': lateral_control_params
}
if custom_model and model_gen != 4:
if custom_model and model_gen not in (0, 4):
_inputs_2 = {
'nav_features': nav_features,
'nav_instructions': nav_instructions
@@ -372,7 +372,7 @@ def main(demo=False):
posenet_send = messaging.new_message('cameraOdometry')
fill_model_msg(modelv2_send, model_output, publish_state, meta_main.frame_id, meta_extra.frame_id, frame_id, frame_drop_ratio,
meta_main.timestamp_eof, timestamp_llk, model_execution_time, nav_enabled, live_calib_seen,
custom_model and model_gen == 1, custom_model and model_gen != 4)
custom_model and model_gen == 1, custom_model and model_gen not in (0, 4))
if not (custom_model and model_gen == 1):
desire_state = modelv2_send.modelV2.meta.desireState
+1 -1
View File
@@ -161,7 +161,7 @@ void MapWindow::updateState(const UIState &s) {
const SubMaster &sm = *(s.sm);
update();
if (sm.updated("modelV2") && uiState()->scene.custom_driving_model && uiState()->scene.driving_model_gen != 4) {
if (sm.updated("modelV2") && uiState()->scene.custom_driving_model && uiState()->scene.driving_model_gen != 4 && uiState()->scene.driving_model_gen != 0) {
// set path color on change, and show map on rising edge of navigate on openpilot
auto car_control = sm["carControl"].getCarControl();
bool nav_enabled = sm["modelV2"].getModelV2().getNavEnabledDEPRECATED() &&
@@ -60,7 +60,7 @@ VisualsPanel::VisualsPanel(QWidget *parent) : ListWidget(parent) {
{
"MapboxFullScreen",
tr("Navigation: Display in Full Screen"),
QString(tr("Enable this will display the built-in navigation in full screen.<br>To switch back to driving view, <font color='yellow'>tap on the border edge</font>.")),
tr("Enable this will display the built-in navigation in full screen.<br>To switch back to driving view, <font color='yellow'>tap on the border edge</font>."),
"../assets/offroad/icon_blank.png",
},
{
+10 -1
View File
@@ -243,7 +243,7 @@ class ButtonParamControl : public SPAbstractControl {
Q_OBJECT
public:
ButtonParamControl(const QString &param, const QString &title, const QString &desc, const QString &icon,
const std::vector<QString> &button_texts, const int minimum_button_width = 300) : SPAbstractControl(title, desc, icon) {
const std::vector<QString> &button_texts, const int minimum_button_width = 300) : SPAbstractControl(title, desc, icon), button_texts(button_texts) {
const QString style = R"(
QPushButton {
border-radius: 20px;
@@ -306,6 +306,14 @@ public:
void refresh() {
int value = atoi(params.get(key).c_str());
if (value >= button_texts.size()) {
value = button_texts.size() - 1;
}
if (value < button_texts.size()) {
value = 0;
}
button_group->button(value)->setChecked(true);
}
@@ -357,6 +365,7 @@ private:
std::string key;
Params params;
QButtonGroup *button_group;
std::vector<QString> button_texts;
bool button_group_enabled = true;
};