mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
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:
@@ -548,7 +548,8 @@ validate_module_configs:
|
|||||||
-not -path "$(SRC_DIR)/src/modules/zenoh/zenoh-pico/*" \
|
-not -path "$(SRC_DIR)/src/modules/zenoh/zenoh-pico/*" \
|
||||||
-not -path "$(SRC_DIR)/src/lib/events/libevents/*" \
|
-not -path "$(SRC_DIR)/src/lib/events/libevents/*" \
|
||||||
-not -path "$(SRC_DIR)/src/lib/cdrstream/*" \
|
-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
|
xargs -0 "$(SRC_DIR)"/Tools/validate_yaml.py --schema-file "$(SRC_DIR)"/validation/module_schema.yaml
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
|||||||
@@ -37,21 +37,9 @@ if (NOT PARAM_DEFAULT_OVERRIDES)
|
|||||||
set(PARAM_DEFAULT_OVERRIDES "{}")
|
set(PARAM_DEFAULT_OVERRIDES "{}")
|
||||||
endif()
|
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)
|
get_property(module_config_files GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)
|
||||||
|
|
||||||
if(DISABLE_PARAMS_MODULE_SCOPING)
|
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
|
# search for all module configs as well
|
||||||
file(GLOB_RECURSE yaml_files
|
file(GLOB_RECURSE yaml_files
|
||||||
${PX4_SOURCE_DIR}/src/*.yaml
|
${PX4_SOURCE_DIR}/src/*.yaml
|
||||||
@@ -72,12 +60,8 @@ if(DISABLE_PARAMS_MODULE_SCOPING)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
list(REMOVE_DUPLICATES module_config_files)
|
list(REMOVE_DUPLICATES module_config_files)
|
||||||
else()
|
|
||||||
list(APPEND module_list ${external_module_paths})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(REMOVE_DUPLICATES module_list)
|
|
||||||
|
|
||||||
set(generated_params_dir ${PX4_BINARY_DIR}/generated_params)
|
set(generated_params_dir ${PX4_BINARY_DIR}/generated_params)
|
||||||
set(generated_serial_params_file ${generated_params_dir}/serial_params.c)
|
set(generated_serial_params_file ${generated_params_dir}/serial_params.c)
|
||||||
set(generated_module_params_file ${generated_params_dir}/module_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_xml ${PX4_BINARY_DIR}/parameters.xml)
|
||||||
set(parameters_json ${PX4_BINARY_DIR}/parameters.json)
|
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
|
add_custom_command(OUTPUT ${parameters_xml} ${parameters_json} ${parameters_json}.xz
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/px_process_params.py
|
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}
|
--xml ${parameters_xml}
|
||||||
--json ${parameters_json}
|
--json ${parameters_json}
|
||||||
--compress
|
--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
|
--skip-if-no-schema # mavlink submodule might not exist for current target if built in CI
|
||||||
#--verbose
|
#--verbose
|
||||||
DEPENDS
|
DEPENDS
|
||||||
${param_src_files}
|
|
||||||
${generated_serial_params_file}
|
${generated_serial_params_file}
|
||||||
${generated_module_params_file}
|
${generated_module_params_file}
|
||||||
px4params/srcparser.py
|
px4params/srcparser.py
|
||||||
|
|||||||
@@ -155,7 +155,8 @@ parameters:
|
|||||||
'm/s^3/sqrt(Hz)', 'm/s/sqrt(Hz)', 's/(1000*PWM)', '%m/s', 'min', 'us/C',
|
'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',
|
'N/(m/s)', 'Nm/(rad/s)', 'Nm', 'N',
|
||||||
'rpm',
|
'rpm',
|
||||||
'normalized_thrust/s', 'normalized_thrust', 'norm', 'SD', 'dBHz']
|
'normalized_thrust/s', 'normalized_thrust', 'norm', 'SD', 'dBHz',
|
||||||
|
'1/s/sqrt(Hz)', 'liters']
|
||||||
bit:
|
bit:
|
||||||
# description of all bits for type bitmask.
|
# description of all bits for type bitmask.
|
||||||
# The first bit is 0.
|
# The first bit is 0.
|
||||||
@@ -169,7 +170,7 @@ parameters:
|
|||||||
# enumeration of possible values for type enum
|
# enumeration of possible values for type enum
|
||||||
type: dict
|
type: dict
|
||||||
keyschema:
|
keyschema:
|
||||||
type: integer
|
type: number
|
||||||
valueschema:
|
valueschema:
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user