param_parse.py: emit SIM_ parameters along with everthing else

This commit is contained in:
Peter Barker 2023-01-07 11:59:44 +11:00 committed by Peter Barker
parent bc3b923ff6
commit 8de890bc7d
3 changed files with 7 additions and 28 deletions

View File

@ -6,8 +6,8 @@ import re
class Emit: class Emit:
def __init__(self, sitl=False): def __init__(self):
self.sitl = sitl pass
prog_values_field = re.compile(r"-?\d*\.?\d+: ?[\w ]+,?") prog_values_field = re.compile(r"-?\d*\.?\d+: ?[\w ]+,?")

View File

@ -37,11 +37,6 @@ parser.add_argument("--format",
default='all', default='all',
choices=['all', 'html', 'rst', 'rstlatexpdf', 'wiki', 'xml', 'json', 'edn', 'md', 'xml_mp'], choices=['all', 'html', 'rst', 'rstlatexpdf', 'wiki', 'xml', 'json', 'edn', 'md', 'xml_mp'],
help="what output format to use") help="what output format to use")
parser.add_argument("--sitl",
dest='emit_sitl',
action='store_true',
default=False,
help="true to only emit sitl parameters, false to not emit sitl parameters")
args = parser.parse_args() args = parser.parse_args()
@ -163,8 +158,7 @@ def process_vehicle(vehicle):
libraries.append(lib) libraries.append(lib)
param_matches = [] param_matches = []
if not args.emit_sitl: param_matches = prog_param.findall(p_text)
param_matches = prog_param.findall(p_text)
for param_match in param_matches: for param_match in param_matches:
(only_vehicles, param_name, field_text) = (param_match[0], (only_vehicles, param_name, field_text) = (param_match[0],
@ -213,11 +207,6 @@ process_vehicle(vehicle)
debug("Found %u documented libraries" % len(libraries)) debug("Found %u documented libraries" % len(libraries))
if args.emit_sitl:
libraries = filter(lambda x : x.name == 'SIM_', libraries)
else:
libraries = filter(lambda x : x.name != 'SIM_', libraries)
libraries = list(libraries) libraries = list(libraries)
alllibs = libraries[:] alllibs = libraries[:]
@ -293,7 +282,7 @@ def process_library(vehicle, library, pathprefix=None):
seen_values_or_bitmask_for_other_vehicle = False seen_values_or_bitmask_for_other_vehicle = False
for field in fields: for field in fields:
only_for_vehicles = field[1].split(",") only_for_vehicles = field[1].split(",")
only_for_vehicles = [x.rstrip().lstrip() for x in only_for_vehicles] only_for_vehicles = [some_vehicle.rstrip().lstrip() for some_vehicle in only_for_vehicles]
delta = set(only_for_vehicles) - set(truename_map.values()) delta = set(only_for_vehicles) - set(truename_map.values())
if len(delta): if len(delta):
error("Unknown vehicles (%s)" % delta) error("Unknown vehicles (%s)" % delta)
@ -593,16 +582,11 @@ for emitter_name in all_emitters.keys():
if args.output_format == 'all' or args.output_format == emitter_name: if args.output_format == 'all' or args.output_format == emitter_name:
emitters_to_use.append(emitter_name) emitters_to_use.append(emitter_name)
if args.emit_sitl:
# only generate rst for SITL for now:
emitters_to_use = ['rst']
# actually invoke each emitter: # actually invoke each emitter:
for emitter_name in emitters_to_use: for emitter_name in emitters_to_use:
emit = all_emitters[emitter_name](sitl=args.emit_sitl) emit = all_emitters[emitter_name]()
if not args.emit_sitl: emit.emit(vehicle)
emit.emit(vehicle)
emit.start_libraries() emit.start_libraries()

View File

@ -12,8 +12,6 @@ except Exception:
# Emit docs in a RST format # Emit docs in a RST format
class RSTEmit(Emit): class RSTEmit(Emit):
def blurb(self): def blurb(self):
if self.sitl:
return """SITL parameters"""
return """This is a complete list of the parameters which can be set (e.g. via the MAVLink protocol) to control vehicle behaviour. They are stored in persistent storage on the vehicle. return """This is a complete list of the parameters which can be set (e.g. via the MAVLink protocol) to control vehicle behaviour. They are stored in persistent storage on the vehicle.
This list is automatically generated from the latest ardupilot source code, and so may contain parameters which are not yet in the stable released versions of the code. This list is automatically generated from the latest ardupilot source code, and so may contain parameters which are not yet in the stable released versions of the code.
@ -30,10 +28,7 @@ This list is automatically generated from the latest ardupilot source code, and
self.f = open(self.output_fname(), mode='w') self.f = open(self.output_fname(), mode='w')
self.spacer = re.compile("^", re.MULTILINE) self.spacer = re.compile("^", re.MULTILINE)
self.rstescape = re.compile("([^a-zA-Z0-9\n ])") self.rstescape = re.compile("([^a-zA-Z0-9\n ])")
if self.sitl: parameterlisttype = "Complete Parameter List"
parameterlisttype = "SITL Parameter List"
else:
parameterlisttype = "Complete Parameter List"
parameterlisttype += "\n" + "=" * len(parameterlisttype) parameterlisttype += "\n" + "=" * len(parameterlisttype)
self.preamble = """.. Dynamically generated list of documented parameters self.preamble = """.. Dynamically generated list of documented parameters
.. This page was generated using {toolname} .. This page was generated using {toolname}