Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 PKG = 'robot_monitor'
00040 
00041 import roslib
00042 roslib.load_manifest('robot_monitor')
00043 
00044 import rospy
00045 
00046 WXVER = '2.8'
00047 import wxversion
00048 if wxversion.checkInstalled(WXVER):
00049   wxversion.select(WXVER)
00050 else:
00051   print >> sys.stderr, "This application requires wxPython version %s"%(WXVER)
00052   sys.exit(1)
00053 
00054 from robot_monitor.robot_monitor_panel import RobotMonitorPanel
00055 import wx
00056 
00057 
00058 
00059 class RobotMonitorFrame(wx.Frame):
00060     def __init__(self, parent, title):
00061         wx.Frame.__init__(self, parent, wx.ID_ANY, title)
00062 
00063         self._sizer = wx.BoxSizer(wx.VERTICAL)
00064         self._panel = RobotMonitorPanel(self)
00065         self._sizer.Add(self._panel, 1, wx.EXPAND)
00066         self.SetSizer(self._sizer)
00067         
00068         self._shutdown_timer = wx.Timer()
00069         self._shutdown_timer.Bind(wx.EVT_TIMER, self._on_shutdown_timer)
00070         self._shutdown_timer.Start(100)
00071         
00072     def _on_shutdown_timer(self, event):
00073         if (rospy.is_shutdown()):
00074             self.Close()
00075 
00076 
00077 class RobotMonitorApp(wx.App):
00078     def OnInit(self):
00079         rospy.init_node('robot_monitor', anonymous=True)
00080 
00081         wx.MessageBox("robot_monitor.py is deprecated, please use robot_monitor instead", "Deprecated", wx.OK|wx.ICON_WARNING)
00082         
00083         self._frame = RobotMonitorFrame(None, 'Robot Monitor')
00084         self._frame.SetSize(wx.Size(500, 700))
00085         self._frame.Layout()
00086         self._frame.Show(True)
00087         return True
00088         
00089         
00090 if __name__ == '__main__':
00091     try:
00092         app = RobotMonitorApp()
00093         app.MainLoop()
00094     except KeyboardInterrupt, e:
00095         pass
00096     except rospy.exceptions.ROSInitException, e:
00097         print 'Failed to initialize node, master probably isn\'t up.'
00098     except Exception, e:
00099         import traceback
00100         traceback.print_exc()
00101