Ejemplo n.º 1
0
def instantiate_objects():
    """After connection has been made, instatiate the various robot objects
    """

    global perm_dir_path
    global dir_path

    logger.debug('instantiate_objects called')
    #get default json file
    def_start_protocol = FileIO.get_dict_from_json(
        os.path.join(dir_path, 'data/default_startup_protocol.json'))
    #FileIO.get_dict_from_json('/home/pi/PythonProject/default_startup_protocol.json')

    #instantiate the head
    head = Head(def_start_protocol['head'], publisher, perm_dir_path)
    logger.debug('head string: ')
    logger.debug(str(head))
    logger.debug('head representation: ')
    logger.debug(repr(head))
    #use the head data to configure the head
    head_data = {}
    head_data = prot_dict['head']  #extract the head section from prot_dict

    logger.debug("Head configured!")

    #instantiate the script keeper (sk)

    #instantiate the deck
    deck = Deck(def_start_protocol['deck'], publisher, perm_dir_path)
    logger.debug('deck string: ')
    logger.debug(str(deck))
    logger.debug('deck representation: ')
    logger.debug(repr(deck))

    runner = ProtocolRunner(head, publisher)

    #use the deck data to configure the deck
    deck_data = {}
    deck_data = prot_dict['deck']  #extract the deck section from prot_dict
    #    deck = RobotLib.Deck({})        #instantiate an empty deck
    deck.configure_deck(deck_data)  #configure the deck from prot_dict data
    logger.debug("Deck configured!")

    #do something with the Ingredient data
    ingr_data = {}
    ingr_data = prot_dict[
        'ingredients']  #extract the ingredient section from prot_dict
    ingr = Ingredients({})

    ingr.configure_ingredients(
        ingr_data)  #configure the ingredienets from prot_dict data
    logger.debug('Ingredients imported!')

    publisher.set_head(head)
    publisher.set_runner(runner)
    subscriber.set_deck(deck)
    subscriber.set_head(head)
    subscriber.set_runner(runner)
Ejemplo n.º 2
0
def instantiate_objects():
    """After connection has been made, instatiate the various robot objects
    """

    global perm_dir_path
    global dir_path

    #get default json file
    def_start_protocol = FileIO.get_dict_from_json(os.path.join(dir_path,'data/default_startup_protocol.json'))
    #FileIO.get_dict_from_json('/home/pi/PythonProject/default_startup_protocol.json')


    #instantiate the head
    head = Head(def_start_protocol['head'], publisher, perm_dir_path)
    #use the head data to configure the head
    head_data = {}
    head_data = prot_dict['head']   #extract the head section from prot_dict


    #instantiate the script keeper (sk)


    #instantiate the deck
    deck = Deck(def_start_protocol['deck'], publisher, perm_dir_path)


    runner = ProtocolRunner(head, publisher)


    #use the deck data to configure the deck
    deck_data = {}
    deck_data = prot_dict['deck']   #extract the deck section from prot_dict
    #    deck = RobotLib.Deck({})        #instantiate an empty deck
    deck.configure_deck(deck_data)  #configure the deck from prot_dict data


    #do something with the Ingredient data
    ingr_data = {}
    ingr_data = prot_dict['ingredients'] #extract the ingredient section from prot_dict
    ingr = Ingredients({})

    ingr.configure_ingredients(ingr_data) #configure the ingredienets from prot_dict data


    publisher.set_head(head)
    publisher.set_runner(runner)
    subscriber.set_deck(deck)
    subscriber.set_head(head)
    subscriber.set_runner(runner)
Ejemplo n.º 3
0
def instantiate_objects():
    """After connection has been made, instatiate the various robot objects
    """
    FileIO.log('instantiate_objects called')
    #get default json file
    def_start_protocol = FileIO.get_dict_from_json(os.path.join(dir_path,'data/default_startup_protocol.json'))
    #FileIO.get_dict_from_json('/home/pi/PythonProject/default_startup_protocol.json')


    #instantiate the head 
    head = Head(def_start_protocol['head'], publisher)
    if debug == True:
        FileIO.log('head string: ', str(head))
        FileIO.log('head representation: ', repr(head))
    #use the head data to configure the head
    head_data = {}
    head_data = prot_dict['head']   #extract the head section from prot_dict
    #    head = RobotLib.Head({})        #instantiate an empty head
    #head.configure_head(head_data)  #configure the head from prot_dict data
    if debug == True:
        FileIO.log ("Head configured!")


    #instantiate the script keeper (sk)
    the_sk = ScriptKeeper(publisher)


    #instantiate the deck
    deck = Deck(def_start_protocol['deck'], publisher)
    if debug == True:
        FileIO.log('deck string: ', str(deck))
        FileIO.log('deck representation: ', repr(deck))


    runner = ProtocolRunner(head, publisher)

    
    #use the deck data to configure the deck
    deck_data = {}
    deck_data = prot_dict['deck']   #extract the deck section from prot_dict
    #    deck = RobotLib.Deck({})        #instantiate an empty deck
    deck.configure_deck(deck_data)  #configure the deck from prot_dict data
    if debug == True:
        FileIO.log ("Deck configured!")


    #do something with the Ingredient data
    ingr_data = {}
    ingr_data = prot_dict['ingredients'] #extract the ingredient section from prot_dict
    ingr = Ingredients({}) 
    
    ingr.configure_ingredients(ingr_data) #configure the ingredienets from prot_dict data
    if debug == True:
        FileIO.log('Ingredients imported!')
        FileIO.log('this is a test') 


    publisher.set_head(head)
    publisher.set_runner(runner)
    subscriber.set_deck(deck)
    subscriber.set_head(head)
    subscriber.set_runner(runner)


    @asyncio.coroutine
    def periodically_send_ip_addresses():
        """Coroutine that periodically sends information to browser
        """
        if debug == True and verbose == True: FileIO.log('periodically_send_ip_addresses called')
        while True:
            if debug == True and verbose == True: FileIO.log('periodically_send_ip_addresses again...')
            yield from asyncio.sleep(2)
            stuff = yield from sk.per_data()
            session_factory._myAppSession.publish('com.opentrons.robot_to_browser_ctrl',json.dumps(stuff,sort_keys=True,indent=4,separators=(',',': ')))


    asyncio.Task(periodically_send_ip_addresses())