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); }
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); }
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; }
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); }