Example #1
0
    def terminate(self):
        """ Method should be called to destroy the client and will take
            care of destroying the Environment as well as deleting all
            circular references.
        """
        if self._environment:
            self._environment.remote_destroy()

        assert self._environment is None

        Endpoint.terminate(self)
Example #2
0
    def __init__(self, reactor, commPort):
        """ Initialize the Environment Client.

            @param reactor:     Reference to the twisted reactor used in this
                                robot process.
            @type  reactor:     twisted::reactor

            @param commPort:    Port where the server for the cloud engine
                                internal communication will listen for incoming
                                connections.
            @type  commPort:    int
        """
        Endpoint.__init__(self, reactor, Loader(), commPort)

        self._dbFile = '/opt/rce/data/rosenvbridge.db'  # TODO: Hardcoded?
Example #3
0
    def __init__(self, reactor, commPort):
        """ Initialize the Environment Client.

            @param reactor:     Reference to the twisted reactor used in this
                                robot process.
            @type  reactor:     twisted::reactor

            @param commPort:    Port where the server for the cloud engine
                                internal communication will listen for incoming
                                connections.
            @type  commPort:    int
        """
        Endpoint.__init__(self, reactor, Loader(), commPort)

        self._dbFile = '/opt/rce/data/rosenvbridge.db' # TODO: Hardcoded?
Example #4
0
 def __init__(self, reactor, commPort):
     """ Initialize the Environment Client.
         
         @param reactor:     Reference to the twisted reactor used in this
                             robot process.
         @type  reactor:     twisted::reactor
         
         @param commPort:    Port where the server for the cloud engine
                             internal communication will listen for incoming
                             connections.
         @type  commPort:    int
     """
     Endpoint.__init__(self, reactor, commPort)
     
     self._environment = None
Example #5
0
    def __init__(self, reactor, masterIP, masterPort, commPort, extIP, extPort,
                 loader, converter):
        """ Initialize the Robot Client.

            @param reactor:     Reference to the twisted reactor used in this
                                robot process.
            @type  reactor:     twisted::reactor

            @param masterIP:    IP address of the Master process.
            @type  masterIP:    str

            @param masterPort:  Port which should be used to authenticate the
                                user with the Master process.
            @type  masterPort:  int

            @param commPort:    Port where the server for the cloud engine
                                internal communication is listening for
                                incoming connections.
            @type  commPort:    int

            @param extIP:       IP address of network interface used for the
                                external communication.
            @type  extIP:       str

            @param extPort:     Port where the server for the external
                                communication is listening for WebSocket
                                connections.
            @type  extPort:     int

            @param loader:      Object which is used to load Python modules
                                from ROS packages.
            @type  loader:      rce.util.loader.Loader

            @param converter:   Converter which takes care of converting the
                                messages from JSON to ROS message and vice
                                versa.
            @type  converter:   rce.util.converter.Converter
        """
        Endpoint.__init__(self, reactor, loader, commPort)

        self._masterIP = masterIP
        self._masterPort = masterPort
        self._extAddress = '{0}:{1}'.format(extIP, extPort)
        self._loader = loader
        self._converter = converter

        self._connections = set()
        self._deathCandidates = {}
Example #6
0
    def __init__(self, reactor, masterIP, masterPort, commPort, extIP, extPort,
                 loader, converter):
        """ Initialize the Robot Client.

            @param reactor:     Reference to the twisted reactor used in this
                                robot process.
            @type  reactor:     twisted::reactor

            @param masterIP:    IP address of the Master process.
            @type  masterIP:    str

            @param masterPort:  Port which should be used to authenticate the
                                user with the Master process.
            @type  masterPort:  int

            @param commPort:    Port where the server for the cloud engine
                                internal communication is listening for
                                incoming connections.
            @type  commPort:    int

            @param extIP:       IP address of network interface used for the
                                external communication.
            @type  extIP:       str

            @param extPort:     Port where the server for the external
                                communication is listening for WebSocket
                                connections.
            @type  extPort:     int

            @param loader:      Object which is used to load Python modules
                                from ROS packages.
            @type  loader:      rce.util.loader.Loader

            @param converter:   Converter which takes care of converting the
                                messages from JSON to ROS message and vice
                                versa.
            @type  converter:   rce.util.converter.Converter
        """
        Endpoint.__init__(self, reactor, loader, commPort)

        self._masterIP = masterIP
        self._masterPort = masterPort
        self._extAddress = '{0}:{1}'.format(extIP, extPort)
        self._loader = loader
        self._converter = converter

        self._connections = set()
        self._deathCandidates = {}
Example #7
0
    def terminate(self):
        """ Method should be called to terminate the client before the reactor
            is stopped.

            @return:            Deferred which fires as soon as the client is
                                ready to stop the reactor.
            @rtype:             twisted.internet.defer.Deferred
        """
        for call in self._deathCandidates.itervalues():
            call.cancel()

        self._deathCandidates = {}

        for connection in self._connections.copy():
            connection.destroy()
        assert len(self._connections) == 0

        Endpoint.terminate(self)
Example #8
0
    def terminate(self):
        """ Method should be called to terminate the client before the reactor
            is stopped.

            @return:            Deferred which fires as soon as the client is
                                ready to stop the reactor.
            @rtype:             twisted.internet.defer.Deferred
        """
        for call in self._deathCandidates.itervalues():
            call.cancel()

        self._deathCandidates = {}

        for connection in self._connections.copy():
            connection.destroy()
        assert len(self._connections) == 0

        Endpoint.terminate(self)
Example #9
0
File: robot.py Project: xranby/rce
    def terminate(self):
        """ Method should be called to terminate the client before the reactor
            is stopped.
            
            @return:            Deferred which fires as soon as the client is
                                ready to stop the reactor.
            @rtype:             twisted::Deferred
        """
        self._pendingRobots = {}

        for call in self._deathCandidates.itervalues():
            call.cancel()

        self._deathCandidates = {}

        for robot in self._robots.copy():
            robot.remote_destroy()
        assert len(self._robots) == 0

        Endpoint.terminate(self)
Example #10
0
File: robot.py Project: xranby/rce
    def __init__(self, reactor, commPort, extIF, extPort, loader, converter):
        """ Initialize the Robot Client.
            
            @param reactor:     Reference to the twisted reactor used in this
                                robot process.
            @type  reactor:     twisted::reactor
            
            @param commPort:    Port where the server for the cloud engine
                                internal communication is listening for
                                incoming connections.
            @type  commPort:    int
            
            @param extIF:       Name of network interface used for the external
                                communication.
            @type  extIF:       str
            
            @param extPort:     Port where the server for the external
                                communication is listening for websocket
                                connections.
            @type  extPort:     int
            
            @param loader:      Object which is used to load python modules
                                from ROS packages.
            @type  loader:      rce.util.loader.Loader
            
            @param converter:   Converter which takes care of converting the
                                messages from JSON to ROS message and vice
                                versa.
            @type  converter:   rce.util.converter.Converter
        """
        Endpoint.__init__(self, reactor, commPort)

        self._extAddress = "{0}:{1}".format(getIP(extIF), extPort)
        self._converter = converter
        self._loader = loader

        self._robots = set()
        self._pendingRobots = {}
        self._deathCandidates = {}