def OnInit(self):
     try:
         self._core_launcher = roslaunch_caller.launch_core()
     except Exception, e:
         print >> sys.stderr, 'Failed to launch core. Another core may already be running.\n\n'
         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)
         traceback.print_exc()
         sys.exit(1)
 def OnInit(self):
     try:
         self._core_launcher = roslaunch_caller.launch_core()
     except Exception, e:
         sys.stderr.write(
             'Failed to launch core. Another core may already be running.\n\n'
         )
         traceback.print_exc()
         sys.exit(5)
Beispiel #3
0
 def LaunchCore(self, event):
     print "launching core"
     if self._core_launcher == None:
         self._core_launcher = roslaunch_caller.launch_core()
         self.core_status.SetBackgroundColour("Light Green")
     else:
         self._core_launcher.stop()
         self._core_launcher = None
         self.core_status.SetBackgroundColour("Red")
    def OnInit(self, debug = False):

        args = rospy.myargv()
        debug = len(args) > 1 and args[1] == '--debug'

        try:
          self._core_launcher = roslaunch_caller.launch_core()
        except Exception, e:
            print >> sys.stderr, 'Failed to launch core. Another core may already be running.\n\n'
            wx.MessageBox('A ROS core is still running and preventing the Test Manager system from starting. Shut down ROS processes by using the "Kill ROS" icon.','ROS Already Running', wx.OK|wx.ICON_ERROR, None)
            traceback.print_exc()
            sys.exit(1)
Beispiel #5
0
    def OnInit(self):
        # Launch roscore
        #config = roslaunch.ROSLaunchConfig()
        #config.master.auto = config.master.AUTO_RESTART
        
        self._core_launcher = roslaunch_caller.launch_core()

        rospy.init_node("life_test_manager")
        self._frame = TestManagerFrame(None)
        self._frame.SetSize(wx.Size(1600, 1100))
        self._frame.Layout()
        self._frame.Centre()
        self._frame.Show(True)

        return True
Beispiel #6
0
    def handleROS(self, path, qdict):
        global factory
        global core_launcher
        global tfclient
        global launchers

        path_parts = path.split('/')

        # Get the command
        cmd = path_parts[2].lower()
        topic = '/' + "/".join(path_parts[p]
                               for p in range(3, len(path_parts)))

        if cmd == "startup":
            print "Startup[%s]" % topic

            self.send_response(200)
            self.send_header("Content-type", "text/html")
            self.end_headers()
            self.wfile.write("started")

            robot = commands.getoutput('hostname')

            if rosCoreUp == False:
                core_launcher = roslaunch_caller.launch_core()

                time.sleep(5)

                scriptDir = commands.getoutput(
                    'rospack find webteleop') + '/launch/'
                startupScript = ''

                if robot.startswith('pr'):
                    startupScript = robot + ".launch"
                else:
                    startupScript = 'gazebo.launch'

                launch = launchScript(scriptDir + startupScript)
                launchers[startupScript] = launch
                time.sleep(20)

                #launch = launchScript(scriptDir + '2dnav_pr2.launch')
                #launchers['2dnav_pr2.launch'] = launch
                #time.sleep(20)

            rospy.init_node(CALLER_ID, disable_signals=True)
            time.sleep(1)

            if tfclient == None:
                tfclient = TransformListener()

        elif cmd == "shutdown":
            print "Shutdown[%s]" % topic

            # Stop all the launch scripts
            for key in launchers:
                if launchers[key] != None:
                    launchers[key].shutdown()
                    launchers[key] = None
                    time.sleep(10)

            launchers = {}

            # Stop the core
            if core_launcher != None:
                core_launcher.stop()

            core_launcher = None

            self.send_response(200)
            self.send_header("Content-type", "text/html")
            self.end_headers()
            self.wfile.write("shutdown")

        elif cmd == "launch":
            print "Launch[%s]" % topic

            script = commands.getoutput(
                'rospack find webteleop') + '/launch' + topic
            launch = launchScript(script)

            launchers[topic] = launch
            if launchers.has_key(topic):
                print "HAS KEY!!!!"

            self.send_response(200)
            self.send_header("Content-type", "text/html")
            self.end_headers()
            self.wfile.write("launched")

        elif cmd == "stop":
            print "\n\n\n\n\nStop[%s]" % topic

            if launchers.has_key(topic):
                launchers[topic].shutdown()
                time.sleep(10)
                launchers[topic] = None
            else:
                print "\n\n\n\n\nDOESNT HAVE KEY"

            self.send_response(200)
            self.send_header("Content-type", "text/html")
            self.end_headers()
            self.wfile.write("stopped")

        elif cmd == "subscribe":
            print "Subscribe[%s]\n" % topic

            rwt = factory.get(topic, qdict)

            try:
                rwt.init("subscriber")
            except WebException, e:
                traceback.print_exc()
                self.send_response(404)
                return

            self.send_response(200)
            self.send_header("Content-type", "text/html")
            self.end_headers()
            self.wfile.write("subscribed")