def __init__(self, winParent):
        super(ColorFilterWidget, self).__init__()
        self.setupUi(self)
        self.winParent = winParent
        self.imageUpdate.connect(self.updateImage)

        self.filterValues = ColorFilterValues()

        self.resetButton.clicked[bool].connect(self.resetValues)

        self.hminSlider.valueChanged[int].connect(self.hminValueChange)
        self.hmaxSlider.valueChanged[int].connect(self.hmaxValueChange)
        self.sminSlider.valueChanged[int].connect(self.sminValueChange)
        self.smaxSlider.valueChanged[int].connect(self.smaxValueChange)
        self.vminSlider.valueChanged[int].connect(self.vminValueChange)
        self.vmaxSlider.valueChanged[int].connect(self.vmaxValueChange)
예제 #2
0
    def __init__(self):
        self.lock = threading.Lock()

        self.playButton = False

        self.cmd = jderobot.CMDVelData()
        self.cmd.linearX = self.cmd.linearY = self.cmd.linearZ = 0
        self.cmd.angularZ = 0
        ''' With values distinct to 0 in the next fields, the ardrone not enter in hover mode'''
        self.cmd.angularX = 0.5
        self.cmd.angularY = 1.0

        try:
            ic = Ice.initialize(sys.argv)
            properties = ic.getProperties()
            basecamera = ic.propertyToProxy("Introrob.Camera.Proxy")
            self.cameraProxy = jderobot.CameraPrx.checkedCast(basecamera)

            if self.cameraProxy:
                self.image = self.cameraProxy.getImageData("RGB8")
                self.height = self.image.description.height
                self.width = self.image.description.width

                self.trackImage = np.zeros((self.height, self.width, 3),
                                           np.uint8)
                self.trackImage.shape = self.height, self.width, 3

                self.thresoldImage = np.zeros((self.height, self.width, 1),
                                              np.uint8)
                self.thresoldImage.shape = self.height, self.width, 1

                self.filterValues = ColorFilterValues()

            else:
                print 'Interface camera not connected'

            basecmdVel = ic.propertyToProxy("Introrob.CMDVel.Proxy")
            self.cmdVelProxy = jderobot.CMDVelPrx.checkedCast(basecmdVel)
            if not self.cmdVelProxy:
                print 'Interface cmdVel not connected'

            basenavdata = ic.propertyToProxy("Introrob.Navdata.Proxy")
            self.navdataProxy = jderobot.NavdataPrx.checkedCast(basenavdata)

            if self.navdataProxy:
                self.navdata = self.navdataProxy.getNavdata()
                if self.navdata.vehicle == self.ARDRONE_SIMULATED:
                    self.virtualDrone = True
                else:
                    self.virtualDrone = False
            else:
                print 'Interface navdata not connected'
                self.virtualDrone = True

            baseextra = ic.propertyToProxy("Introrob.Extra.Proxy")
            self.extraProxy = jderobot.ArDroneExtraPrx.checkedCast(baseextra)
            if not self.extraProxy:
                print 'Interface ardroneExtra not connected'

            basepose3D = ic.propertyToProxy("Introrob.Pose3D.Proxy")
            self.pose3DProxy = jderobot.Pose3DPrx.checkedCast(basepose3D)
            if self.pose3DProxy:
                self.pose = jderobot.Pose3DData()
            else:
                print 'Interface pose3D not connected'

        except:
            traceback.print_exc()
            exit()
            status = 1