tools/mavgen.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 '''
4 parse a MAVLink protocol XML file and generate a python implementation
5 
6 Copyright Andrew Tridgell 2011
7 Released under GNU GPL version 3 or later
8 
9 '''
10 
11 # allow running mavgen from within the tree without installing
12 if __name__ == "__main__" and __package__ is None:
13  from os import sys, path
14  sys.path.insert(0, path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))
15 
16 from pymavlink.generator import mavgen
17 from pymavlink.generator import mavparse
18 
19 from argparse import ArgumentParser
20 
21 parser = ArgumentParser(description="This tool generate implementations from MAVLink message definitions")
22 parser.add_argument("-o", "--output", default="mavlink", help="output directory.")
23 parser.add_argument("--lang", dest="language", choices=mavgen.supportedLanguages, default=mavgen.DEFAULT_LANGUAGE, help="language of generated code [default: %(default)s]")
24 parser.add_argument("--wire-protocol", choices=[mavparse.PROTOCOL_0_9, mavparse.PROTOCOL_1_0, mavparse.PROTOCOL_2_0], default=mavgen.DEFAULT_WIRE_PROTOCOL, help="MAVLink protocol version. [default: %(default)s]")
25 parser.add_argument("--no-validate", action="store_false", dest="validate", default=mavgen.DEFAULT_VALIDATE, help="Do not perform XML validation. Can speed up code generation if XML files are known to be correct.")
26 parser.add_argument("--error-limit", default=mavgen.DEFAULT_ERROR_LIMIT, help="maximum number of validation errors to display")
27 parser.add_argument("--strict-units", action="store_true", dest="strict_units", default=mavgen.DEFAULT_STRICT_UNITS, help="Perform validation of units attributes.")
28 parser.add_argument("definitions", metavar="XML", nargs="+", help="MAVLink definitions")
29 args = parser.parse_args()
30 
31 mavgen.mavgen(args, args.definitions)


mavlink
Author(s): Lorenz Meier
autogenerated on Sun Jul 7 2019 03:22:06