Пример #1
0
 def relayID(self, relayID):
     """ Register the communication ID of the relay manager which is used
         in this machine.
     """
     if self._relayID:
         if self._relayID == relayID:
             return
         else:
             raise InternalError('There is already a relay ID registered.')
     
     if not definition.validateAddress(relayID):
         raise InvalidRequest('Relay ID "{0}" is not '
                              'valid.'.format(relayID))
     
     self._relayID = relayID
Пример #2
0
    from argparse import ArgumentParser

    parser = ArgumentParser(prog='Environment',
                            description='Manager for ROS components inside a '
                                        'container.')

    parser.add_argument('commID', help='Communication ID of this process.')
    parser.add_argument('relayIP', help='IP address of relay process of this '
                                        'machine.')
    parser.add_argument('relayID', help='Communication ID of relay process of '
                                        'this machine.')

    return parser


if __name__ == '__main__':
    from twisted.internet import reactor
    
    args = _get_argparse().parse_args()
    
    if not definition.validateAddress(args.commID):
        print 'Communication ID of this process is not a valid.'
        exit(1)
    
    if not definition.validateAddress(args.relayID):
        print 'Communication ID of relay process is not a valid.'
        exit(1)
    
    main(reactor, args.commID, args.relayIP, RELAY_ROS_PORT,
         args.relayID, 'localhost', ROS_NODE_PORT, definition.NEIGHBOR_ADDR)