...
To run Pally without the teach pendant we recommend using the Order Processing functions, deactivate the Operator Interface, and Redirect all Popups using registers. During progra program run it is also possible to send a detailed progress report via Callbacks.
...
It is recommended to select Operator Interface: “None”. This will instruct the code generator to exclude all script functions related to the Pally operator interface. As a result, the robot program will be shorter, and start faster.
...
This will instruct the Pally program to get the pattern name and requested number of boxes from the Order Management API. The program will keep running until terminated by external control signals or a fatal error occurs.
...
Suppress popups
It is possible to suppress Pally popups and use IO registers to indicate an error/warning. An integer code and an optional integer parameter is provided.
...
Code Block |
---|
def find_pattern_by_nr(pattern_number): # convert number to string with zero padding local p_str = str_cat("0000", pattern_number) # make sure the string is not longer than 4 digits p_str = str_sub(p_str, str_len(p_str)-4, 4) local nr_patterns = palletmanager_daemon.init_pattern_cache() local pattern_nr = 0 while (pattern_nr < nr_patterns): local file_name = palletmanager_daemon.get_file_name(pattern_nr) textmsg("Testing pattern name: ", file_name) if (str_len(file_name) >= 6): if (str_sub(file_name, 2, 4) == p_str): textmsg("Found pattern name: ", file_name) return file_name end end pattern_nr = pattern_nr + 1 end return "" end def do_insert_order(): local instance = opcua_server_read_byname("INSTANCE") local pattern = opcua_server_read_byname("PATTERN") local boxes = opcua_server_read_byname("BOXES") local pattern_name = find_pattern_by_nr(pattern) local result = 0 if (pattern_name != ""): local nr_orders = palletmanager_daemon.get_nr_orders(instance) if (palletmanager_daemon.insert_order(instance, nr_orders, "SOME_ID", "My Order", pattern_name, [1, boxes])): textmsg(str_cat("Inserted order ", pattern_name), str_cat(" with boxes ", boxes)) result = 1 end end return result end def do_terminate_pallet(): local result = 0 local instance = opcua_server_read_byname( "INSTANCE") if (instance==0): rf_P1_terminate = True rf_P2_terminate = True result = 1 end return result end def do_delete_orders(): local instance = opcua_server_read_byname("INSTANCE") local result = 0 if (palletmanager_daemon.clear_orders(instance)): result = 1 end return result end thread OpcPallyThread(): local command = "" local can_go = True while (can_go): local last_command_seqno = opcua_server_read_byname("COMMAND_SEQNO") local command_seqno = last_command_seqno while (command_seqno == last_command_seqno): sleep(1) command_seqno = opcua_server_read_byname("COMMAND_SEQNO") end last_command_seqno = command_seqno command = opcua_server_read_byname("COMMAND") local result = -999 # command not supported if (command == "NEW_ORDER"): result = do_insert_order() elif (command == "TERMINATE_PALLET"): result = do_terminate_pallet() elif (command == "DELETE_ORDERS"): result = do_delete_orders() elif (command == "EXIT"): can_go = False result = 1 end opcua_server_write_byname("COMMAND_RESULT", result) opcua_server_write_byname("COMMAND_RESULT_SEQNO", command_seqno) end # received EXIT command, terminate program halt end opc_pally_thid = run OpcPallyThread() |
Info |
---|
The example is not suitable for Dual Product mode. |
Palletizing progress via OPC UA
...