private async Task CheckPtLimitAsync()
        {
            if (this._panTiltControl == null)
            {
                return;
            }

            await Task.Delay(1000).ConfigureAwait(false);

            this._ptLimit = this._panTiltControl.GetLimits();
            this.PrepareDrawing();
        }
        private void CheckPtLimit()
        {
            if (this._panTiltControl == null)
            {
                return;
            }

            this._ptLimit = this._panTiltControl.GetLimits();

            this.PrepareDrawing();
            this.PreparePositions();
        }
Пример #3
0
        public void DrawPtHeadLimits(PanTiltLimit panTiltLimit)
        {
            var leftUp    = new PanTiltPosition(panTiltLimit.PanMin, panTiltLimit.TiltMin);
            var leftDown  = new PanTiltPosition(panTiltLimit.PanMin, panTiltLimit.TiltMax);
            var rightUp   = new PanTiltPosition(panTiltLimit.PanMax, panTiltLimit.TiltMin);
            var rightDown = new PanTiltPosition(panTiltLimit.PanMax, panTiltLimit.TiltMax);

            var positions = new PanTiltPosition[] { leftUp, rightUp, rightDown, leftDown };

            var textPos = positions.OrderBy(o => this.Distance(o, new PanTiltPosition(-180, 90))).FirstOrDefault();

            this.DrawText(textPos, "PT Unit Limits", Brushes.Crimson, false);
            this.DrawPolygon(positions, Color.Crimson);
        }
Пример #4
0
        public EneoPanTiltControl(ICommunication communication, bool debug = false)
        {
            this._communication              = communication;
            this._communication.ReceiveData += PackageReceived;

            this._debug = debug;

            this._positionConverter = new PositionConverter();

            this._position = null;
            this._limits   = new PanTiltLimit();
            this._handler  = new FeedbackHandler();

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

            this.InitializeSpeedTranslationTable();
        }
Пример #5
0
        private async Task SetLimits(PanTiltLimit limits)
        {
            //Notice:
            //Pt head cannot move with absolute commands to a position outside the limits we must change the limits before with a relative command
            var eneoPanTiltControl = this._panTiltControl as EneoPanTiltControl;

            if (eneoPanTiltControl == null)
            {
                return;
            }

            await Task.Run(() =>
            {
                //Disable limits
                eneoPanTiltControl.DisableLimit();

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

                //PanMin
                this._panTiltControl.PanRelative(-30);
                this._positionChecker.ComparePosition(new PanTiltPosition(limits.PanMin - 10, 0), tolerance: 5, timeout: 50, retry: 200);
                eneoPanTiltControl.SetLimitLeft();
                this._panTiltControl.PanAbsolute(limits.PanMin);
                this._positionChecker.ComparePosition(new PanTiltPosition(limits.PanMin, 0));
                eneoPanTiltControl.SetLimitLeft();

                //PanMax
                this._panTiltControl.PanRelative(30);
                this._positionChecker.ComparePosition(new PanTiltPosition(limits.PanMax + 10, 0), tolerance: 5, timeout: 50, retry: 200);
                eneoPanTiltControl.SetLimitRigth();
                this._panTiltControl.PanAbsolute(limits.PanMax);
                this._positionChecker.ComparePosition(new PanTiltPosition(limits.PanMax, 0));
                eneoPanTiltControl.SetLimitRigth();

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

                //TiltMin
                this._panTiltControl.TiltRelative(-20);
                this._positionChecker.ComparePosition(new PanTiltPosition(0, limits.TiltMin - 10), tolerance: 5, timeout: 50, retry: 200);
                eneoPanTiltControl.SetLimitDown();
                this._panTiltControl.TiltAbsolute(limits.TiltMin);
                this._positionChecker.ComparePosition(new PanTiltPosition(0, limits.TiltMin));
                eneoPanTiltControl.SetLimitDown();

                //TiltMax
                this._panTiltControl.TiltRelative(20);
                this._positionChecker.ComparePosition(new PanTiltPosition(0, limits.TiltMax + 10), tolerance: 5, timeout: 50, retry: 200);
                eneoPanTiltControl.SetLimitUp();
                this._panTiltControl.TiltAbsolute(limits.TiltMax);
                this._positionChecker.ComparePosition(new PanTiltPosition(0, limits.TiltMax));
                eneoPanTiltControl.SetLimitUp();

                //Enable limits
                eneoPanTiltControl.EnableLimit();

                //Move to zero position
                this._panTiltControl.PanTiltAbsolute(0, 0);
                this._positionChecker.ComparePosition(new PanTiltPosition(0, 0));
            });
        }
Пример #6
0
 private void SetLimits(PanTiltLimit limits)
 {
     this._panTiltControl.SetLimits(limits);
 }
Пример #7
0
 public bool SetLimits(PanTiltLimit panTiltLimit)
 {
     //TODO: Move logic from TestUI project
     return(false);
 }
Пример #8
0
 public bool SetLimits(PanTiltLimit panTiltLimit)
 {
     return(false);
 }