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 PKG = 'qualification'
00039 import roslib
00040 roslib.load_manifest(PKG)
00041
00042 from roslaunch_caller import roslaunch_caller
00043
00044 import wx
00045 import sys, os
00046 import rospy
00047 import traceback
00048
00049
00050 class QualificationApp(wx.App):
00051 def OnInit(self):
00052 try:
00053 self._core_launcher = roslaunch_caller.launch_core()
00054 except Exception, e:
00055 print >> sys.stderr, 'Failed to launch core. Another core may already be running.\n\n'
00056 wx.MessageBox('A ROS core is still running and preventing the qualification system from starting. Shut down ROS processes by using the "Kill ROS" icon.','ROS Already Running', wx.OK|wx.ICON_ERROR, None)
00057 traceback.print_exc()
00058 sys.exit(1)
00059
00060
00061 from qualification.result_dir import check_qual_result_dir, check_qual_temp_dir
00062 if not check_qual_temp_dir():
00063 wx.MessageBox("Unable to write to the temporary results directory. This will cause weird problems. Open a terminal and type, \"sudo rm /tmp/* -rf\" to remove the offending directory. You will have to restart the qualification system.",
00064 "Unable to Write Results", wx.OK|wx.ICON_ERROR, None)
00065 sys.exit(1)
00066
00067 if not check_qual_result_dir():
00068 wx.MessageBox("Unable to write to the \"~/wg_hardware_test/qualification\" directory. Open a terminal and type, \"sudo chmod +rwx -R ~/wg_hardware_test/qualification\" to fix the offending directory. You will have to restart the qualification system.",
00069 "Unable to Write Results", wx.OK|wx.ICON_ERROR, None)
00070 sys.exit(1)
00071
00072
00073 rospy.init_node("qualification")
00074
00075 img_path = os.path.join(roslib.packages.get_pkg_dir(PKG), 'xrc', 'splash.jpg')
00076
00077 bitmap = wx.Bitmap(img_path, type=wx.BITMAP_TYPE_JPEG)
00078 self._splash = wx.SplashScreen(bitmap, wx.SPLASH_CENTRE_ON_SCREEN, 30000, None, -1)
00079
00080 import qualification.component_qual
00081
00082 qual_options = qualification.component_qual.ComponentQualOptions()
00083 if len(sys.argv) > 1 and sys.argv[1] == '--debug':
00084 qual_options.debug = True
00085
00086 self._frame = qualification.component_qual.ComponentQualFrame(None, qual_options)
00087 self._frame.SetSize(wx.Size(700,1000))
00088 self._frame.Layout()
00089 self._frame.Centre()
00090
00091 self._splash.Destroy()
00092 self._splash = None
00093
00094 self._frame.Show(True)
00095
00096 return True
00097
00098 def OnExit(self):
00099 self._core_launcher.stop()
00100
00101 if self._splash:
00102 self._splash.Destroy()
00103
00104 if __name__ == '__main__':
00105 os.environ['ROSLAUNCH_SSH_UNKNOWN'] = '1'
00106 try:
00107 app = QualificationApp()
00108 app.MainLoop()
00109 except Exception, e:
00110 print >> sys.stderr, "Caught exception in Qualification App Main Loop"
00111 import traceback
00112 traceback.print_exc()