Esempio n. 1
0
def onConnect(request, action):
    ## \brief Launch robot search and connection
    # \param client request
    # \param action
    Log("INFO", "Connecting robots")
    loadMsgHandlers(RosConfigurator.systemTopics(True))
    request.send_response(200)
    request.end_headers()
    request.wfile.write("")
Esempio n. 2
0
def onConnect(request, action):
    ''' This resets firos into its original state

        TODO DL reset, instead of connect?
        TODO DL Add real connect for only one Robot?
    '''
    Log("INFO", "Connecting topics")
    loadMsgHandlers(RosConfigurator.systemTopics(True))

    # Return Success
    end_request(request, None, 200, "")
def onRcmEvent(data, args=None):
    ## \brief Callback to handle ROS published data and send it to Context Broker
    # \param data
    # \param extra arguments

    msg = CB_Event()
    msg.entity_name = data.instance_name

    # DISCONNECTION
    if data.instance_status == 0:
        robot_data = std_msgs.msg.String()
        robot_data.data = data.instance_name
        robotDisconnection(robot_data)
        msg.entity_status = 0
        cb_publisher.publish(msg)

    # CONNECTION
    elif data.instance_status == 1:
        robot_data = getRobotTopics(data.instance_name)
        loadMsgHandlers(robot_data)
        msg.entity_status = 1
        cb_publisher.publish(msg)
Esempio n. 4
0
        server = FirosServer("0.0.0.0", port)
    except Exception as ex:
        sys.stderr.write('CB_COMMUNICATION_FAILED')
        exit(1)
    else:

        def signal_handler(signal, frame):
            Log("INFO", ('\nExiting from the application'))
            TopicHandler.unregisterAll()
            topicManager.removeListeners()
            server.close()
            Log("INFO", ('\nExit'))
            sys.exit(0)

        signal.signal(signal.SIGINT, signal_handler)
        signal.signal(signal.SIGTERM, signal_handler)

        launchSetup()

        Log("INFO", "\nStarting Firos...")
        Log("INFO", "---------------------------------\n")

        loadMsgHandlers(confManager.getRobots(True, True))
        connectionListeners()
        topicManager.setListeners()

        MapServer.load()

        Log("INFO", "\nPress Ctrl+C to Exit\n")
        server.start()
Esempio n. 5
0
    try:
        server = FirosServer("0.0.0.0", port)
    except Exception as ex:
        sys.stderr.write('CB_COMMUNICATION_FAILED')
        exit(1)
    else:
        def signal_handler(signal, frame):
            Log("INFO", ('\nExiting from the application'))
            TopicHandler.unregisterAll()
            topicManager.removeListeners()
            server.close()
            Log("INFO", ('\nExit'))
            sys.exit(0)
        signal.signal(signal.SIGINT, signal_handler)
        signal.signal(signal.SIGTERM, signal_handler)

        launchSetup()

        Log("INFO", "\nStarting Firos...")
        Log("INFO", "---------------------------------\n")

        loadMsgHandlers(confManager.getRobots(True, True))
        connectionListeners()
        topicManager.setListeners()

        MapServer.load()

        Log("INFO", "\nPress Ctrl+C to Exit\n")
        server.start()