void armIn_targetWristChanged(wristPositionData newPosition) { if (newPosition.upVal > 0) { upInd.setIndicatorState(toggleIndicator.indicatorState.Green); } else { upInd.setIndicatorState(toggleIndicator.indicatorState.Off); } if (newPosition.leftVal > 0) { leftInd.setIndicatorState(toggleIndicator.indicatorState.Green); } else { leftInd.setIndicatorState(toggleIndicator.indicatorState.Off); } if (newPosition.rightVal > 0) { rightInd.setIndicatorState(toggleIndicator.indicatorState.Green); } else { rightInd.setIndicatorState(toggleIndicator.indicatorState.Off); } }
void armInput_targetWristChanged(wristPositionData newPosition) { if (!newPosition.Equals(oldWrist) && wristTimerExpired) { oldWrist = newPosition; wristTimerExpired = false; handArduino.write("U:" + newPosition.upVal); handArduino.write("L:" + newPosition.leftVal); handArduino.write("R:" + newPosition.rightVal); } }
private void wristUpdate() { while (true) { lock (wristSync) { if(newWristPositions){ wristPositionData currentData = new wristPositionData((int)upMag, (int)leftMag, (int)rightMag); if (targetWristChanged != null) { targetWristChanged(currentData); } } } Thread.Sleep(100); } }
void armInput_targetWristChanged(wristPositionData newPosition) { lock (WR_LOCK) { if (!wristPos.Equals(newPosition)) { newWrist = true; wristPos = newPosition; } } }
/// <summary> /// Overridden version of the equals method. Determines if the values within the wristPosition are the same. /// </summary> /// <param name="obj"></param> /// <returns></returns> public bool Equals(wristPositionData obj) { try { if (obj.GetType() != base.GetType()) { return false; } wristPositionData tempOther = (wristPositionData)obj; if (tempOther.leftVal == leftVal && tempOther.rightVal == rightVal && tempOther.upVal == upVal) { return true; } return false; } catch { return false; } }