module_config: support custom actuators_metadata backed by module-level params

This commit is contained in:
SalimTerryLi 2023-04-29 18:57:14 +08:00 committed by Beat Küng
parent 7eb6535273
commit 9c467198be
2 changed files with 40 additions and 26 deletions

View File

@ -264,7 +264,18 @@ def get_actuator_output(yaml_config, output_functions, timer_config_file, verbos
}
per_channel_params.append(param)
# TODO: support non-standard per-channel parameters
custom_params = group.get('custom_params', [])
for custom_param in custom_params:
# Simply pulls all custom params, assuming they are valid ones
param = {
'name': param_prefix+'_'+custom_param['name'],
}
# TODO: check and match the custom params in output_groups with module-level parameters
del custom_param['name']
for param_key in custom_param:
# '-' is used in actuators.schema.json, while '_' is used in module_schema.yml
param[param_key.replace('_', '-')] = custom_param[param_key]
per_channel_params.append(param)
subgroup['per-channel-parameters'] = per_channel_params

View File

@ -369,6 +369,33 @@ actuator_output:
# ui only shows the param if this condition is true
type: string
regex: *condition_regex
custom_params:
type: list
schema: &mixer_parameter
type: dict
schema:
label:
type: string
name:
# param name
type: string
required: true
show_as:
type: string
allowed: [ 'bitset', 'true-if-positive' ]
show_if:
# condition
type: string
regex: *condition_regex
index_offset:
type: integer
advanced:
type: integer
function:
type: string
identifier:
# for rules
type: string
extra_function_groups:
# Additional function groups to add, defined in output_functions.yaml
type: list
@ -477,31 +504,7 @@ mixer:
per_item_parameters:
type: list
minlength: 1
schema: &mixer_parameter
type: dict
schema:
label:
type: string
name:
# param name
type: string
required: true
show_as:
type: string
allowed: [ 'bitset', 'true-if-positive' ]
show_if:
# condition
type: string
regex: *condition_regex
index_offset:
type: integer
advanced:
type: integer
function:
type: string
identifier:
# for rules
type: string
schema: *mixer_parameter
rules:
# mixer rules, validated by the mavlink actuator component information schema
type: list