Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions open-robotics/configs/observalble_deadlock.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"chargePerTick" : 5.0,
"energyPerMove" : 1.0,
"loadingTicks" : 1,
"unloadingTicks" : 1
"unloadingTicks" : 1,
"maxTasks" : 10,
"manualTaskAssignment" : false
},
"map" : {
"mapId" : "e8b76c63-4505-499e-8070-4eb32d17b96e",
Expand Down Expand Up @@ -93,7 +95,8 @@
},
"type" : null,
"boxCount" : 1,
"validDropoffIds" : null
"validDropoffIds" : null,
"manualDropoffAssignment" : false
}, {
"id" : "2222aaaa-2222-4222-a222-222222222222",
"name" : "Rack-02",
Expand All @@ -103,7 +106,8 @@
},
"type" : null,
"boxCount" : 1,
"validDropoffIds" : null
"validDropoffIds" : null,
"manualDropoffAssignment" : false
}, {
"id" : "3333aaaa-3333-4333-a333-333333333333",
"name" : "Rack-03",
Expand All @@ -113,7 +117,8 @@
},
"type" : null,
"boxCount" : 1,
"validDropoffIds" : null
"validDropoffIds" : null,
"manualDropoffAssignment" : false
} ],
"obstacles" : [ {
"id" : "f0000000-0000-4000-a000-000000000001",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ private void initialize() {
AppState.clear();
configListView.getSelectionModel().clearSelection();
}
canvasWidthSpinner.setDisable(false);
canvasHeightSpinner.setDisable(false);
setConfigParamsDisabled(false);
autoSetCanvasForMap(n);
}
refreshPreview();
Expand Down Expand Up @@ -197,8 +196,7 @@ private void initialize() {
if (success) {
// Config-backed maps own their dimensions, so clear the template selection.
mapCombo.getSelectionModel().clearSelection();
canvasWidthSpinner.setDisable(true);
canvasHeightSpinner.setDisable(true);
setConfigParamsDisabled(true);
refreshPreview();
checkCanvasConstraint();
}
Expand All @@ -222,6 +220,9 @@ private void initialize() {

// Reset Actions
@FXML private void onResetMap() {
AppState.clear();
configListView.getSelectionModel().clearSelection();
setConfigParamsDisabled(false);
mapCombo.getSelectionModel().selectFirst();
refreshPreview();
checkCanvasConstraint();
Expand Down Expand Up @@ -269,8 +270,7 @@ private void refreshPreview() {
if (isConfigFile && previewMap != null) {
cw = previewMap.getWidth();
ch = previewMap.getHeight();
canvasWidthSpinner.setDisable(true);
canvasHeightSpinner.setDisable(true);
setConfigParamsDisabled(true);
}

double padding = 16;
Expand Down Expand Up @@ -674,6 +674,8 @@ private boolean goToSimulationScreen() {
@FXML
private void onLoadConfig() {
if (promptAndLoadConfig()) {
mapCombo.getSelectionModel().clearSelection();
setConfigParamsDisabled(true);
refreshPreview();
checkCanvasConstraint();
}
Expand Down Expand Up @@ -1092,9 +1094,48 @@ private void makeSpinnerIntegerOnly(Spinner<Integer> spinner) {
}));
}

/**
* Disables or re-enables all user-editable parameters on the setup screen.
* Called with {@code true} whenever a config file is loaded and with {@code false} when switching back to a template map.
* The reservationK spinner has its own separate policy-driven disable logic
*/
private void setConfigParamsDisabled(boolean disabled) {

// Coordination policy
policyCombo.setDisable(disabled);
if (!disabled) {
// Re-evaluate the policy-driven disable for reservationK
reservationKSpinner.setDisable(!"RESERVATION_K".equals(policyCombo.getValue()));
} else {
reservationKSpinner.setDisable(true);
}

// Task settings
if (autoTaskRadio != null) autoTaskRadio.setDisable(disabled);
if (manualTaskRadio != null) manualTaskRadio.setDisable(disabled);
maxTasksField.setDisable(disabled);
workloadSeedField.setDisable(disabled);

// Robot physics
setDisableIfPresent(batteryCapacityField, disabled);
setDisableIfPresent(lowBatteryField, disabled);
setDisableIfPresent(chargePerTickField, disabled);
setDisableIfPresent(energyPerMoveField, disabled);

// Run settings
maxTicksField.setDisable(disabled);
runNameField.setDisable(disabled);

// Canvas size
canvasWidthSpinner.setDisable(disabled);
canvasHeightSpinner.setDisable(disabled);
}

private void setDisableIfPresent(TextField field, boolean disabled) {
if (field != null) field.setDisable(disabled);
}

// Navigation
@FXML
private void onTabEditor() { /* already on setup/editor screen */ }

@FXML
private void onMenuWelcome() { ScreenNavigator.goToWelcome(); }
Expand All @@ -1114,4 +1155,4 @@ private void onExit() {
javafx.application.Platform.exit();
}
}
}
}
Loading