From dd41bc2352a8c278039f62fd9de166eda1fe8451 Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Thu, 13 Jun 2024 21:14:52 +0200 Subject: [PATCH] IMPROVEMENT: SPDX tags and codacy lint fixes --- ARCHITECTURE.md | 5 ++ BLOG-discuss1.md | 5 ++ BLOG-discuss2.md | 5 ++ BLOG.md | 7 +- CODE_OF_CONDUCT.md | 75 ++++++++++--------- CONTRIBUTING.md | 5 ++ LICENSE.md | 5 ++ MANIFEST.in | 3 + .../extract_param_defaults.py | 1 + .../frontend_tkinter_template_overview.py | 3 + MethodicConfigurator/get_release_stats.py | 2 +- MethodicConfigurator/tempcal_imu.py | 40 ++++++---- QUICKSTART.md | 14 ++-- README.md | 17 +++-- USERMANUAL.md | 5 ++ credits/CREDITS.md | 17 ++++- install_linux.sh | 10 ++- install_macos.sh | 4 + install_windows.bat | 3 + param_reorder.py | 9 +++ setup.py | 2 +- unittests/annotate_params_test.sh | 6 ++ unittests/extract_param_defaults_test.sh | 6 ++ unittests/param_pid_adjustment_update_test.sh | 6 ++ 24 files changed, 183 insertions(+), 72 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index ba84f2e..5acadc3 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -1,4 +1,9 @@ # Software architecture + Before we decided on a software architecture or programming language or toolkit we gathered software requirements as presented below. diff --git a/BLOG-discuss1.md b/BLOG-discuss1.md index 9e27a2f..d7276bc 100644 --- a/BLOG-discuss1.md +++ b/BLOG-discuss1.md @@ -1,4 +1,9 @@ ![Cinewhoop Diatone Taycan MX-C|586x500](upload://naJEdzmLeF8hvzupJCpLBT7tZay.jpeg) + For illustrative purposes, we will use the small 3'' multicopter depicted above, but the tuning sequence we developed at [IAV GmbH](https://www.iav.com/) will work on almost any other multicopter. diff --git a/BLOG-discuss2.md b/BLOG-discuss2.md index 08a4c08..5231dee 100644 --- a/BLOG-discuss2.md +++ b/BLOG-discuss2.md @@ -1,4 +1,9 @@ Continuation from the Blog post above.... + For better accuracy, you should do that for all directions and take the average. In our case, we got: diff --git a/BLOG.md b/BLOG.md index 53b1529..0a133bb 100644 --- a/BLOG.md +++ b/BLOG.md @@ -1,4 +1,9 @@ -# How to methodically tune (almost) any multicopter using ArduCopter 4.4.x +# How to methodically tune any ArduCopter + ![Cinewhoop Diatone Taycan MX-C](cinewhoop.png) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b146fd0..1dc0abd 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,5 +1,10 @@ ArduPilot Methodic Configurator Developer Code of Conduct ========================================================= + Rev 1.0 Apr 3nd 2024 @@ -24,23 +29,23 @@ Our Pledge In the interest of fostering an open and welcoming environment, we as developers and maintainers pledge to: -- Endeavour to make participation in our project and our community a - harassment-free experience for everyone, regardless of age, body - size, disability, ethnicity, gender identity and expression, level - of experience, nationality, personal appearance, race, religion, or - sexual identity and orientation. -- Endeavour to understand the intent of development activities they - undertake, where there may be reason to think that the vehicle may - be used as a weapon or in an application where it is effectively in - control of human life. -- Not knowingly support or facilitate the weaponization of systems - using Ardupilot or ArduPilot Methodic Configurator -- ArduPilot and ArduPilot Methodic Configurator are NOT certified for - use in applications where ArduPilot is effectively in control of human - lives. Members of the development team must not knowingly assist in - projects where ArduPilot will be in control of human lives. - “In control of human lives” includes but isn’t limited to manned - aircraft. +- Endeavor to make participation in our project and our community a + harassment-free experience for everyone, regardless of age, body + size, disability, ethnicity, gender identity and expression, level + of experience, nationality, personal appearance, race, religion, or + sexual identity and orientation. +- Endeavor to understand the intent of development activities they + undertake, where there may be reason to think that the vehicle may + be used as a weapon or in an application where it is effectively in + control of human life. +- Not knowingly support or facilitate the weaponization of systems + using ArduPilot or ArduPilot Methodic Configurator +- ArduPilot and ArduPilot Methodic Configurator are NOT certified for + use in applications where ArduPilot is effectively in control of human + lives. Members of the development team must not knowingly assist in + projects where ArduPilot will be in control of human lives. + “In control of human lives” includes but isn’t limited to manned + aircraft. Our Standards ------------- @@ -48,27 +53,27 @@ Our Standards Examples of behavior that contributes to achieving the aims of ArduPilot Methodic Configurator include: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by contributors include: -- The use of sexualized language or imagery and unwelcome sexual - attention or advances -- Trolling, insulting/derogatory comments, and personal or political - attacks -- Public or private harassment -- Publishing others’ private information, such as a physical or - electronic address, without explicit permission -- Modifying ArduPilot Methodic Configurator code to intentionally support - weaponization -- Knowingly designing, testing or using weaponized systems running - ArduPilot Methodic Configurator -- Other conduct which could reasonably be considered inappropriate in - a public or professional setting +- The use of sexualized language or imagery and unwelcome sexual + attention or advances +- Trolling, insulting/derogatory comments, and personal or political + attacks +- Public or private harassment +- Publishing others’ private information, such as a physical or + electronic address, without explicit permission +- Modifying ArduPilot Methodic Configurator code to intentionally support + weaponization +- Knowingly designing, testing or using weaponized systems running + ArduPilot Methodic Configurator +- Other conduct which could reasonably be considered inappropriate in + a public or professional setting Our Responsibilities -------------------- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cbb595c..8af6463 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,9 @@ # Contributing + ## How to contribute to the ArduPilot Methodic Configurator project? diff --git a/LICENSE.md b/LICENSE.md index 3877ae0..a7769e0 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,10 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies diff --git a/MANIFEST.in b/MANIFEST.in index 1c019c4..fcf42b8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Amilcar do Carmo Lucas +# +# SPDX-License-Identifier: GPL-3.0-or-later recursive-include MethodicConfigurator/vehicle_templates *.param recursive-include MethodicConfigurator/vehicle_templates *.json recursive-include MethodicConfigurator/vehicle_templates *.jpg diff --git a/MethodicConfigurator/extract_param_defaults.py b/MethodicConfigurator/extract_param_defaults.py index 7b337ea..2a7b8fe 100755 --- a/MethodicConfigurator/extract_param_defaults.py +++ b/MethodicConfigurator/extract_param_defaults.py @@ -206,6 +206,7 @@ def output_params(params: Dict[str, float], format_type: str = 'missionplanner', elif format_type == "qgcs": print(f"{sysid} {compid} {param_name:<15} {param_value:.6f} {MAV_PARAM_TYPE_REAL32}") + def main(): args = parse_arguments() parameter_values = extract_parameter_values(args.bin_file, args.type) diff --git a/MethodicConfigurator/frontend_tkinter_template_overview.py b/MethodicConfigurator/frontend_tkinter_template_overview.py index 33b001d..b4c5189 100644 --- a/MethodicConfigurator/frontend_tkinter_template_overview.py +++ b/MethodicConfigurator/frontend_tkinter_template_overview.py @@ -117,6 +117,7 @@ def on_row_double_click(self, event): ProgramSettings.store_template_dir(selected_template_relative_path) self.root.destroy() + def argument_parser(): """ Parses command-line arguments for the script. @@ -134,6 +135,7 @@ def argument_parser(): 'providing a clear and intuitive interface for parameter management.') return add_common_arguments_and_parse(parser) + def main(): args = argument_parser() @@ -143,5 +145,6 @@ def main(): print(ProgramSettings.get_recently_used_dirs()[0]) + if __name__ == "__main__": main() diff --git a/MethodicConfigurator/get_release_stats.py b/MethodicConfigurator/get_release_stats.py index 42412e7..8251345 100755 --- a/MethodicConfigurator/get_release_stats.py +++ b/MethodicConfigurator/get_release_stats.py @@ -25,6 +25,7 @@ def compute_average(issues_date): return sum_of_issues / len(issues_date) return sum_of_issues + def main(): api_token = None gh = Github(api_token) @@ -70,5 +71,4 @@ def main(): if __name__ == "__main__": - main() diff --git a/MethodicConfigurator/tempcal_imu.py b/MethodicConfigurator/tempcal_imu.py index a67f16d..b8178dd 100644 --- a/MethodicConfigurator/tempcal_imu.py +++ b/MethodicConfigurator/tempcal_imu.py @@ -456,17 +456,35 @@ def IMUfit(logfile, outfile, # pylint: disable=too-many-locals, too-many-bra print(f"Loaded {len(data.accel[0]['T'])} accel and {len(data.gyro[0]['T'])} gyro samples") if progress_callback: - progress = 210 - progress_callback(progress) + progress_callback(210) if not tclr: # apply moving average filter with 2s width data.Filter(2) + c, clog = generate_calibration_file(outfile, online, progress_callback, data, c) + + if no_graph: + return + num_imus = len(data.IMUs()) + + generate_tempcal_gyro_figures(log_parm, figpath, data, c, clog, num_imus) + + if progress_callback: + progress_callback(290) + + generate_tempcal_accel_figures(log_parm, figpath, data, c, clog, num_imus) + + if progress_callback: + progress_callback(300) + + pyplot.show() + +def generate_calibration_file(outfile, online, progress_callback, data, c): # pylint: disable=too-many-locals clog = c c = Coefficients() if progress_callback: - progress += 10 + progress = 220 progress_callback(progress) progress_delta = 60 / (len(data.IMUs()) * len(AXES)) with open(outfile, "w", encoding='utf-8') as calfile: @@ -503,12 +521,10 @@ def IMUfit(logfile, outfile, # pylint: disable=too-many-locals, too-many-bra calfile.write(params) print(f"Calibration written to {outfile}") + return c, clog - if no_graph: - return +def generate_tempcal_gyro_figures(log_parm, figpath, data, c, clog, num_imus): # pylint: disable=too-many-arguments _fig, axs = pyplot.subplots(len(data.IMUs()), 1, sharex=True) - - num_imus = len(data.IMUs()) if num_imus == 1: axs = [axs] @@ -536,12 +552,10 @@ def IMUfit(logfile, outfile, # pylint: disable=too-many-locals, too-many-bra axs[imu].legend(loc='upper left') axs[imu].set_title(f'IMU[{imu}] Gyro (deg/s)') - if progress_callback: - progress_callback(290) - if figpath: _fig.savefig(os.path.join(figpath, 'tempcal_gyro.png')) +def generate_tempcal_accel_figures(log_parm, figpath, data, c, clog, num_imus): # pylint: disable=too-many-arguments _fig, axs = pyplot.subplots(num_imus, 1, sharex=True) if num_imus == 1: axs = [axs] @@ -576,11 +590,6 @@ def IMUfit(logfile, outfile, # pylint: disable=too-many-locals, too-many-bra if figpath: _fig.savefig(os.path.join(figpath, 'tempcal_acc.png')) - if progress_callback: - progress_callback(300) - - pyplot.show() - def main(): parser = ArgumentParser(description=__doc__) @@ -600,5 +609,6 @@ def main(): IMUfit(args.log, args.outfile, args.no_graph, args.log_parm, args.online, args.tclr, None, None) + if __name__ == "__main__": main() diff --git a/QUICKSTART.md b/QUICKSTART.md index 6bd0762..24637c5 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -1,4 +1,9 @@ # Quick start guide + ## 1. Install *ArduPilot Methodic Configurator* software on a PC or Mac @@ -35,14 +40,14 @@ 1. Open the *ArduPilot Methodic Configurator* software. 1. The software should now automatically detect and connect to your flight controller. ![AMC FC info and parameter download](images/App_screenshot_FC_info_and_param_download.png) -1. Select the vehicle template that better resembles your own vehicle. +1. Select the vehicle template that better resembles your vehicle. ![AMC template selection1](images/App_screenshot_Vehicle_directory1.png) ![AMC template selection2](images/App_screenshot_Vehicle_overview.png) 1. Give a name to your vehicle. ![AMC new vehicle name](images/App_screenshot_Vehicle_directory2.png) 1. Press *Create vehicle configuration from template*. ![AMC new vehicle create](images/App_screenshot_Vehicle_directory3.png) -1. Edit all the components of your vehicle to match your own in the *vehicle Component Editor* window. +1. Edit all the components of your vehicle to match your own in the *Vehicle Component Editor* window. ![AMC component editor](images/App_screenshot_Component_Editor.png) 1. Press *Save data and start configuration*. 1. The application will validate your input. @@ -66,7 +71,6 @@ Now do this in a loop until the software automatically closes or you are asked t - Press *Upload selected params to FC, and advance to next param file* (marked with the big red number 7), - Repeat until the program automatically closes. - ## 6. Use the *ArduPilot Methodic Configurator* software after having created a vehicle from template 1. Connect the flight controller to the computer using a USB cable. @@ -82,5 +86,5 @@ double-click and step inside the directory that you want to use, not just select 1. Press *Save data and start configuration*. 1. You should now see the *Parameter file editor and uploader* window. ![AMC parameter file editor and uploader](images/App_screenshot2.png) -1. Proceed as explained on [section 5](#5-configure-the-vehicles-parameters-in-a-traceable-way) -Congratulations your flight controller is now fully configured in the safest and fastest way publicly know. +1. Proceed as explained in [section 5](#5-configure-the-vehicles-parameters-in-a-traceable-way) +Congratulations your flight controller is now fully configured in the safest and fastest way publicly known. diff --git a/README.md b/README.md index f1c2b6b..26663e2 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ -# ArduPilot Methodic Configurator # Everyone should be able to configure ArduPilot for their vehicles + + | Lint | Quality | Test | Deploy | Maintain | | ---- | ------- | ---- | ------ | -------- | -| [![Pylint](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/pylint.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/pylint.yml) | [![REUSE status](https://api.reuse.software/badge/github.com/ArduPilot/MethodicConfigurator)](https://api.reuse.software/info/github.com/ArduPilot/MethodicConfigurator) | [![Python unit-tests](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/unit-tests.yml) | [![pages-build-deployment](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/pages/pages-build-deployment) | [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/ArduPilot/MethodicConfigurator.svg)](http://isitmaintained.com/project/ArduPilot/MethodicConfigurator) | +| [![Pylint](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/pylint.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/pylint.yml) | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/720794ed54014c58b9eaf7a097a4e98e)](https://app.codacy.com/gh/amilcarlucas/MethodicConfigurator/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) | [![Python unit-tests](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/unit-tests.yml) | [![pages-build-deployment](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/pages/pages-build-deployment) | [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/ArduPilot/MethodicConfigurator.svg)](http://isitmaintained.com/project/ArduPilot/MethodicConfigurator) | | [![test Python cleanliness](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/ruff.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/ruff.yml) | [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9101/badge)](https://www.bestpractices.dev/projects/9101) | [![Pytest unittests](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/unittests.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/unittests.yml) | [![Upload MethodicConfigurator Package](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/python-publish.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/python-publish.yml) | [![Percentage of issues still open](http://isitmaintained.com/badge/open/ArduPilot/MethodicConfigurator.svg)](http://isitmaintained.com/project/ArduPilot/MethodicConfigurator) | -| | [![Known Vulnerabilities](https://snyk.io/test/github/amilcarlucas/MethodicConfigurator/badge.svg)](https://snyk.io/test/github/amilcarlucas/MethodicConfigurator) | [![codecov](https://codecov.io/github/amilcarlucas/MethodicConfigurator/graph/badge.svg?token=76P928EOL2)](https://codecov.io/github/amilcarlucas/MethodicConfigurator) | [![Windows Build](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/windows_build.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/windows_build.yml) | -| | [![Code Climate](https://codeclimate.com/github/amilcarlucas/MethodicConfigurator.png)](https://codeclimate.com/github/amilcarlucas/MethodicConfigurator) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/30346/badge.svg)](https://scan.coverity.com/projects/ardupilot-methodic-configurator) | [![Github All Releases](https://img.shields.io/github/downloads/ArduPilot/MethodicConfigurator/total.svg)]() | | - - +| | [![Known Vulnerabilities](https://snyk.io/test/github/amilcarlucas/MethodicConfigurator/badge.svg)](https://snyk.io/test/github/amilcarlucas/MethodicConfigurator) | [![codecov](https://codecov.io/github/amilcarlucas/MethodicConfigurator/graph/badge.svg?token=76P928EOL2)](https://codecov.io/github/amilcarlucas/MethodicConfigurator) | [![Windows Build](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/windows_build.yml/badge.svg)](https://github.com/ArduPilot/MethodicConfigurator/actions/workflows/windows_build.yml) | | +| | [![Code Climate](https://codeclimate.com/github/amilcarlucas/MethodicConfigurator.png)](https://codeclimate.com/github/amilcarlucas/MethodicConfigurator) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/30346/badge.svg)](https://scan.coverity.com/projects/ardupilot-methodic-configurator) | [![Github All Releases](https://img.shields.io/github/downloads/ArduPilot/MethodicConfigurator/total.svg)](https://github.com/ArduPilot/MethodicConfigurator/releases) | | Amilcar Lucas's ArduPilot Methodic Configurator is a Python tool that implements a [clear and proven configuration sequence of ArduPilot of drones](https://discuss.ardupilot.org/t/how-to-methodically-tune-almost-any-multicopter-using-arducopter-4-4-x/110842/1). @@ -59,4 +62,4 @@ To use and develop this software you must obey the [ArduPilot Methodic Configura ## License This project is licensed under the [GNU General Public License v3.0](LICENSE.md). -It builds upon other [opensource software packages](credits/CREDITS.md) +It builds upon other [open-source software packages](credits/CREDITS.md) diff --git a/USERMANUAL.md b/USERMANUAL.md index 275c577..2c0789b 100644 --- a/USERMANUAL.md +++ b/USERMANUAL.md @@ -1,4 +1,9 @@ # ArduPilot Methodic Configurator User Manual + ## Overview diff --git a/credits/CREDITS.md b/credits/CREDITS.md index 36cfbdb..85ded19 100644 --- a/credits/CREDITS.md +++ b/credits/CREDITS.md @@ -1,7 +1,16 @@ + + # Licenses -This software is built on top of (depends on) other open source software. -We thank the developers of those software. +We use [REUSE software API](https://api.reuse.software/) in the form of SPDX tags in most of the files to explicitly declare Copyright and License. +However we do not do it for every single file and hence are [![REUSE status](https://api.reuse.software/badge/github.com/ArduPilot/MethodicConfigurator)](https://api.reuse.software/info/github.com/ArduPilot/MethodicConfigurator) + +This software is licensed under the [GNU General Public License v3.0](../LICENSE.md) and is built on top of (depends on) other open-source software. +We are thankful to the developers of those software packages. It directly uses: @@ -16,7 +25,7 @@ It directly uses: | [re](https://docs.python.org/3/library/re.html) | [Python Software Foundation License](https://docs.python.org/3/license.html) | | [webbrowser](https://docs.python.org/3/library/webbrowser.html) | [Python Software Foundation License](https://docs.python.org/3/license.html) | | [pymavlink](https://github.com/ArduPilot/pymavlink) | [GNU Lesser General Public License v3.0](https://github.com/ArduPilot/pymavlink/blob/master/COPYING) | -| [ArduPilot tempcal_IMU.py](https://github.com/ArduPilot/ardupilot/blob/master/Tools/scripts/tempcal_IMU.py) | [](https://github.com/ArduPilot/ardupilot/blob/master/COPYING.txt) | +| [ArduPilot tempcal_IMU.py](https://github.com/ArduPilot/ardupilot/blob/master/Tools/scripts/tempcal_IMU.py) | [GNU General Public License v3.0](https://github.com/ArduPilot/ardupilot/blob/master/COPYING.txt) | | [platformdirs](https://platformdirs.readthedocs.io/en/latest/index.html) | [MIT](https://github.com/platformdirs/platformdirs/blob/main/LICENSE) | | [pyserial](https://pyserial.readthedocs.io/en/latest/pyserial.html) | [BSD License](https://github.com/pyserial/pyserial/blob/master/LICENSE.txt) | | [Scrollable TK frame](https://gist.github.com/mp035/9f2027c3ef9172264532fcd6262f3b01) by Mark Pointing | [Mozilla Public License, v. 2.0](https://mozilla.org/MPL/2.0/) | @@ -33,4 +42,4 @@ It indirectly uses: | [lxml](https://github.com/lxml/lxml) | [BSD License](https://github.com/lxml/lxml/blob/master/LICENSE.txt) | | [idna](https://github.com/kjd/idna) | [BSD License](https://github.com/kjd/idna/blob/master/LICENSE.md) | -Their licenses are linked above and are available on this directory. +Their licenses are linked above and are available in [this directory](https://github.com/ArduPilot/MethodicConfigurator/tree/master/credits). diff --git a/install_linux.sh b/install_linux.sh index f0b687e..aeb88a6 100755 --- a/install_linux.sh +++ b/install_linux.sh @@ -1,4 +1,8 @@ #!/bin/bash +# +# SPDX-FileCopyrightText: 2024 Amilcar do Carmo Lucas +# +#SPDX-License-Identifier: GPL-3.0-or-later # Update package lists echo "Updating package lists..." @@ -25,7 +29,7 @@ if [ -f /etc/debian_version ] || [ -f /etc/os-release ] && grep -q 'ID_LIKE=.*de # Define the desktop entry content desktop_entry="[Desktop Entry]\nName=ArduPilot Methodic Configurator\nComment=A clear ArduPilot configuration sequence\nExec=bash -c 'cd $prog_dir && python3 ardupilot_methodic_configurator.py'\nIcon=$prog_dir/ArduPilot_icon.png\nTerminal=true\nType=Application\nCategories=Development;\nKeywords=ardupilot;arducopter;drone;copter;scm" # Create the .desktop file in the appropriate directory - echo -e $desktop_entry > /home/$USER/.local/share/applications/MethodicConfigurator.desktop + echo -e $desktop_entry > "/home/$USER/.local/share/applications/MethodicConfigurator.desktop" echo "MethodicConfigurator.desktop created successfully." else echo "This system is not Debian-based. Skipping .desktop file creation." @@ -34,9 +38,9 @@ fi # Check if the ~/Desktop directory exists if [ -d "$HOME/Desktop" ]; then # Copy the .desktop file to the ~/Desktop directory - cp /home/$USER/.local/share/applications/MethodicConfigurator.desktop $HOME/Desktop/ + cp "/home/$USER/.local/share/applications/MethodicConfigurator.desktop" "$HOME/Desktop/" # Mark it as thrusted - chmod 755 $HOME/Desktop/MethodicConfigurator.desktop + chmod 755 "$HOME/Desktop/MethodicConfigurator.desktop" echo "MethodicConfigurator.desktop copied to ~/Desktop." else echo "~/Desktop directory does not exist. Skipping copy to Desktop." diff --git a/install_macos.sh b/install_macos.sh index a678c92..4a4d638 100755 --- a/install_macos.sh +++ b/install_macos.sh @@ -1,4 +1,8 @@ #!/bin/bash +# +# SPDX-FileCopyrightText: 2024 Amilcar do Carmo Lucas +# +#SPDX-License-Identifier: GPL-3.0-or-later # Use venv if you use python3 due to the PEP668 python3 -m venv venv diff --git a/install_windows.bat b/install_windows.bat index 2b2f18a..e567ccb 100644 --- a/install_windows.bat +++ b/install_windows.bat @@ -1,4 +1,7 @@ @echo off +rem SPDX-FileCopyrightText: 2024 Amilcar do Carmo Lucas +rem +rem SPDX-License-Identifier: GPL-3.0-or-later echo WARNING: If you proceed the python serial package will be uninstalled because it conflicts with pyserial. choice /C YN /M "Do you want to proceed? (Y/N)" diff --git a/param_reorder.py b/param_reorder.py index 5a9a602..a30c96f 100755 --- a/param_reorder.py +++ b/param_reorder.py @@ -45,6 +45,7 @@ def reorder_param_files(steps): print(f"Info: Will rename {old_key} to {new_key}") return renames + def loop_relevant_files(renames, steps): param_dirs = ['.'] # Search all *.py, *.json and *.md files in the current directory @@ -64,6 +65,7 @@ def loop_relevant_files(renames, steps): update_file_contents(renames, root, file, steps) return param_dirs + def uplate_old_filenames(renames, steps): for new_name, old_name in renames.items(): if old_name != new_name: @@ -73,6 +75,7 @@ def uplate_old_filenames(renames, steps): else: steps[old_name]["old_filenames"] = [old_name] + def update_file_contents(renames, root, file, steps): with open(os.path.join(root, file), "r", encoding="utf-8") as handle: file_content = handle.read() @@ -89,6 +92,7 @@ def update_file_contents(renames, root, file, steps): with open(os.path.join(root, file), "w", encoding="utf-8") as handle: handle.write(file_content) + def update_configuration_steps_json_file_contents(steps, file_content, new_name, old_name): new_file_content = "" curr_filename = '' @@ -110,6 +114,7 @@ def update_configuration_steps_json_file_contents(steps, file_content, new_name, new_file_content += line.replace(old_name, new_name) return new_file_content + def rename_file(old_name, new_name, param_dir): """Rename a single file.""" old_name_path = os.path.join(param_dir, old_name) @@ -119,12 +124,14 @@ def rename_file(old_name, new_name, param_dir): else: print(f"Error: Could not rename file {old_name_path}, file not found") + def reorder_actual_files(renames, param_dirs): # Rename the actual files on disk based on renames re-ordering for param_dir in param_dirs: for new_name, old_name in renames.items(): rename_file(old_name, new_name, param_dir) + def change_line_endings_for_md_files(): # Change line endings of BLOG*.md files to CRLF for root, _dirs, files in os.walk("."): @@ -137,6 +144,7 @@ def change_line_endings_for_md_files(): with open(file_path, "wb") as handle: handle.write(content) + def main(): with open(os.path.join("MethodicConfigurator", SEQUENCE_FILENAME), 'r', encoding='utf-8') as f: steps = json.load(f) @@ -145,5 +153,6 @@ def main(): reorder_actual_files(renames, param_dirs) change_line_endings_for_md_files() + if __name__ == "__main__": main() diff --git a/setup.py b/setup.py index 7306224..65ca4dc 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 ''' -This script downloads the licenses of the direct and indirect dependencies of the project +This script creates the MethodicConfigurator pip python package This file is part of Ardupilot methodic configurator. https://github.com/ArduPilot/MethodicConfigurator diff --git a/unittests/annotate_params_test.sh b/unittests/annotate_params_test.sh index 8c9c60b..b742b69 100755 --- a/unittests/annotate_params_test.sh +++ b/unittests/annotate_params_test.sh @@ -1,3 +1,9 @@ +#!/bin/bash +# +# SPDX-FileCopyrightText: 2024 Amilcar do Carmo Lucas +# +#SPDX-License-Identifier: GPL-3.0-or-later + PYTHONPATH=../MethodicConfigurator python3 -m coverage run -m unittest annotate_params_test.py python3 -m coverage html firefox htmlcov/annotate_params_py.html \ No newline at end of file diff --git a/unittests/extract_param_defaults_test.sh b/unittests/extract_param_defaults_test.sh index 4d5f4ae..dd432bd 100755 --- a/unittests/extract_param_defaults_test.sh +++ b/unittests/extract_param_defaults_test.sh @@ -1,3 +1,9 @@ +#!/bin/bash +# +# SPDX-FileCopyrightText: 2024 Amilcar do Carmo Lucas +# +#SPDX-License-Identifier: GPL-3.0-or-later + PYTHONPATH=../MethodicConfigurator python3 -m coverage run -m unittest extract_param_defaults_test.py python3 -m coverage html firefox htmlcov/extract_param_defaults_py.html \ No newline at end of file diff --git a/unittests/param_pid_adjustment_update_test.sh b/unittests/param_pid_adjustment_update_test.sh index f5a1537..7975a83 100755 --- a/unittests/param_pid_adjustment_update_test.sh +++ b/unittests/param_pid_adjustment_update_test.sh @@ -1,3 +1,9 @@ +#!/bin/bash +# +# SPDX-FileCopyrightText: 2024 Amilcar do Carmo Lucas +# +#SPDX-License-Identifier: GPL-3.0-or-later + PYTHONPATH=../MethodicConfigurator python3 -m coverage run -m unittest param_pid_adjustment_update_test.py python3 -m coverage html firefox htmlcov/param_pid_adjustment_update_py.html \ No newline at end of file