Example #1
0
        public MotorWithFeedback(string name)
        {
            this.name = name;
            Executor.Current.Register(this);

            this.vector = new MotorVector(0, 0, TimeSpan.FromMilliseconds(0));
            this.movementDone = new ManualResetEvent(true);
        }
Example #2
0
        public MotorWithFeedback(string name)
        {
            this.log  = Log.Logger;
            this.name = name;
            Executor.Current.Register(this);

            this.vector       = new MotorVector(0, 0, TimeSpan.FromMilliseconds(0));
            this.movementDone = new ManualResetEvent(true);
        }
Example #3
0
        public virtual MotorWithFeedback SetVector(double speed, int target, TimeSpan timeout)
        {
            if (!speed.WithinLimits(0, 1))
                throw new ArgumentOutOfRangeException("Speed");

            if (failed)
                throw new InvalidOperationException("Motor failed");

            if (!movementDone.WaitOne(0))
                throw new InvalidOperationException("Already moving");

            movementDone.Reset();
            lastCommandSent = DateTime.Now;
            this.Vector = new MotorVector(speed, target, timeout);

            return this;
        }
Example #4
0
        public virtual MotorWithFeedback SetVector(double speed, int target, TimeSpan timeout)
        {
            if (!speed.WithinLimits(0, 1))
            {
                throw new ArgumentOutOfRangeException("Speed");
            }

            if (failed)
            {
                throw new InvalidOperationException("Motor failed");
            }

            if (!movementDone.WaitOne(0))
            {
                throw new InvalidOperationException("Already moving");
            }

            movementDone.Reset();
            lastCommandSent = DateTime.Now;
            this.Vector     = new MotorVector(speed, target, timeout);

            return(this);
        }