コード例 #1
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();
        }
コード例 #2
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;
        }
コード例 #3
0
        public bool ComparePosition(PanTiltPosition position, double tolerance = 0.5, int retry = 5, int timeout = 500)
        {
            if (this._debug)
            {
                Log.Debug($"{nameof(ComparePosition)} - Pan:{position.Pan} Tilt:{position.Tilt} Tolerance: {tolerance}");
            }

            while (retry > 0)
            {
                var ptHeadPosition = this._panTiltControl.GetPosition();

                if (ptHeadPosition == null)
                {
                    Thread.Sleep(timeout);
                    retry--;
                    continue;
                }

                var panDifference  = Math.Abs(position.Pan - ptHeadPosition.Pan);
                var tiltDifference = Math.Abs(position.Tilt - ptHeadPosition.Tilt);

                if (panDifference <= tolerance && tiltDifference <= tolerance)
                {
                    return(true);
                }

                if (this._debug)
                {
                    Log.Debug($"{nameof(ComparePosition)} - Difference, Pan:{panDifference} Tilt:{tiltDifference} Retry:{retry}");
                }

                Thread.Sleep(timeout);
                retry--;
            }

            return(false);
        }
コード例 #4
0
 public bool PanTiltAbsolute(PanTiltPosition position)
 {
     return(this.PanTiltAbsolute(position.Pan, position.Tilt));
 }
コード例 #5
0
 public bool PanTiltAbsolute(PanTiltPosition position)
 {
     return(true);
 }