/// <summary> /// Проверяет, соответствует ли положения <paramref name="positions"/> плеч конструктивным параметрам или рабочей зоне. /// </summary> /// <returns>Коллекция ошибок</returns> public IEnumerable <DesignParametersException> ValidateLeverPositions(IEnumerable <LeverPosition> positions) { foreach (var position in positions) { if (!Calculation.GetRobotLeverByType(position.LeverType).Workspace.IsBetweenMinAndMax(position.Position)) { yield return(new DesignParametersException(position.LeverType.ToRuString() + ": Положение " + position.Position + " не удовлетворяет конструктивным параметрам робота-манипулятора или рабочей зоне")); } } }
private void ChangeLeverPosition(LeverType type, long stepsCount) { var lever = Calculation.GetRobotLeverByType(type); var oldValue = lever.AB; Calculation.SetNewLeverPosition(type, stepsCount); UpdateLocation(); var newValue = lever.AB; LeverPositionChanged(this, new LeverPosition(type, newValue)); if (lever.Workspace.ABzero == null) { return; } if (oldValue == lever.Workspace.ABzero || newValue == lever.Workspace.ABzero) { OnZeroPositionChanged(this, new LeverZeroPositionEventArgs(type, newValue == lever.Workspace.ABzero)); } }
/// <summary> /// Возвращает истину если плечо робота типа <paramref name="type"/> /// находится в нулевой точке рабочей зоны плеча. /// </summary> /// <param name="type">Тип плеча</param> /// <returns>Истина, если плечо в нулевой точке</returns> public bool IsOnZeroPosition(LeverType type) { var lever = Calculation.GetRobotLeverByType(type); return(lever.Workspace.ABzero == lever.AB); }
/// <summary> /// Возвращает положение плеча робота-манипулятора заданного типа <paramref name="type"/>. /// </summary> /// <param name="type">Тип плеча робота</param> /// <returns>Положение плеча</returns> public double GetLeverPosition(LeverType type) { return(Calculation.GetRobotLeverByType(type).AB); }