Exemple #1
0
        public bool SetLimits(PanTiltLimit panTiltLimit)
        {
            this._panTiltlimit = panTiltLimit;

            this.LimitChanged?.Invoke();
            return(true);
        }
Exemple #2
0
        public EneoPanTiltControl(ICommunication communication, bool debug = false)
        {
            this._communication              = communication;
            this._communication.ReceiveData += PackageReceived;

            this._debug = debug;

            this._positionConverter = new PositionConverter();

            this._position = new PanTiltPosition(0, 0);
            this._limits   = new PanTiltLimit();
            this._handler  = new FeedbackHandler();

            this._resetEvent    = new ManualResetEvent(false);
            this._stopHeartbeat = true;

            this.InitializeSpeedTranslationTable();
        }
Exemple #3
0
        public AlturosPanTiltControl(ICommunication communication, bool debug = false)
        {
            if (communication is TcpNetworkCommunication || communication is SerialPortCommunication)
            {
                throw new NotSupportedException("Only upd communication is supported");
            }

            //Add default limits
            this._panTiltlimit = new PanTiltLimit
            {
                PanMin  = -170,
                PanMax  = 170,
                TiltMin = -60,
                TiltMax = 45
            };

            this._position = new PanTiltPosition(0, 0);

            this._communication              = communication;
            this._communication.ReceiveData += PackageReceived;

            this._debug = debug;
        }
Exemple #4
0
        public bool SetLimits(PanTiltLimit panTiltLimit)
        {
            Task.Run(async() =>
            {
                var positionChecker = new PositionChecker(this);

                //Disable limits
                this.DisableLimit();

                //Move to zero position
                this.PanTiltAbsolute(0, 0);
                positionChecker.ComparePosition(new PanTiltPosition(0, 0));

                var tempPanMin  = panTiltLimit.PanMin - 10;
                var tempTiltMin = panTiltLimit.TiltMin - 10;

                //PanMin
                this.PanRelative(-30);
                await positionChecker.ComparePositionAsync(new PanTiltPosition(tempPanMin, 0), tolerance: 5, timeout: 50, retry: 200);

                //TiltMin
                this.TiltRelative(-20);
                await positionChecker.ComparePositionAsync(new PanTiltPosition(tempPanMin, tempTiltMin), tolerance: 5, timeout: 50, retry: 200);

                //Set temp limits
                this.SetLimitLeft();
                this.SetLimitDown();

                //Drive to absolute position
                this.PanTiltAbsolute(panTiltLimit.PanMin, panTiltLimit.TiltMin);
                await positionChecker.ComparePositionAsync(new PanTiltPosition(panTiltLimit.PanMin, panTiltLimit.TiltMin));

                //Set real limits
                this.SetLimitLeft();
                this.SetLimitDown();

                var tempPanMax  = panTiltLimit.PanMax + 10;
                var tempTiltMax = panTiltLimit.TiltMax + 10;

                //PanMax
                this.PanRelative(30);
                await positionChecker.ComparePositionAsync(new PanTiltPosition(tempPanMax, panTiltLimit.TiltMin), tolerance: 5, timeout: 50, retry: 200);

                //TiltMax
                this.TiltRelative(20);
                await positionChecker.ComparePositionAsync(new PanTiltPosition(tempPanMax, tempTiltMax), tolerance: 5, timeout: 50, retry: 200);

                //Set temp limits
                this.SetLimitRigth();
                this.SetLimitUp();

                //Drive to absolute position
                this.PanTiltAbsolute(panTiltLimit.PanMax, panTiltLimit.TiltMax);
                await positionChecker.ComparePositionAsync(new PanTiltPosition(panTiltLimit.PanMax, panTiltLimit.TiltMax));

                //Set real limits
                this.SetLimitRigth();
                this.SetLimitUp();

                //Enable limits
                this.EnableLimit();
            }).ContinueWith(async o =>
            {
                this.QueryLimits();

                //Move to zero position
                var positionChecker = new PositionChecker(this);
                this.PanTiltAbsolute(0, 0);
                await positionChecker.ComparePositionAsync(new PanTiltPosition(0, 0));

                this.LimitChanged?.Invoke();
            });

            return(true);
        }
Exemple #5
0
 public bool SetLimits(PanTiltLimit panTiltLimit)
 {
     //this.LimitChanged?.Invoke();
     return(true);
 }