示例#1
0
    private void Start()
    {
        menu = GetComponent <SimpleSideMenu>();
        Debug.Assert(objectName != null);
        Debug.Assert(RobotsList != null);
        Debug.Assert(EndEffectorList != null);
        Debug.Assert(NextButton != null);
        Debug.Assert(PreviousButton != null);
        Debug.Assert(FocusObjectDoneButton != null);
        Debug.Assert(StartObjectFocusingButton != null);
        Debug.Assert(SavePositionButton != null);
        Debug.Assert(CurrentPointLabel != null);
        Debug.Assert(RobotsListsBlock != null);
        Debug.Assert(UpdatePositionBlockMesh != null);
        Debug.Assert(UpdatePositionBlockVO != null);
        Debug.Assert(VisibilitySlider != null);
        Debug.Assert(InputDialog != null);
        Debug.Assert(ConfirmationDialog != null);

        List <string> pivots = new List <string>();

        foreach (string item in Enum.GetNames(typeof(PivotEnum)))
        {
            pivots.Add(item);
        }
        PivotList.PutData(pivots, "Middle", OnPivotChanged);
    }
示例#2
0
 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);
 }
示例#3
0
        /// <summary>
        /// Creates a new, empty Pivot collection.
        /// </summary>
        public PivotCollection()
        {
            m_facetCategories = new PivotList<String, PivotFacetCategory>();
            m_facetCategories.OnAddItem = this.OnAddFacetCategory;
            m_facetCategories.OnRemoveItem = this.OnRemoveFacetCategory;
            m_facetCategories.GetKeyForItem = (facetCategory => facetCategory.Name);

            m_items = new PivotList<String, PivotItem>();
            m_items.OnAddItem = this.OnAddItem;
            m_items.OnRemoveItem = this.OnRemoveItem;
            m_items.GetKeyForItem = (item => item.Id);

            this.SchemaVersion = "1.0";
            this.BasePath = ".";
        }
示例#4
0
    private void Start()
    {
        Debug.Assert(RobotsList != null);
        Debug.Assert(EndEffectorList != null);
        Debug.Assert(NextButton != null);
        Debug.Assert(PreviousButton != null);
        Debug.Assert(FocusObjectDoneButton != null);
        Debug.Assert(StartObjectFocusingButton != null);
        Debug.Assert(SavePositionButton != null);
        Debug.Assert(CurrentPointLabel != null);
        Debug.Assert(RobotsListsBlock != null);
        Debug.Assert(UpdatePositionBlockMesh != null);
        Debug.Assert(UpdatePositionBlockVO != null);
        List <string> pivots = new List <string>();

        foreach (string item in Enum.GetNames(typeof(PivotEnum)))
        {
            pivots.Add(item);
        }
        PivotList.PutData(pivots, "Middle", OnPivotChanged);
    }
示例#5
0
    private void UpdateModelOnEE()
    {
        if (model == null)
        {
            return;
        }
        string robotName = (string)RobotsList.GetValue(), eeId = (string)EndEffectorList.GetValue();

        if (string.IsNullOrEmpty(robotName) || string.IsNullOrEmpty(eeId))
        {
            throw new RequestFailedException("Robot or end effector not selected!");
        }

        try {
            string  robotId = SceneManager.Instance.RobotNameToId(robotName);
            RobotEE ee      = SceneManager.Instance.GetRobot(robotId).GetEE(eeId);
            model.transform.parent = ee.gameObject.transform;

            switch ((PivotEnum)Enum.Parse(typeof(PivotEnum), (string)PivotList.GetValue()))
            {
            case PivotEnum.Top:
                model.transform.localPosition = new Vector3(0, model.transform.localScale.y / 2, 0);
                break;

            case PivotEnum.Bottom:
                model.transform.localPosition = new Vector3(0, -model.transform.localScale.y / 2, 0);
                break;

            case PivotEnum.Middle:
                model.transform.localPosition = new Vector3(0, 0, 0);
                break;
            }
            model.transform.localRotation = new Quaternion(0, 0, 0, 1);
        } catch (ItemNotFoundException ex) {
            Debug.LogError(ex);
            Notifications.Instance.ShowNotification("End-effector position unknown", "Robot did not send position of selected end effector");
            ShowModelSwitch.Switch.isOn = false;
        }
    }