refactor(parameters): remove legacy params.c build infrastructure

All parameters are now defined in YAML module configuration files.
Remove the cmake infrastructure that discovered and processed
legacy params.c files:
- Remove GLOB_RECURSE for *params.c/*parameters.c
- Remove .c file scanning from DISABLE_PARAMS_MODULE_SCOPING
- Remove module_list from px_process_params.py --src-path
- Remove PX4_MODULE_PATHS usage (no longer needed for param scanning)
This commit is contained in:
Jacob Dahl 2026-03-17 22:43:36 -08:00 committed by Jacob Dahl
parent 55ab880823
commit e8739d0f96
3 changed files with 6 additions and 22 deletions

View File

@ -548,7 +548,8 @@ validate_module_configs:
-not -path "$(SRC_DIR)/src/modules/zenoh/zenoh-pico/*" \
-not -path "$(SRC_DIR)/src/lib/events/libevents/*" \
-not -path "$(SRC_DIR)/src/lib/cdrstream/*" \
-not -path "$(SRC_DIR)/src/lib/crypto/libtommath/*" -print0 | \
-not -path "$(SRC_DIR)/src/lib/crypto/libtommath/*" \
-not -path "$(SRC_DIR)/src/lib/tensorflow_lite_micro/*" -print0 | \
xargs -0 "$(SRC_DIR)"/Tools/validate_yaml.py --schema-file "$(SRC_DIR)"/validation/module_schema.yaml
# Cleanup

View File

@ -37,21 +37,9 @@ if (NOT PARAM_DEFAULT_OVERRIDES)
set(PARAM_DEFAULT_OVERRIDES "{}")
endif()
# get full path for each module
get_property(module_list GLOBAL PROPERTY PX4_MODULE_PATHS)
get_property(module_config_files GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)
if(DISABLE_PARAMS_MODULE_SCOPING)
# search all directories with .c files (potentially containing parameters)
file(GLOB_RECURSE c_files
${PX4_SOURCE_DIR}/src/*.c
${external_module_paths}
)
foreach(file_path ${c_files})
get_filename_component(dir_path ${file_path} PATH)
list(APPEND module_list "${dir_path}")
endforeach()
# search for all module configs as well
file(GLOB_RECURSE yaml_files
${PX4_SOURCE_DIR}/src/*.yaml
@ -72,12 +60,8 @@ if(DISABLE_PARAMS_MODULE_SCOPING)
endforeach()
list(REMOVE_DUPLICATES module_config_files)
else()
list(APPEND module_list ${external_module_paths})
endif()
list(REMOVE_DUPLICATES module_list)
set(generated_params_dir ${PX4_BINARY_DIR}/generated_params)
set(generated_serial_params_file ${generated_params_dir}/serial_params.c)
set(generated_module_params_file ${generated_params_dir}/module_params.c)
@ -116,10 +100,9 @@ add_custom_command(OUTPUT ${generated_serial_params_file} ${generated_module_par
set(parameters_xml ${PX4_BINARY_DIR}/parameters.xml)
set(parameters_json ${PX4_BINARY_DIR}/parameters.json)
file(GLOB_RECURSE param_src_files ${PX4_SOURCE_DIR}/src/*params.c ${PX4_SOURCE_DIR}/src/*parameters.c)
add_custom_command(OUTPUT ${parameters_xml} ${parameters_json} ${parameters_json}.xz
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/px_process_params.py
--src-path ${module_list} ${generated_params_dir}
--src-path ${generated_params_dir}
--xml ${parameters_xml}
--json ${parameters_json}
--compress
@ -132,7 +115,6 @@ add_custom_command(OUTPUT ${parameters_xml} ${parameters_json} ${parameters_json
--skip-if-no-schema # mavlink submodule might not exist for current target if built in CI
#--verbose
DEPENDS
${param_src_files}
${generated_serial_params_file}
${generated_module_params_file}
px4params/srcparser.py

View File

@ -155,7 +155,8 @@ parameters:
'm/s^3/sqrt(Hz)', 'm/s/sqrt(Hz)', 's/(1000*PWM)', '%m/s', 'min', 'us/C',
'N/(m/s)', 'Nm/(rad/s)', 'Nm', 'N',
'rpm',
'normalized_thrust/s', 'normalized_thrust', 'norm', 'SD', 'dBHz']
'normalized_thrust/s', 'normalized_thrust', 'norm', 'SD', 'dBHz',
'1/s/sqrt(Hz)', 'liters']
bit:
# description of all bits for type bitmask.
# The first bit is 0.
@ -169,7 +170,7 @@ parameters:
# enumeration of possible values for type enum
type: dict
keyschema:
type: integer
type: number
valueschema:
type: string