mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 20:28:37 +08:00
generate_actuators_metadata: minor additions (index_offset, item_label_prefix)
This commit is contained in:
@@ -346,33 +346,39 @@ def get_mixers(yaml_config, output_functions, verbose):
|
|||||||
|
|
||||||
if 'count' in actuator_conf: # possibly dynamic size
|
if 'count' in actuator_conf: # possibly dynamic size
|
||||||
actuator['count'] = actuator_conf['count']
|
actuator['count'] = actuator_conf['count']
|
||||||
per_item_params = actuator_conf['per_item_parameters']
|
per_item_params = actuator_conf.get('per_item_parameters', {})
|
||||||
params = []
|
params = []
|
||||||
if 'standard' in per_item_params:
|
if 'standard' in per_item_params:
|
||||||
standard_params = per_item_params['standard']
|
standard_params = per_item_params['standard']
|
||||||
|
index_offset = standard_params.get('index_offset', 0)
|
||||||
if 'position' in standard_params:
|
if 'position' in standard_params:
|
||||||
params.extend([
|
params.extend([
|
||||||
{
|
{
|
||||||
'label': 'Position X',
|
'label': 'Position X',
|
||||||
'function': 'posx',
|
'function': 'posx',
|
||||||
'name': standard_params['position'][0],
|
'name': standard_params['position'][0],
|
||||||
|
'index-offset': index_offset,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': 'Position Y',
|
'label': 'Position Y',
|
||||||
'function': 'posy',
|
'function': 'posy',
|
||||||
'name': standard_params['position'][1],
|
'name': standard_params['position'][1],
|
||||||
|
'index-offset': index_offset,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': 'Position Z',
|
'label': 'Position Z',
|
||||||
'function': 'posz',
|
'function': 'posz',
|
||||||
'name': standard_params['position'][2],
|
'name': standard_params['position'][2],
|
||||||
'advanced': True,
|
'advanced': True,
|
||||||
|
'index-offset': index_offset,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
if 'extra' in per_item_params:
|
if 'extra' in per_item_params:
|
||||||
for extra_param in per_item_params['extra']:
|
for extra_param in per_item_params['extra']:
|
||||||
params.append({k.replace('_','-'): v for k, v in extra_param.items()})
|
params.append({k.replace('_','-'): v for k, v in extra_param.items()})
|
||||||
actuator['per-item-parameters'] = params
|
actuator['per-item-parameters'] = params
|
||||||
|
if 'item_label_prefix' in actuator_conf:
|
||||||
|
actuator['item-label-prefix'] = actuator_conf['item_label_prefix']
|
||||||
else: # fixed size
|
else: # fixed size
|
||||||
labels = []
|
labels = []
|
||||||
pos_x = []
|
pos_x = []
|
||||||
|
|||||||
@@ -539,6 +539,13 @@ mixer:
|
|||||||
oneof:
|
oneof:
|
||||||
- type: string
|
- type: string
|
||||||
- type: integer
|
- type: integer
|
||||||
|
item_label_prefix:
|
||||||
|
# optional per-item label prefix list or (indexed) string
|
||||||
|
oneof:
|
||||||
|
- type: list
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- type: string
|
||||||
parameters:
|
parameters:
|
||||||
type: list
|
type: list
|
||||||
minlength: 1
|
minlength: 1
|
||||||
@@ -556,6 +563,8 @@ mixer:
|
|||||||
schema:
|
schema:
|
||||||
# position param names
|
# position param names
|
||||||
type: string
|
type: string
|
||||||
|
index_offset:
|
||||||
|
type: integer
|
||||||
extra:
|
extra:
|
||||||
type: list
|
type: list
|
||||||
schema: *mixer_parameter
|
schema: *mixer_parameter
|
||||||
|
|||||||
Reference in New Issue
Block a user