mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
9885cc7ed1
I've refactored the param_parse tool to use various 'emitters'. An emitter can take parameter info and output it in a particular format. Currently the only supported emitters are the wiki and XML formats. The goal of these changes is to create a standard machine readable description of parameters - mainly for use by ground control stations, but it will also enable spiffy scripting environments where code can refer symbolically to vehicle parameters (reflectionish). Open issue: Is there any sort of Ardupilot build id which can be included in the generated XML? That would ensure that we select the correct paramdefs for the load on the target (possibly by asking the target for a SHA or somesuch). If that issue is resolved, then the filename for the XML file should probably be something like: arduplane-ca5742ac.pdef.xml. It is worth noting that I've proposed a suffix of ".pdef.xml" for these file types. This facilitates automated file handling on Android devices. On Android you can register 'handlers' for particular file extensions and if the user tries to open that extension in email or a web browser your app will be given a chance to do something about it. The 'outer' xml extension will allow naive editors to know that at least this is an xml file. I will include a sample of the XML format with the pull-request for this CL.
20 lines
285 B
Python
20 lines
285 B
Python
#!/usr/bin/env python
|
|
|
|
import re
|
|
from param import *
|
|
|
|
# The standard interface emitters must implement
|
|
class Emit:
|
|
prog_values_field = re.compile(r"\s*(-?\w+:\w+)+,*")
|
|
|
|
def close(self):
|
|
pass
|
|
|
|
def start_libraries(self):
|
|
pass
|
|
|
|
def emit(self, g, f):
|
|
pass
|
|
|
|
|