Exemplo n.º 1
0
def abort_current_task():
    print_it('start_complete_demo: abort_current_task')
    global __aborting_task
    global subproc
    global __clock_subscriber
    global __quit
    if __quit:
        print_it('Already quitting. Nothing to do here.')
    elif __aborting_task:
        print_it('Already aborting task. Nothing to do here.')
    else:
        __aborting_task = True
        if __clock_subscriber is not None:
            print_it('Unsubscribing clock subscriber.')
            __clock_subscriber.unregister()
        if subproc is not None:
            try:
                print_it('Killing subproc with pid ' + str(subproc.pid))
                exterminate(subproc.pid, signal.SIGINT)
                print_it(
                    'Waiting for subproc to terminate. Please be patient.')
                utils.wait_for_process(subproc, 90)
                poll = subproc.poll()
                if poll is None:
                    print_it('Could not kill task process. Forcing!'
                             ' (pid: ' + str(subproc.pid) +
                             ', subproc.poll(): ' + str(poll) + ')')
                    exterminate(subproc.pid, signal.SIGKILL, r=True)
            except Exception, e:
                print_it(e)
        __aborting_task = False
Exemplo n.º 2
0
def abort_current_task():
    print_it('start_complete_demo: abort_current_task')
    global __aborting_task
    global subproc
    global __clock_subscriber
    global __quit
    if __quit:
        print_it('Already quitting. Nothing to do here.')
    elif __aborting_task:
        print_it('Already aborting task. Nothing to do here.')
    else:
        __aborting_task = True
        if __clock_subscriber is not None:
            print_it('Unsubscribing clock subscriber.')
            __clock_subscriber.unregister()
        if subproc is not None:
            try:
                print_it('Killing subproc with pid ' + str(subproc.pid))
                exterminate(subproc.pid, signal.SIGINT)
                print_it('Waiting for subproc to terminate. Please be patient.')
                utils.wait_for_process(subproc, 90)
                poll = subproc.poll()
                if poll is None:
                    print_it('Could not kill task process. Forcing!'
                          ' (pid: ' + str(subproc.pid) + ', subproc.poll(): ' + str(poll) + ')')
                    exterminate(subproc.pid, signal.SIGKILL, r=True)
            except Exception, e:
                print_it(e)
        __aborting_task = False
Exemplo n.º 3
0
def check_node(initialization_time, logging):
    global executed_test_node_check
    rospy.loginfo('Executing TestNode check.')
    rospy.loginfo('rospy.is_shutdown(): ' + str(rospy.is_shutdown()))
    test_node, test_node_logger = utils.start_node('rosrun euroc_launch TestNode --check', initialization_time,
                                                   logging, 'TestNode check')
    if not utils.wait_for_process(test_node, 15):
        rospy.loginfo('Killing TestNode check.')
        exterminate(test_node.pid, signal.SIGKILL)
    executed_test_node_check = True
    rospy.loginfo('Finished TestNode check.')
Exemplo n.º 4
0
def check_node(initialization_time, logging):
    global executed_test_node_check
    rospy.loginfo('Executing TestNode check.')
    rospy.loginfo('rospy.is_shutdown(): ' + str(rospy.is_shutdown()))
    test_node, test_node_logger = utils.start_node(
        'rosrun euroc_launch TestNode --check', initialization_time, logging,
        'TestNode check')
    if not utils.wait_for_process(test_node, 15):
        rospy.loginfo('Killing TestNode check.')
        exterminate(test_node.pid, signal.SIGKILL)
    executed_test_node_check = True
    rospy.loginfo('Finished TestNode check.')
