Example #1
0
    def __init__(self, filename):
        self.root = Tkinter.Tk()

        self.filesize = os.path.getsize(filename)
        self.filepos = 0.0

        self.mlog = mavutil.mavlink_connection(filename, planner_format=opts.planner,
                                               robust_parsing=True)
        self.mout = []
        for m in opts.out:
            self.mout.append(mavutil.mavudp(m, input=False))

        self.fgout = []
        for f in opts.fgout:
            self.fgout.append(mavutil.mavudp(f, input=False))
    
        self.fdm = fgFDM.fgFDM()

        self.msg = self.mlog.recv_match(condition=opts.condition)
        if self.msg is None:
            sys.exit(1)
        self.last_timestamp = getattr(self.msg, '_timestamp')

        self.paused = False

        self.topframe = Tkinter.Frame(self.root)
        self.topframe.pack(side=Tkinter.TOP)

        self.frame = Tkinter.Frame(self.root)
        self.frame.pack(side=Tkinter.LEFT)

        self.slider = Tkinter.Scale(self.topframe, from_=0, to=1.0, resolution=0.01,
                                    orient=Tkinter.HORIZONTAL, command=self.slew)
        self.slider.pack(side=Tkinter.LEFT)

        self.clock = Tkinter.Label(self.topframe,text="")
        self.clock.pack(side=Tkinter.RIGHT)

        self.playback = Tkinter.Spinbox(self.topframe, from_=0, to=20, increment=0.1, width=3)
        self.playback.pack(side=Tkinter.BOTTOM)
        self.playback.delete(0, "end")
        self.playback.insert(0, 1)

        self.buttons = {}
        self.button('quit', 'gtk-quit.gif', self.frame.quit)
        self.button('pause', 'media-playback-pause.gif', self.pause)
        self.button('rewind', 'media-seek-backward.gif', self.rewind)
        self.button('forward', 'media-seek-forward.gif', self.forward)
        self.button('status', 'Status', self.status)
        self.flightmode = Tkinter.Label(self.frame,text="")
        self.flightmode.pack(side=Tkinter.RIGHT)

        self.next_message()
        self.root.mainloop()
Example #2
0
    def listen_udp(self):
	print "listening udp!"
	# for now, we'll just accept a UDP stream: 
	self.m = mavutil.mavudp('localhost:6666', input=True);
	self.m.close() # don't listen for stuff yourself, but we'll pass it in later from Qt
	#self.m.mav.set_callback(master_callback, self.m)
	self.m.linknum = 1
	self.m.linkerror = False
	self.m.link_delayed = False
	self.m.last_heartbeat = 0
	self.m.highest_usec = 0

	# Qt method: 
	self.udpSocket = QtNetwork.QUdpSocket(self)
	self.udpSocket.bind(QtNetwork.QHostAddress(QtNetwork.QHostAddress.Any),6678); 
	self.connect(self.udpSocket, QtCore.SIGNAL("readyRead()"),self.read_all_q)
Example #3
0
if opts.mav10:
    os.environ['MAVLINK10'] = '1'
import mavutil

if len(args) < 1:
    parser.print_help()
    sys.exit(1)

filename = args[0]
mlog = mavutil.mavlink_connection(filename, planner_format=opts.planner,
                                  robust_parsing=opts.robust)

mout = []
for m in opts.out:
    mout.append(mavutil.mavudp(m, input=False))

fgout = []
for f in opts.fgout:
    fgout.append(mavutil.mavudp(f, input=False))
    

fdm = fgFDM.fgFDM()

playpack_speed = 1.0
last_timestamp = None

while True:
    msg = mlog.recv_match(condition=opts.condition)
    if msg is None:
        break