From 7b68c5dbfcaee8f9b9973a620ea2fd77a6182a90 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Thu, 11 Sep 2025 20:47:45 +0200 Subject: [PATCH] parameters: remove parameters_injected.xml and support for it in the build system (#25549) This was apparently added 10 years ago to store metadata of UAVCAN components within the PX4 binary. The parameters in the xml are mostly early UAVCAN ESC parameters that are presumably out of date and not used. Also it does not scale to maintain metadata for all the possible UAVCAN components and it causes confusion when users read the metadata documentation because these parameters are not available in PX4. That's why I suggest to remove it. --- cmake/metadata.cmake | 3 - src/lib/parameters/CMakeLists.txt | 5 +- src/lib/parameters/parameters_injected.xml | 198 --------------------- src/lib/parameters/px4params/jsonout.py | 2 +- src/lib/parameters/px_process_params.py | 13 +- 5 files changed, 4 insertions(+), 217 deletions(-) delete mode 100644 src/lib/parameters/parameters_injected.xml diff --git a/cmake/metadata.cmake b/cmake/metadata.cmake index 82b2042701..803d14c9e2 100644 --- a/cmake/metadata.cmake +++ b/cmake/metadata.cmake @@ -71,18 +71,15 @@ add_custom_target(metadata_parameters COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/parameters/px_process_params.py --src-path `find ${PX4_SOURCE_DIR}/src -maxdepth 4 -type d` ${generated_params_dir} - --inject-xml ${PX4_SOURCE_DIR}/src/lib/parameters/parameters_injected.xml --markdown ${PX4_BINARY_DIR}/docs/parameters.md COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/parameters/px_process_params.py --src-path `find ${PX4_SOURCE_DIR}/src -maxdepth 4 -type d` ${generated_params_dir} - --inject-xml ${PX4_SOURCE_DIR}/src/lib/parameters/parameters_injected.xml --json ${PX4_BINARY_DIR}/docs/parameters.json --compress COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/parameters/px_process_params.py --src-path `find ${PX4_SOURCE_DIR}/src -maxdepth 4 -type d` ${generated_params_dir} - --inject-xml ${PX4_SOURCE_DIR}/src/lib/parameters/parameters_injected.xml --xml ${PX4_BINARY_DIR}/docs/parameters.xml COMMENT "Generating full parameter metadata (markdown, xml, and json)" diff --git a/src/lib/parameters/CMakeLists.txt b/src/lib/parameters/CMakeLists.txt index 81b609080a..cfa118b2dd 100644 --- a/src/lib/parameters/CMakeLists.txt +++ b/src/lib/parameters/CMakeLists.txt @@ -123,7 +123,6 @@ add_custom_command(OUTPUT ${parameters_xml} ${parameters_json} ${parameters_json --xml ${parameters_xml} --json ${parameters_json} --compress - --inject-xml ${CMAKE_CURRENT_SOURCE_DIR}/parameters_injected.xml --overrides ${PARAM_DEFAULT_OVERRIDES} --board ${PX4_BOARD} #--verbose @@ -136,13 +135,11 @@ add_custom_command(OUTPUT ${parameters_xml} ${parameters_json} ${parameters_json ${param_src_files} ${generated_serial_params_file} ${generated_module_params_file} - parameters_injected.xml px4params/srcparser.py px4params/srcscanner.py px4params/jsonout.py px4params/xmlout.py px_process_params.py - parameters_injected.xml COMMENT "Generating parameters.xml" ) add_custom_target(parameters_xml DEPENDS ${parameters_xml}) @@ -161,7 +158,7 @@ add_custom_target(parameters_header DEPENDS px4_parameters.hpp) set(SRCS) list(APPEND SRCS - parameters.cpp + parameters.cpp atomic_transaction.cpp autosave.cpp ) diff --git a/src/lib/parameters/parameters_injected.xml b/src/lib/parameters/parameters_injected.xml deleted file mode 100644 index b927adc289..0000000000 --- a/src/lib/parameters/parameters_injected.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - 3 - - - Speed controller bandwidth - Speed controller bandwidth, in Hz. Higher values result in faster speed and current rise times, but may result in overshoot and higher current consumption. For fixed-wing aircraft, this value should be less than 50 Hz; for multirotors, values up to 100 Hz may provide improvements in responsiveness. - Hz - 10 - 250 - - - Reverse direction - Motor spin direction as detected during initial enumeration. Use 0 or 1 to reverse direction. - 0 - 1 - - - Speed (RPM) controller gain - Speed (RPM) controller gain. Determines controller - aggressiveness; units are amp-seconds per radian. Systems with - higher rotational inertia (large props) will need gain increased; - systems with low rotational inertia (small props) may need gain - decreased. Higher values result in faster response, but may result - in oscillation and excessive overshoot. Lower values result in a - slower, smoother response. - C/rad - 3 - 0.00 - 1.00 - - - Idle speed (e Hz) - Idle speed (e Hz) - Hz - 3 - 0.0 - 100.0 - - - Spin-up rate (e Hz/s) - Spin-up rate (e Hz/s) - 1/s^2 - 5 - 1000 - - - Index of this ESC in throttle command messages. - Index of this ESC in throttle command messages. - 0 - 15 - - - Extended status ID - Extended status ID - 1 - 1000000 - - - Extended status interval (µs) - Extended status interval (µs) - us - 0 - 1000000 - - - ESC status interval (µs) - ESC status interval (µs) - us - 1000000 - - - Motor current limit in amps - Motor current limit in amps. This determines the maximum - current controller setpoint, as well as the maximum allowable - current setpoint slew rate. This value should generally be set to - the continuous current rating listed in the motor’s specification - sheet, or set equal to the motor’s specified continuous power - divided by the motor voltage limit. - A - 3 - 1 - 80 - - - Motor Kv in RPM per volt - Motor Kv in RPM per volt. This can be taken from the motor’s - specification sheet; accuracy will help control performance but - some deviation from the specified value is acceptable. - rpm/V - 0 - 4000 - - - READ ONLY: Motor inductance in henries. - READ ONLY: Motor inductance in henries. This is measured on start-up. - H - 3 - - - Number of motor poles. - Number of motor poles. Used to convert mechanical speeds to - electrical speeds. This number should be taken from the motor’s - specification sheet. - 2 - 40 - - - READ ONLY: Motor resistance in ohms - READ ONLY: Motor resistance in ohms. This is measured on start-up. When - tuning a new motor, check that this value is approximately equal - to the value shown in the motor’s specification sheet. - Ohm - 3 - - - Acceleration limit (V) - Acceleration limit (V) - V - 3 - 0.01 - 1.00 - - - Motor voltage limit in volts - Motor voltage limit in volts. The current controller’s - commanded voltage will never exceed this value. Note that this may - safely be above the nominal voltage of the motor; to determine the - actual motor voltage limit, divide the motor’s rated power by the - motor current limit. - V - 3 - 0 - - - - - device health warning - Set the device health to Warning if the dimensionality of - the GNSS solution is less than this value. 3 for the full (3D) - solution, 2 for planar (2D) solution, 1 for time-only solution, - 0 disables the feature. - - 0 - 3 - - disables the feature - time-only solution - planar (2D) solution - full (3D) solution - - - - - Set the device health to Warning if the number of satellites - used in the GNSS solution is below this threshold. Zero - disables the feature - - - - GNSS dynamic model - Dynamic model used in the GNSS positioning engine. 0 – - Automotive, 1 – Sea, 2 – Airborne. - - 0 - 2 - - Automotive - Sea - Airborne - - - - Broadcast old GNSS fix message - Broadcast the old (deprecated) GNSS fix message - uavcan.equipment.gnss.Fix alongside the new alternative - uavcan.equipment.gnss.Fix2. It is recommended to - disable this feature to reduce the CAN bus traffic. - - 0 - 1 - - Fix2 - Fix and Fix2 - - - - - Set the device health to Warning if the number of satellites - used in the GNSS solution is below this threshold. Zero - disables the feature - - us - 0 - 1000000 - - - diff --git a/src/lib/parameters/px4params/jsonout.py b/src/lib/parameters/px4params/jsonout.py index e4a8b021bd..ba97c740d9 100644 --- a/src/lib/parameters/px4params/jsonout.py +++ b/src/lib/parameters/px4params/jsonout.py @@ -5,7 +5,7 @@ import sys class JsonOutput(): - def __init__(self, groups, board, inject_xml_file_name): + def __init__(self, groups, board): all_json=dict() all_json['version']=1 all_params=[] diff --git a/src/lib/parameters/px_process_params.py b/src/lib/parameters/px_process_params.py index feefa684c8..2d35e3e95d 100755 --- a/src/lib/parameters/px_process_params.py +++ b/src/lib/parameters/px_process_params.py @@ -75,12 +75,6 @@ def main(): metavar="FILENAME", help="Create XML file" " (default FILENAME: parameters.xml)") - parser.add_argument("-i", "--inject-xml", - nargs='?', - const="parameters_injected.xml", - metavar="FILENAME", - help="Inject additional param XML file" - " (default FILENAME: parameters_injected.xml)") parser.add_argument("-b", "--board", nargs='?', const="", @@ -138,8 +132,6 @@ def main(): #inject parameters at front of set cur_dir = os.path.dirname(os.path.realpath(__file__)) - groups_to_inject = injectxmlparams.XMLInject(os.path.join(cur_dir, args.inject_xml)).injected() - param_groups=groups_to_inject+param_groups override_dict = json.loads(args.overrides) if len(override_dict.keys()) > 0: @@ -174,8 +166,7 @@ def main(): if args.verbose: print("Creating Json file " + args.json) cur_dir = os.path.dirname(os.path.realpath(__file__)) - out = jsonout.JsonOutput(param_groups, args.board, - os.path.join(cur_dir, args.inject_xml)) + out = jsonout.JsonOutput(param_groups, args.board) out.Save(args.json) output_files.append(args.json) @@ -184,7 +175,7 @@ def main(): if args.verbose: print("Compressing file " + f) save_compressed(f) - + if __name__ == "__main__": main()