Exemplo n.º 5
0
def exit_handler(signum=None, frame=None):
    print('start_nodes: exit_handler')
    global __handling_exit
    if __handling_exit:
        print('start_nodes: Already handling exit.')
        return
    __handling_exit = True
    global manipulation_process
    if manipulation_process is not None:
        print 'Killing manipulation'
        exterminate(manipulation_process.pid, signal.SIGKILL, r=True)
    global manipulation_conveyor_frames_process
    if manipulation_conveyor_frames_process is not None:
        print('Killing manipulation_conveyor_frames_process.')
        exterminate(manipulation_conveyor_frames_process.pid,
                    signal.SIGKILL,
                    r=True)
    global perception_process
    if perception_process is not None:
        print 'Killing perception'
        exterminate(perception_process.pid, signal.SIGKILL, r=True)
    global classifier_process
    if classifier_process is not None:
        print 'Killing classifier'
        exterminate(classifier_process.pid, signal.SIGKILL, r=True)
    time.sleep(3)
    rospy.signal_shutdown('Finished handling exit. Shutting down Node.')
    print('start_nodes: Exiting exit_handler')
Exemplo n.º 6
0
def exit_handler(signum=None, frame=None):
    print('start_nodes: exit_handler')
    global __handling_exit
    if __handling_exit:
        print('start_nodes: Already handling exit.')
        return
    __handling_exit = True
    global manipulation_process
    if manipulation_process is not None:
        print 'Killing manipulation'
        exterminate(manipulation_process.pid, signal.SIGKILL, r=True)
    global manipulation_conveyor_frames_process
    if manipulation_conveyor_frames_process is not None:
        print('Killing manipulation_conveyor_frames_process.')
        exterminate(manipulation_conveyor_frames_process.pid, signal.SIGKILL, r=True)
    global perception_process
    if perception_process is not None:
        print 'Killing perception'
        exterminate(perception_process.pid, signal.SIGKILL, r=True)
    global classifier_process
    if classifier_process is not None:
        print 'Killing classifier'
        exterminate(classifier_process.pid, signal.SIGKILL, r=True)
    time.sleep(3)
    rospy.signal_shutdown('Finished handling exit. Shutting down Node.')
    print('start_nodes: Exiting exit_handler')
Exemplo n.º 7
0
def exit_handler(signum=None, frame=None):
    print('start_task: exit_handler')
    print('start_task: signum: ' + str(signum) + ', frame: ' + str(frame))
    global __handling_exit
    global _save_log
    print 'rospy.is_shutdown() = ' + str(rospy.is_shutdown())
    if __handling_exit:
        print('start_task: Already handling exit.')
        return
    __handling_exit = True
    print('start_task: Checking for task selector.')
    global _pro_task_selector
    if _pro_task_selector is not None:
        print 'Stopping TaskSelector'
        print 'Stopping gazebo'
        exterminate(_pro_task_selector.pid, signal.SIGINT)
    #print('Exiting moveit_commander.')
    #moveit_commander.os._exit(0)
    print('start_task: Exiting exit_handler')
Exemplo n.º 8
0
def exit_handler(signum=None, frame=None):
    print('start_task: exit_handler')
    print('start_task: signum: ' + str(signum) + ', frame: ' + str(frame))
    global __handling_exit
    global _save_log
    print 'rospy.is_shutdown() = ' + str(rospy.is_shutdown())
    if __handling_exit:
        print('start_task: Already handling exit.')
        return
    __handling_exit = True
    print('start_task: Checking for task selector.')
    global _pro_task_selector
    if _pro_task_selector is not None:
        print 'Stopping TaskSelector'
        print 'Stopping gazebo'
        exterminate(_pro_task_selector.pid, signal.SIGINT)
    #print('Exiting moveit_commander.')
    #moveit_commander.os._exit(0)
    print('start_task: Exiting exit_handler')
