4 extract mavlink mission from log 6 from __future__
import print_function
8 from argparse
import ArgumentParser
9 parser = ArgumentParser(description=__doc__)
10 parser.add_argument(
"--output", default=
'mission.txt', help=
"output file")
11 parser.add_argument(
"logs", metavar=
"LOG", nargs=
"+")
13 args = parser.parse_args()
15 from pymavlink
import mavutil, mavwp
20 '''extract mavlink mission''' 21 mlog = mavutil.mavlink_connection(filename)
26 m = mlog.recv_match(type=[
'MISSION_ITEM',
'CMD',
'WAYPOINT'])
29 if m.get_type() ==
'CMD':
30 m = mavutil.mavlink.MAVLink_mission_item_message(0,
33 mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT,
36 m.Prm1, m.Prm2, m.Prm3, m.Prm4,
41 while m.seq > wp.count():
42 print(
"Adding dummy WP %u" % wp.count())
46 print(
"Saved %u waypoints to %s" % (wp.count(), args.output))
50 for filename
in args.logs: