public async void UpdateObjectPosition() { if (RobotsList.Dropdown.dropdownItems.Count == 0 || EndEffectorList.Dropdown.dropdownItems.Count == 0) { Base.NotificationsModernUI.Instance.ShowNotification("Failed to update object position", "No robot or end effector available"); return; } PivotEnum pivot = (PivotEnum)Enum.Parse(typeof(PivotEnum), (string)PivotList.GetValue()); IRobot robot = SceneManager.Instance.GetRobotByName((string)RobotsList.GetValue()); await WebsocketManager.Instance.UpdateActionObjectPoseUsingRobot(CurrentObject.Data.Id, robot.GetId(), (string)EndEffectorList.GetValue(), pivot); }
public async void UpdateObjectPosition() { if (!SceneManager.Instance.IsRobotAndEESelected()) { Base.NotificationsModernUI.Instance.ShowNotification("Failed to update object position", "No robot or end effector available"); return; } PivotEnum pivot = (PivotEnum)Enum.Parse(typeof(PivotEnum), (string)PivotList.GetValue()); string armId = null; if (SceneManager.Instance.SelectedRobot.MultiArm()) { armId = SceneManager.Instance.SelectedArmId; } try { await WebsocketManager.Instance.UpdateActionObjectPoseUsingRobot(currentObject.Data.Id, SceneManager.Instance.SelectedRobot.GetId(), SceneManager.Instance.SelectedEndEffector.GetName(), pivot, armId); } catch (RequestFailedException ex) { Notifications.Instance.ShowNotification("Failed to update object position", ex.Message); } }
private void InitPivotType() { Vector2 pivotValue = rectTransform.pivot; if (Math.Abs(pivotValue.x) < 0.001f) { pivotX = PivotEnum.Left; } else if (Math.Abs(pivotValue.x - 1) < 0.001f) { pivotX = PivotEnum.Right; } if (Math.Abs(pivotValue.y) < 0.001f) { pivotY = PivotEnum.Down; } else if (Math.Abs(pivotValue.y - 1) < 0.001f) { pivotY = PivotEnum.Up; } }