Пример #1
0
def start_and_decode_foreign_object_scan(object_selection):
    if object_selection == 1:                                   # Selection of foreign objects. If 1 - Green_breadboard
        FOREIGN_OBJECT = "Green_breadboard"
    elif object_selection == 2:                                   # Selection of foreign objects. If 2 - Red_Glue
        FOREIGN_OBJECT = "Red_Glue"
    elif object_selection == 3:                                   # Selection of foreign objects. Undefined yet.
        FOREIGN_OBJECT = "3"
    elif object_selection == 4:                                   # Selection of foreign objects. Undefined yet.
        FOREIGN_OBJECT = "4"
    elif object_selection == 5:                                   # Selection of foreign objects. Undefined yet.
        FOREIGN_OBJECT = "5"
    else:
        FOREIGN_OBJECT= "Unknown"

    ## Foreign object scanning
    fault_detection_output = detect_foreign_object(cam, jpeg_streamer, FOREIGN_OBJECT)
    # fault_detection_output = {"fault_detection_feedback": "Error", #"Object found", #"Error"
    #                           "object_coord_x": "0001",
    #                           "object_coord_y": "9999"}

    if fault_detection_output["fault_detection_feedback"][0] == ("E" or "e"):
                                                                # If output starts with E or e
        return "Error"                                          # Return error
    elif fault_detection_output["fault_detection_feedback"][0] == ("O" or "o"):
                                                                # If output starts with O or o (Object is present)
        feedback = str(object_selection) + \
                   str(fault_detection_output["object_coord_x"]) + \
                   str(fault_detection_output["object_coord_y"])

        return feedback                                         # Return that fault was detected
    elif fault_detection_output["fault_detection_feedback"][0] == ("N" or "n"):
                                                                # If output starts with N or n (Not found)
        feedback = "000000000"
        return feedback                                         # Return that fault was not detected
    return "Error"                                              # Any other option (impossible) - Error
Пример #2
0
def start_and_decode_foreign_object_scan():
    FOREIGN_OBJECT = "Green_breadboard"                         # Default name for foreign object
    ## Foreign object scanning
    fault_detection_output = detect_foreign_object(FOREIGN_OBJECT)
    if fault_detection_output[0] == ("E" or "e"):                 # If output starts with E or e
        return "Error"                                          # Return error
    elif fault_detection_output[0] == ("O" or "o"):               # If output starts with O or o (Object is present)
        return "1"                                              # Return that fault was detected
    elif fault_detection_output[0] == ("N" or "n"):               # If output starts with N or n (Not found)
        return "0"                                              # Return that fault was not detected
    return "Error"                                              # Any other option (impossible) - Error
Пример #3
0
def start_and_decode_foreign_object_scan():
    FOREIGN_OBJECT = "Green_breadboard"                         # Default name for foreign object
    ## Foreign object scanning
    fault_detection_output = detect_foreign_object(FOREIGN_OBJECT)
    if fault_detection_output[0] == ("E" or "e"):                 # If output starts with E or e
        return "Error"                                          # Return error
    elif fault_detection_output[0] == ("O" or "o"):               # If output starts with O or o (Object is present)
        return "1"                                              # Return that fault was detected
    elif fault_detection_output[0] == ("N" or "n"):               # If output starts with N or n (Not found)
        return "0"                                              # Return that fault was not detected
    return "Error"                                              # Any other option (impossible) - Error
Пример #4
0
def start_and_decode_foreign_object_scan(object_selection):
    if object_selection == 1:  # Selection of foreign objects. If 1 - Green_breadboard
        FOREIGN_OBJECT = "Green_breadboard"
    elif object_selection == 2:  # Selection of foreign objects. If 2 - Red_Glue
        FOREIGN_OBJECT = "Red_Glue"
    elif object_selection == 3:  # Selection of foreign objects. Undefined yet.
        FOREIGN_OBJECT = "3"
    elif object_selection == 4:  # Selection of foreign objects. Undefined yet.
        FOREIGN_OBJECT = "4"
    elif object_selection == 5:  # Selection of foreign objects. Undefined yet.
        FOREIGN_OBJECT = "5"
    else:
        FOREIGN_OBJECT = "Unknown"

    ## Foreign object scanning
    fault_detection_output = detect_foreign_object(cam, jpeg_streamer,
                                                   FOREIGN_OBJECT)
    # fault_detection_output = {"fault_detection_feedback": "Error", #"Object found", #"Error"
    #                           "object_coord_x": "0001",
    #                           "object_coord_y": "9999"}

    if fault_detection_output["fault_detection_feedback"][0] == ("E" or "e"):
        # If output starts with E or e
        return "Error"  # Return error
    elif fault_detection_output["fault_detection_feedback"][0] == ("O" or "o"):
        # If output starts with O or o (Object is present)
        feedback = str(object_selection) + \
                   str(fault_detection_output["object_coord_x"]) + \
                   str(fault_detection_output["object_coord_y"])

        return feedback  # Return that fault was detected
    elif fault_detection_output["fault_detection_feedback"][0] == ("N" or "n"):
        # If output starts with N or n (Not found)
        feedback = "000000000"
        return feedback  # Return that fault was not detected
    return "Error"  # Any other option (impossible) - Error