Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using the product selection variables rf_product_selection_strategy and rf_product_selection_predefined is still possible, but not recommended when using Pally in headless mode. These variables are useful when creating a simple palletizer application with a fixed pallet pattern, but won’t provide a flexible workflow that can be easily controlled by an external controller.

Easy pattern selection

In headless mode it is a common practice to use a special naming convention in pattern names to make pattern selection via external control systems easy. In the following example we use 4-digit integer number in the pattern file name to identify patterns, assuming every pattern file name is in the format

P_nnnn_patternname.json

where nnnn is a 4-digit integer in the middle of a file name.

The function goes through the list of available patterns in the patterns folder, and return the file name that matches the search criteria.

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

Pallet confirmation signals

...