/// <summary> /// Locate the position where the boolean toggles and stop at that point /// </summary> /// <param name="boolInput"></param> /// <param name="tolerance"></param> /// <param name="speed"></param> /// <returns>Returns the position of the flag</returns> public Degrees FindSignalPos(BoolInput boolInput, Degrees tolerance, DegreesPerSecond speed) { if (boolInput == null) { U.LogPopup("Expected to find BoolInput in FindSignalPos of {0}}'", Nickname); } else { FindSignalChange(boolInput, tolerance, speed); FindSignalChange(boolInput, -tolerance, speed / 2); } return(CurrentPosition); }
/// <summary> /// Move to the absolute popsition at the specified speed /// </summary> /// <param name="position"></param> /// <param name="speed"></param> /// <param name="waitForCompletion"></param> public override void MoveAbs(Degrees position, DegreesPerSecond speed, bool waitForCompletion) { if (!Homed && !_motionSystem.Simulated) { U.LogPopup("Please Home the axis first"); return; } MoveDone = false; // Set tgt motor counts base.MoveAbs(position); // Now do the move _motionSystem.MoveAbsAxis(this, speed, waitForCompletion); }
private void FindSignalChange(BoolInput boolInput, Degrees distance, DegreesPerSecond speed) { bool origVal = boolInput.Value; //System.Diagnostics.Debug.WriteLine(string.Format("About to move axis at {0}, {1}, {2}, {3}", TargetPosition, CurrentPosition, InPosition, boolInput.Value)); MoveRel(distance, speed, false); U.SleepWithEvents(200); while (origVal == boolInput.Value) { //System.Diagnostics.Debug.WriteLine(string.Format("Moving axis at {0}, {1}, {2}, {3}", TargetPosition, CurrentPosition, InPosition, boolInput.Value)); if (MoveDone) { StopAxis(); throw new MCoreExceptionPopup("Error. Expected '{0}' signal to change.", boolInput.Nickname); } U.SleepWithEvents(20); } //System.Diagnostics.Debug.WriteLine(string.Format("Stopping axis at {0}, {1}, {2}, {3}", TargetPosition, CurrentPosition, InPosition, boolInput.Value)); StopAxis(); U.SleepWithEvents(1000); //System.Diagnostics.Debug.WriteLine(string.Format("Axis Stopped at {0}, {1}, {2}, {3}", TargetPosition, CurrentPosition, InPosition, boolInput.Value)); }
/// <summary> /// Move to the absolute popsition at the specified speed /// </summary> /// <param name="position"></param> /// <param name="speed"></param> /// <param name="waitForCompletion"></param> public void MoveAbs(Degrees position, DegreesPerSecond speed) { MoveAbs(position, speed, true); }
public virtual void MoveRel(Degrees position, DegreesPerSecond speed, bool waitForCompletion) { Degrees mAbsPos = CurrentPosition + position; MoveAbs(mAbsPos, speed, waitForCompletion); }
/// <summary> /// Move to the absolute popsition at the specified speed /// </summary> /// <param name="position"></param> /// <param name="speed"></param> public virtual void MoveAbs(Degrees position, DegreesPerSecond speed, bool waitForCompletion) { SetTarget(position); }