Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/autotest/logger_metadata/emit_md.py
Views: 1799
import os1import time2import emitter34class MDEmitter(emitter.Emitter):5def preface(self):6if os.getenv('BRDOC') is not None:7now = time.strftime('%Y-%m-%dT%H:%M:%S%z')8now = now[:-2] + ':' + now[-2:]9return '\n'.join((10'+++',11'title = "Onboard Log Messages"',12'description = "Message listing for DataFlash autopilot logs."',13f'date = {now}',14'template = "docs/page.html"',15'sort_by = "weight"',16'weight = 30',17'draft = false',18'[extra]',19'toc = true',20'top = false',21'+++\n',22'<!-- Dynamically generated using Tools/autotest/logger_metadata/parse.py',23'DO NOT EDIT -->',24'This is a list of log messages which may be present in DataFlash (`.bin`) '25'logs produced and stored onboard ArduSub vehicles (see [Log Parameters]'26'(../parameters/#log-parameters) for creation details). '27'It is possible to [add a new message]'28'(https://ardupilot.org/dev/docs/code-overview-adding-a-new-log-message.html) '29'by modifying the firmware.\n',30'DataFlash logs can be downloaded and analysed '31'[from a computer](http://www.ardusub.com/reference/data-logging.html#downloading) '32'or [through BlueOS]'33'(@/software/onboard/BlueOS-1.1/advanced-usage/index.md#log-browser).\n'34))3536return """<!-- Dynamically generated list of Logger Messages37This page was generated using Tools/autotest/logger_metdata/parse.py3839DO NOT EDIT40-->414243<h3 style="text-align: center">Onboard Message Log Messages</h3>44<hr />4546<p>This is a list of log messages which may be present in logs produced and stored onboard ArduPilot vehicles.</p>4748<!-- add auto-generated table of contents with "Table of Contents Plus" plugin -->49[toc exclude="Onboard Message Log Messages"]5051"""52def postface(self):53return ""5455def start(self):56self.fh = open("LogMessages.md", mode='w')57print(self.preface(), file=self.fh)5859def emit(self, doccos, enumerations=None):60self.start()61for docco in doccos:62print(f'## {docco.name}', file=self.fh)63desc = ''64if docco.description is not None:65desc += docco.description66if docco.url is not None:67desc += f' ([Read more...]({docco.url}))'68print(desc, file=self.fh)69print("\n|FieldName|Units/Type|Description|\n|---|---|---|", file=self.fh)70for f in docco.fields_order:71if "description" in docco.fields[f]:72fdesc = docco.fields[f]["description"]73else:74fdesc = ""75if "units" in docco.fields[f] and docco.fields[f]["units"]!="":76ftypeunits = docco.fields[f]["units"]77elif "fmt" in docco.fields[f] and "char" in docco.fields[f]["fmt"]:78ftypeunits = docco.fields[f]["fmt"]79elif "bitmaskenum" in docco.fields[f]:80ftypeunits = "bitmask"81elif "valueenum" in docco.fields[f]:82ftypeunits = "enum"83else:84ftypeunits = ""85print(f'|{f}|{ftypeunits}|{fdesc}|', file=self.fh)86print("", file=self.fh)87self.stop()8889def stop(self):90print(self.postface(), file=self.fh)91self.fh.close()929394