コード例 #1
0
    def __init__(self, settingsPath, objectsPath, cascadePath):
        """
        :param settingsPath: The full path to Settings.txt
        :param objectsPath:  The path to directory that holds Objects, for ObjectManager
        :param cascadePath:  The path to the directory that holds the eye_cascade.xml, face_cascade.xml, and smile_cascade.xml
        """
        # Initialize Global Variables
        Global.init()

        # Load settings before any objects are created
        self.__settingsPath = settingsPath
        self.__settings = self.__loadSettings()

        # Set up environment objects
        self.__vStream = Video.VideoStream()  # Gets frames constantly
        self.__robot = Robot.Robot()
        self.__vision = Vision(
            self.__vStream, cascadePath
        )  # Performs computer vision tasks, using images from vStream
        self.__objectMngr = ObjectManager.ObjectManager(objectsPath)
        self.__transform = None

        # If the settings have any information, try to instantiate objects. Otherwise, GUI will do this as user requests
        cameraID = self.__settings['cameraID']
        if cameraID is not None:
            self.__vStream.setNewCamera(cameraID)

        robotID = self.__settings['robotID']
        if robotID is not None:
            self.__robot.setUArm(robotID)

        ptPairs = self.__settings["coordCalibrations"]["ptPairs"]
        if ptPairs is not None:
            self.__transform = Transform(ptPairs)