paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [6086] Add radio loss watch script


From: Allen Ibara
Subject: [paparazzi-commits] [6086] Add radio loss watch script
Date: Wed, 06 Oct 2010 05:10:52 +0000

Revision: 6086
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=6086
Author:   aibara
Date:     2010-10-06 05:10:52 +0000 (Wed, 06 Oct 2010)
Log Message:
-----------
Add radio loss watch script

Added Paths:
-----------
    paparazzi3/trunk/sw/ground_segment/python/dashboard/crossing.wav
    paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatch.py
    paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatchframe.py

Added: paparazzi3/trunk/sw/ground_segment/python/dashboard/crossing.wav
===================================================================
(Binary files differ)


Property changes on: 
paparazzi3/trunk/sw/ground_segment/python/dashboard/crossing.wav
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatch.py
===================================================================
--- paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatch.py           
                (rev 0)
+++ paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatch.py   
2010-10-06 05:10:52 UTC (rev 6086)
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import wx
+import getopt
+import sys
+import radiowatchframe
+
+class RadioWatchApp(wx.App):
+    def OnInit(self):
+        self.main = radiowatchframe.RadioWatchFrame()
+        self.main.Show()
+        self.SetTopWindow(self.main)
+        return True
+
+def main():
+    application = RadioWatchApp(0)
+    application.MainLoop()
+
+if __name__ == '__main__':
+    main()


Property changes on: 
paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatch.py
___________________________________________________________________
Added: svn:executable
   + *

Added: paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatchframe.py
===================================================================
--- paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatchframe.py      
                        (rev 0)
+++ paparazzi3/trunk/sw/ground_segment/python/dashboard/radiowatchframe.py      
2010-10-06 05:10:52 UTC (rev 6086)
@@ -0,0 +1,69 @@
+import wx
+
+import sys
+import os
+import time
+import threading
+import math
+import pynotify
+import pygame.mixer
+
+sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python")
+
+import messages_tool
+
+WIDTH = 80
+HEIGHT = 40
+UPDATE_INTERVAL = 250
+
+class RadioWatchFrame(wx.Frame):
+  def message_recv(self, ac_id, name, values):
+    if name == "BOOZ2_RADIO_CONTROL":
+      self.rc_status = int(values[6])
+    if self.rc_status != 0 and not self.alertChannel.get_busy():
+      self.warn_timer = wx.CallLater(5, self.rclink_alert)
+    #else:
+      #self.notification.close()
+
+  def gui_update(self):
+    self.rc_statusText.SetLabel(["OK", "LOST", "REALLY LOST"][self.rc_status])
+    self.update_timer.Restart(UPDATE_INTERVAL)
+
+  def rclink_alert(self):
+    self.alertChannel.queue(self.alertSound)
+    self.notification.show()
+
+  def setFont(self, control):
+    font = control.GetFont()
+    size = font.GetPointSize()
+    font.SetPointSize(size * 1.4)
+    control.SetFont(font)
+
+  def __init__(self):
+    wx.Frame.__init__(self, id=-1, parent=None, name=u'RCWatchFrame',
+      size=wx.Size(WIDTH, HEIGHT), title=u'RC Status')
+    self.aircrafts = {}
+
+    self.rc_statusText = wx.StaticText(self, -1, "UNKWN")
+  
+    pygame.mixer.init()
+    self.alertSound = pygame.mixer.Sound("crossing.wav")
+    self.alertChannel = pygame.mixer.Channel(False)
+
+    self.setFont(self.rc_statusText)
+
+    self.notification = pynotify.Notification("RC Link Warning!",
+      "RC Link status not OK!",
+      "dialog-warning")
+
+    self.rc_status = 0
+    self.armed = True
+
+    pynotify.init("RC Status")
+
+    sizer = wx.BoxSizer(wx.VERTICAL)
+    sizer.Add(self.rc_statusText, 1, wx.EXPAND)
+    self.SetSizer(sizer)
+    sizer.Layout()
+    self.interface = messages_tool.IvyMessagesInterface(self.message_recv)
+    self.update_timer = wx.CallLater(UPDATE_INTERVAL, self.gui_update)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]