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(); }
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; }
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); }
public bool PanTiltAbsolute(PanTiltPosition position) { return(this.PanTiltAbsolute(position.Pan, position.Tilt)); }
public bool PanTiltAbsolute(PanTiltPosition position) { return(true); }