Exemplo n.º 9
0
 def execute(self, userdata):
     rospy.loginfo('Executing state StopNodes.')
     if userdata.perception_process is not None:
         exterminate(userdata.perception_process.pid, signal.SIGKILL, r=True)
     if userdata.manipulation_process is not None:
         exterminate(userdata.manipulation_process.pid, signal.SIGKILL, r=True)
     if userdata.manipulation_conveyor_frames_process is not None:
         exterminate(userdata.manipulation_conveyor_frames_process.pid, signal.SIGKILL, r=True)
     if userdata.classifier_process is not None:
         exterminate(userdata.classifier_process.pid, signal.SIGKILL, r=True)
     rospy.signal_shutdown('Finished plan. Shutting down Node.')
     time.sleep(3)
     rospy.loginfo('Finished state StopNodes.')
     return 'success'
Exemplo n.º 10
0
 def stop_nodes(self, req):
     resp = TaskDataServiceResponse()
     resp.taskdata = req.taskdata
     rospy.loginfo('Executing state StopNodes.')
     if perception_process is not None:
         exterminate(perception_process.pid, signal.SIGKILL, r=True)
     if manipulation_process is not None:
         exterminate(manipulation_process.pid, signal.SIGKILL, r=True)
     if manipulation_conveyor_frames_process is not None:
         exterminate(manipulation_conveyor_frames_process.pid, signal.SIGKILL, r=True)
     if classifier_process is not None:
         exterminate(classifier_process.pid, signal.SIGKILL, r=True)
     rospy.signal_shutdown('Finished plan. Shutting down Node.')
     time.sleep(3)
     rospy.loginfo('Finished state StopNodes.')
     resp.result = 'success'
     return resp
Exemplo n.º 11
0
 def stop_nodes(self, req):
     resp = TaskDataServiceResponse()
     resp.taskdata = req.taskdata
     rospy.loginfo('Executing state StopNodes.')
     if perception_process is not None:
         exterminate(perception_process.pid, signal.SIGKILL, r=True)
     if manipulation_process is not None:
         exterminate(manipulation_process.pid, signal.SIGKILL, r=True)
     if manipulation_conveyor_frames_process is not None:
         exterminate(manipulation_conveyor_frames_process.pid,
                     signal.SIGKILL,
                     r=True)
     if classifier_process is not None:
         exterminate(classifier_process.pid, signal.SIGKILL, r=True)
     rospy.signal_shutdown('Finished plan. Shutting down Node.')
     time.sleep(3)
     rospy.loginfo('Finished state StopNodes.')
     resp.result = 'success'
     return resp
Exemplo n.º 12
0
 def execute(self, userdata):
     rospy.loginfo('Executing state StopNodes.')
     if userdata.perception_process is not None:
         exterminate(userdata.perception_process.pid,
                     signal.SIGKILL,
                     r=True)
     if userdata.manipulation_process is not None:
         exterminate(userdata.manipulation_process.pid,
                     signal.SIGKILL,
                     r=True)
     if userdata.manipulation_conveyor_frames_process is not None:
         exterminate(userdata.manipulation_conveyor_frames_process.pid,
                     signal.SIGKILL,
                     r=True)
     if userdata.classifier_process is not None:
         exterminate(userdata.classifier_process.pid,
                     signal.SIGKILL,
                     r=True)
     rospy.signal_shutdown('Finished plan. Shutting down Node.')
     time.sleep(3)
     rospy.loginfo('Finished state StopNodes.')
     return 'success'
Exemplo n.º 13
0
def kill_like_a_berserk():
    print_it('start_complete_demo: kill_like_a_berserk')
    global subproc
    print_it('Killing subproc like a berserk.')
    exterminate(subproc.pid, signal.SIGKILL, r=True)
    print_it('start_complete_demo: Exiting kill_like_a_berserk.')
Exemplo n.º 14
0
def kill_like_a_berserk():
    print_it('start_complete_demo: kill_like_a_berserk')
    global subproc
    print_it('Killing subproc like a berserk.')
    exterminate(subproc.pid, signal.SIGKILL, r=True)
    print_it('start_complete_demo: Exiting kill_like_a_berserk.')