Skip to content

Commit

Permalink
module_config: support custom actuators_metadata backed by module-lev…
Browse files Browse the repository at this point in the history
…el params
  • Loading branch information
SalimTerryLi authored and bkueng committed May 2, 2023
1 parent 7eb6535 commit 9c46719
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 26 deletions.
13 changes: 12 additions & 1 deletion Tools/module_config/generate_actuators_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,18 @@ def get_config_params(param_list):
}
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

Expand Down
53 changes: 28 additions & 25 deletions validation/module_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9c46719

Please sign in to comment.