Go to the documentation of this file.00001
00002
00003 '''
00004 parse a MAVLink protocol XML file and generate a python implementation
00005
00006 Copyright Andrew Tridgell 2011
00007 Released under GNU GPL version 3 or later
00008
00009 '''
00010
00011
00012 if __name__ == "__main__" and __package__ is None:
00013 from os import sys, path
00014 sys.path.insert(0, path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))
00015
00016 from pymavlink.generator import mavgen
00017 from pymavlink.generator import mavparse
00018
00019 from argparse import ArgumentParser
00020
00021 parser = ArgumentParser(description="This tool generate implementations from MAVLink message definitions")
00022 parser.add_argument("-o", "--output", default="mavlink", help="output directory.")
00023 parser.add_argument("--lang", dest="language", choices=mavgen.supportedLanguages, default=mavgen.DEFAULT_LANGUAGE, help="language of generated code [default: %(default)s]")
00024 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]")
00025 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.")
00026 parser.add_argument("--error-limit", default=mavgen.DEFAULT_ERROR_LIMIT, help="maximum number of validation errors to display")
00027 parser.add_argument("definitions", metavar="XML", nargs="+", help="MAVLink definitions")
00028 args = parser.parse_args()
00029
00030 mavgen.mavgen(args, args.definitions)