Skip to content

Commit

Permalink
FEATURE: Prepare support for other vehicle types
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Aug 27, 2024
1 parent 89c2c16 commit 625d406
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This list of functionalities provides a comprehensive overview of the software's

- The software must be extensible to support new drone models and parameter configurations.
- Users should be able to customize the software's behavior through configuration files:
- `ArduCopter_configuration_steps.json`, `ArduPlane_configuration_steps.json`, etc
- `configuration_steps_ArduCopter.json`, `configuration_steps_ArduPlane.json`, etc
- `vehicle_components.json`
- intermediate parameter files (`*.param`)
- Development should use industry best practices:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ConfigurationSteps:
configuration_steps (dict): A dictionary containing the configuration steps.
"""
def __init__(self, _vehicle_dir: str, vehicle_type: str):
self.configuration_steps_filename = vehicle_type + "_configuration_steps.json"
self.configuration_steps_filename = "configuration_steps_" + vehicle_type + ".json"
self.configuration_steps = {}
self.forced_parameters = {}
self.derived_parameters = {}
Expand All @@ -45,7 +45,7 @@ def __init__(self, _vehicle_dir: str, vehicle_type: str):
def re_init(self, vehicle_dir: str, vehicle_type: str):
if vehicle_type == '':
return
self.configuration_steps_filename = vehicle_type + "_configuration_steps.json"
self.configuration_steps_filename = "configuration_steps_" + vehicle_type + ".json"
# Define a list of directories to search for the configuration_steps_filename file
search_directories = [vehicle_dir, os_path.dirname(os_path.abspath(__file__))]
file_found = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, root, local_filesystem, parameter_editor):
style.configure('narrow.TButton', padding=0, width=4, border=(0, 0, 0, 0))

# Prepare a dictionary that maps variable names to their values
# These variables are used by the forced_parameters and derived_parameters in *_configuration_steps.json files
# These variables are used by the forced_parameters and derived_parameters in configuration_steps_*.json files
self.variables = local_filesystem.get_eval_variables()

self.compute_forced_and_derived_parameters()
Expand Down
2 changes: 1 addition & 1 deletion USERMANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ The ArduPilot Methodic Configurator uses several configuration files to manage a

- **Intermediate Parameter Files**: These files are located in the vehicle-specific directory and are named with two digits followed by an underscore, ending in `.param`. They contain the parameters that need to be configured for the drone. Each file corresponds to a specific configuration step or aspect of the drone's setup.

- **Documentation File**: This file provides documentation for each intermediate parameter file. It is used to display relevant information about the parameters and their configuration process. The `ArduCopter_configuration_steps.json` documentation file is first searched in the selected vehicle-specific directory, and if not found, in the directory where the script is located.
- **Documentation File**: This file provides documentation for each intermediate parameter file. It is used to display relevant information about the parameters and their configuration process. The `configuration_steps_ArduCopter.json` documentation file is first searched in the selected vehicle-specific directory, and if not found, in the directory where the script is located.

- **Default Parameter Values File**: The `00_defaults.param` file is located in the vehicle-specific directory.
If the file does not exist or is invalid, use this command to regenerate it
Expand Down
8 changes: 5 additions & 3 deletions package.bat
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
del /Q dist\*

rem python3.11.exe -m PyInstaller --onefile --noconfirm --add-data "4.4.4-test-params\00_default.param;4.4.4-test-params" --add-data "apm.pdef.xml;." --add-data "apm.pdef.4.3.8-params.xml;." --add-data "apm.pdef.4.4.4-params.xml;." --add-data "apm.pdef.4.5.x-params.xml;." --add-data "apm.pdef.4.6.x-params.xml;." --add-data "ArduPilot_icon.png;." --add-data "ArduCopter_configuration_steps.json;." ardupilot_methodic_configurator.py
rem python3.11.exe -m PyInstaller --onefile --noconfirm --add-data "4.4.4-test-params\00_default.param;4.4.4-test-params" --add-data "apm.pdef.xml;." --add-data "apm.pdef.4.3.8-params.xml;." --add-data "apm.pdef.4.4.4-params.xml;." --add-data "apm.pdef.4.5.x-params.xml;." --add-data "apm.pdef.4.6.x-params.xml;." --add-data "ArduPilot_icon.png;." --add-data "configuration_steps_ArduCopter.json;." ardupilot_methodic_configurator.py
python3.11.exe -m PyInstaller --onefile --noconfirm MethodicConfigurator\ardupilot_methodic_configurator.py
md dist\4.4.4-test-params
copy 4.4.4-test-params\00_default.param dist\4.4.4-test-params
copy apm.pdef.4.3.8-params.xml dist
copy apm.pdef.4.4.4-params.xml dist
copy apm.pdef.4.5.x-params.xml dist
copy apm.pdef.4.6.x-params.xml dist
copy ArduCopter_configuration_steps.json dist
copy ArduPlane_configuration_steps.json dist
copy configuration_steps_ArduCopter.json dist
copy configuration_steps_ArduPlane.json dist
copy configuration_steps_Heli.json dist
copy configuration_steps_Rover.json dist
xcopy /E /I /Y vehicle_templates\ArduCopter\diatone_taycan_mxc\4.3.8-params dist\4.3.8-params
xcopy /E /I /Y vehicle_templates\ArduCopter\diatone_taycan_mxc\4.4.4-params dist\4.4.4-params
xcopy /E /I /Y 4.4.4-test-params dist\4.4.4-test-params
Expand Down
6 changes: 3 additions & 3 deletions param_reorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""
This script inserts and/or removes parameter files in the configuration sequence
defined in the ArduCopter_configuration_steps.json file.
defined in the configuration_steps_ArduCopter.json file.
It also replaces all occurrences of the old names with the new names
in all *.py and *.md files in the current directory.
Expand All @@ -19,7 +19,7 @@
import re
import json

SEQUENCE_FILENAME = "ArduCopter_configuration_steps.json"
SEQUENCE_FILENAME = "configuration_steps_ArduCopter.json"
PYTHON_FILES = ["param_pid_adjustment_update.py", "param_pid_adjustment_update_test.py",
"annotate_params.py", "copy_magfit_pdef_to_template_dirs.py"]
file_renames = {}
Expand Down Expand Up @@ -85,7 +85,7 @@ def update_file_contents(renames, root, file, steps):
print(f"Error: The intermediate parameter file '{old_filename}'" \
f" is not mentioned in the {file} file")
for new_name, old_name in renames.items():
if 'configuration_steps.json' in file:
if 'configuration_steps' in file and file.endswith(".json"):
file_content = update_configuration_steps_json_file_contents(steps, file_content, new_name, old_name)
else:
file_content = file_content.replace(old_name, new_name)
Expand Down
5 changes: 3 additions & 2 deletions windows/ardupilot_methodic_configurator.iss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Type: filesandordirs; Name: "{commonappdata}\.ardupilot_methodic_configurator\ve
Type: filesandordirs; Name: "{commonappdata}\.ardupilot_methodic_configurator\vehicle_templates\ArduCopter\Marmotte5v2";
Type: filesandordirs; Name: "{commonappdata}\.ardupilot_methodic_configurator\vehicle_templates\ArduCopter\Chimera7";
Type: filesandordirs; Name: "{commonappdata}\.ardupilot_methodic_configurator\vehicle_templates\ArduCopter\ReadyToSkyZD550";
Type: filesandordirs; Name: "{app}\_internal\MethodicConfigurator\ArduCopter_configuration_steps.json";
Type: filesandordirs; Name: "{app}\_internal\MethodicConfigurator\ArduPlane_configuration_steps.json";

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand All @@ -59,8 +61,7 @@ Source: "..\windows\version.txt"; DestDir: "{commonappdata}\.ardupilot_methodic_
Source: "..\windows\MethodicConfigurator.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MethodicConfigurator\ArduPilot_icon.png"; DestDir: "{app}\_internal\MethodicConfigurator"; Flags: ignoreversion
Source: "..\MethodicConfigurator\ArduPilot_logo.png"; DestDir: "{app}\_internal\MethodicConfigurator"; Flags: ignoreversion
Source: "..\MethodicConfigurator\ArduCopter_configuration_steps.json"; DestDir: "{app}\_internal\MethodicConfigurator"; Flags: ignoreversion
Source: "..\MethodicConfigurator\ArduPlane_configuration_steps.json"; DestDir: "{app}\_internal\MethodicConfigurator"; Flags: ignoreversion
Source: "..\MethodicConfigurator\configuration_steps_*.json"; DestDir: "{app}\_internal\MethodicConfigurator"; Flags: ignoreversion
Source: "..\LICENSES\*.*"; DestDir: "{app}\LICENSES"; Flags: ignoreversion
Source: "..\credits\*.*"; DestDir: "{app}\credits"; Flags: ignoreversion

Expand Down

0 comments on commit 625d406

Please sign in to comment.