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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ConfigurationSteps:
def __init__(self, _vehicle_dir: str, vehicle_type: str) -> None:
self.configuration_steps_filename = "configuration_steps_" + vehicle_type + ".json"
self.configuration_steps: dict[str, dict] = {}
self.configuration_phases: dict[str, dict] = {}
self.forced_parameters: dict[str, dict] = {}
self.derived_parameters: dict[str, dict] = {}
self.log_loaded_file = False
Expand Down Expand Up @@ -96,6 +97,11 @@ def re_init(self, vehicle_dir: str, vehicle_type: str) -> None: # pylint: disab
self.__validate_parameters_in_configuration_steps(filename, file_info, "derived")
else:
logging_warning(_("No configuration steps documentation and no forced and derived parameters will be available."))

if file_found and "phases" in json_content:
self.configuration_phases = json_content["phases"]
else:
logging_warning(_("No configuration phases documentation will be available."))
self.log_loaded_file = True

def __validate_parameters_in_configuration_steps(self, filename: str, file_info: dict, parameter_type: str) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,5 +826,65 @@
"auto_changed_by": "",
"old_filenames": ["45_everyday_use.param", "47_everyday_use.param", "50_everyday_use.param"]
}
},
"phases": {
"IMU temperature calibration": {
"description": "Calibrate the IMU sensors for at different temperatures",
"optional": true,
"start": 2
},
"Assemble all components except the propellers": {
"description": "Assemble all components except the propellers"
},
"Basic mandatory configuration": {
"description": "Set up the basic parameters for the vehicle",
"start": 4
},
"Assemble the propellers and perform the first flight": {
"description": "Assemble the propellers and perform the first flight"
},
"Minimalistic mandatory tuning": {
"description": "Minimalistic mandatory tuning using test flight data",
"start": 19
},
"Standard tuning": {
"description": "Improve tuning with more test flight data",
"optional": true,
"start": 24
},
"Improve altitude control": {
"description": "Improve altitude under windy conditions",
"optional": true,
"start": 40
},
"Analytical PID optimization": {
"description": "System identification and analytical PID optimization",
"optional": true,
"start": 42
},
"Position controller tuning": {
"description": "Position controller tuning",
"optional": true,
"start": 47
},
"Guided operation": {
"description": "Guided operation",
"optional": true,
"start": 48
},
"Precision landing": {
"description": "Precision landing",
"optional": true,
"start": 49
},
"Optical flow calibration": {
"description": "Optical flow sensor calibration",
"optional": true,
"start": 50
},
"Everyday use": {
"description": "Everyday use",
"start": 53
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "object",
"required": ["steps"],
"required": ["steps", "phases"],
"properties": {
"steps": {
"type": "object",
Expand Down Expand Up @@ -149,6 +149,31 @@
}
}
}
},
"phases": {
"type": "object",
"patternProperties": {
"^.*$": {
"type": "object",
"required": ["description"],
"properties": {
"description": {
"type": "string",
"description": "Description of the phase"
},
"optional": {
"type": "boolean",
"description": "Whether this phase is optional"
},
"start": {
"type": "integer",
"minimum": 1,
"description": "Starting step number of this phase"
}
}
}
},
"description": "Phases of the configuration process"
}
},
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from ardupilot_methodic_configurator.frontend_tkinter_directory_selection import VehicleDirectorySelectionWidgets
from ardupilot_methodic_configurator.frontend_tkinter_parameter_editor_documentation_frame import DocumentationFrame
from ardupilot_methodic_configurator.frontend_tkinter_parameter_editor_table import ParameterEditorTable
from ardupilot_methodic_configurator.frontend_tkinter_stage_progress import StageProgressBar
from ardupilot_methodic_configurator.tempcal_imu import IMUfit


Expand Down Expand Up @@ -153,7 +154,7 @@ def __init__(self, current_file: str, flight_controller: FlightController, local
self.root.title(
_("Amilcar Lucas's - ArduPilot methodic configurator ") + __version__ + _(" - Parameter file editor and uploader")
)
self.root.geometry("990x550") # Set the window width
self.root.geometry("990x610") # Set the window width

# Bind the close_connection_and_quit function to the window close event
self.root.protocol("WM_DELETE_WINDOW", self.close_connection_and_quit)
Expand All @@ -169,8 +170,19 @@ def __init__(self, current_file: str, flight_controller: FlightController, local

self.__create_conf_widgets(__version__)

if self.local_filesystem.configuration_phases:
# Get the first two characters of the last configuration step filename
last_step_filename = next(reversed(self.local_filesystem.file_parameters.keys()))
last_step_nr = int(last_step_filename[:2]) + 1 if len(last_step_filename) >= 2 else 1

self.stage_progress_bar = StageProgressBar(
self.main_frame, self.local_filesystem.configuration_phases, last_step_nr
)
self.stage_progress_bar.pack(side=tk.TOP, fill="x", expand=False, pady=(2, 2), padx=(4, 4))

# Create a DocumentationFrame object for the Documentation Content
self.documentation_frame = DocumentationFrame(self.main_frame, self.local_filesystem, self.current_file)
self.documentation_frame.documentation_frame.pack(side=tk.TOP, fill="x", expand=False, pady=(2, 2), padx=(4, 4))

self.__create_parameter_area_widgets()

Expand Down Expand Up @@ -333,7 +345,9 @@ def __create_parameter_area_widgets(self) -> None:
"Upload selected parameters to the flight controller and advance to the next "
"intermediate parameter file\nIf changes have been made to the current file it will ask if you want "
"to save them\nIt will reset the FC if necessary, re-download all parameters and validate their value"
),
)
if self.flight_controller.master
else _("No flight controller connected, without it this is not available"),
)

# Create skip button
Expand Down Expand Up @@ -494,6 +508,7 @@ def on_param_file_combobox_change(self, _event: Union[None, tk.Event], forced: b
return
self.parameter_editor_table.generate_edit_widgets_focus_out()
selected_file = self.file_selection_combobox.get()
self._update_progress_bar_from_file(selected_file)
if self.current_file != selected_file or forced:
self.write_changes_to_intermediate_parameter_file()
self.__do_tempcal_imu(selected_file)
Expand All @@ -509,6 +524,15 @@ def on_param_file_combobox_change(self, _event: Union[None, tk.Event], forced: b
self.documentation_frame.update_why_why_now_tooltip(selected_file)
self.repopulate_parameter_table(selected_file)

def _update_progress_bar_from_file(self, selected_file: str) -> None:
if self.local_filesystem.configuration_phases:
try:
step_nr = int(selected_file[:2])
self.stage_progress_bar.update_progress(step_nr)
except ValueError as _e:
msg = _("Failed to update progress bar, {selected_file} does not start with two digits like it should: {_e}")
logging_error(msg.format(**locals()))

def download_flight_controller_parameters(self, redownload: bool = False) -> None:
operation_string = _("Re-downloading FC parameters") if redownload else _("Downloading FC parameters")
self.param_download_progress_window = ProgressWindow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def __init__(self, root: tk.Widget, local_filesystem: LocalFilesystem, current_f

def __create_documentation_frame(self) -> None:
self.documentation_frame = ttk.LabelFrame(self.root, text=_("Documentation"))
self.documentation_frame.pack(side=tk.TOP, fill="x", expand=False, pady=(4, 4), padx=(4, 4))

# Create a grid structure within the documentation_frame
documentation_grid = ttk.Frame(self.documentation_frame)
Expand Down
Loading
Loading