From 855eb42c59ef39f307b00b69cc628203f0150c4f Mon Sep 17 00:00:00 2001 From: Junwoo Hwang Date: Fri, 20 May 2022 13:10:42 +0200 Subject: [PATCH] Rename param and paramgroups to airframe and airframegroups The srcparser.py is specific to each use case (e.g. Airframes, Parameters, px4events, etc as in Tool/* folders). Therefore it is confusing to have the px_process_airframes.py script handle concept of airframes under the generic name 'params'. This improves readability and sets the baseground for implementing more specific vehicle type supports, as mentioned in https://github.com/PX4/PX4-user_guide/pull/1858#discussion_r876554728 --- Tools/px4airframes/markdownout.py | 41 ++++---- Tools/px4airframes/rcout.py | 23 +++-- Tools/px4airframes/srcparser.py | 159 +++++++++++++++--------------- Tools/px4airframes/xmlout.py | 24 ++--- Tools/px_process_airframes.py | 19 ++-- 5 files changed, 136 insertions(+), 130 deletions(-) diff --git a/Tools/px4airframes/markdownout.py b/Tools/px4airframes/markdownout.py index d39bd4d3fb..e6b69ce31a 100644 --- a/Tools/px4airframes/markdownout.py +++ b/Tools/px4airframes/markdownout.py @@ -51,9 +51,9 @@ div.frame_variant td, div.frame_variant th { text-align : left; } \n\n""" - + type_set = set() - + if len(image_path) > 0 and image_path[-1] != '/': image_path = image_path + '/' @@ -62,7 +62,7 @@ div.frame_variant td, div.frame_variant th { result += '## %s\n\n' % group.GetClass() type_set.add(group.GetClass()) - result += '### %s\n\n' % group.GetName() + result += '### %s\n\n' % group.GetType() # Display an image of the frame image_name = group.GetImageName() @@ -73,11 +73,11 @@ div.frame_variant td, div.frame_variant th { # check if all outputs are equal for the group: if so, show them # only once all_outputs = {} - num_configs = len(group.GetParams()) - for param in group.GetParams(): - if not self.IsExcluded(param, board): - for output_name in param.GetOutputCodes(): - value = param.GetOutputValue(output_name) + num_configs = len(group.GetAirframes()) + for airframe in group.GetAirframes(): + if not self.IsExcluded(airframe, board): + for output_name in airframe.GetOutputCodes(): + value = airframe.GetOutputValue(output_name) key_value_pair = (output_name, value) if key_value_pair not in all_outputs: all_outputs[key_value_pair] = 0 @@ -104,18 +104,17 @@ div.frame_variant td, div.frame_variant th { result += ' \n' result += '\n' - for param in group.GetParams(): - if not self.IsExcluded(param, board): - #print("generating: {0} {1}".format(param.GetName(), excluded)) - name = param.GetName() - airframe_id = param.GetId() + for airframe in group.GetAirframes(): + if not self.IsExcluded(airframe, board): + name = airframe.GetName() + airframe_id = airframe.GetId() airframe_id_entry = '

SYS_AUTOSTART = %s

' % (airframe_id) - maintainer = param.GetMaintainer() + maintainer = airframe.GetMaintainer() maintainer_entry = '' if maintainer != '': maintainer_entry = 'Maintainer: %s' % (html.escape(maintainer)) - url = param.GetFieldValue('url') - name_anchor='%s_%s_%s' % (group.GetClass(),group.GetName(),name) + url = airframe.GetFieldValue('url') + name_anchor='%s_%s_%s' % (group.GetClass(),group.GetType(),name) name_anchor=name_anchor.replace(' ','_').lower() name_anchor=name_anchor.replace('"','_').lower() name_anchor='id="%s"' % name_anchor @@ -124,8 +123,8 @@ div.frame_variant td, div.frame_variant th { name_entry = '%s' % (url, name) outputs = '