Example #1
0
 public void UpdateLabel()
 {
     if (Robot.MultiArm())
     {
         eeName.text = $"{Robot.GetName()}/{ARMId}/{EEId}";
     }
     else
     {
         eeName.text = $"{Robot.GetName()}/{EEId}";
     }
 }
    public async Task <bool> Open(UnityAction closeCallback)
    {
        if (!SceneManager.Instance.RobotInScene())
        {
            Notifications.Instance.ShowNotification("Failed to open robot selector menu", "There are no robots in scene");
            closeCallback.Invoke();
            return(false);
        }

        _closeCallback = closeCallback;
        robotId        = PlayerPrefsHelper.LoadString(SceneManager.Instance.SceneMeta.Id + "/selectedRobotId", null);
        eeId           = PlayerPrefsHelper.LoadString(SceneManager.Instance.SceneMeta.Id + "/selectedEndEffectorId", null);
        if (!SceneManager.Instance.SceneStarted)
        {
            Notifications.Instance.ShowNotification("Failed to open robot selector", "Scene offline");
            return(false);
        }
        base.Open();
        string robotName = null;

        try {
            IRobot robot = SceneManager.Instance.GetRobot(robotId);
            robotName = robot.GetName();
        } catch (ItemNotFoundException ex) {
            robotName = null;
        }
        DropdownRobots.Dropdown.Dropdown.dropdownItems.Clear();
        await DropdownRobots.Init(SelectRobot, false, robotName);

        if (DropdownRobots.Dropdown.Dropdown.dropdownItems.Count > 0)
        {
            SelectRobot(DropdownRobots.Dropdown.GetValue().ToString());
            return(true);
        }
        else
        {
            Notifications.Instance.ShowNotification("Failed to open robot selector menu", "There are no robots in scene");
            Close();
            return(false);
        }
    }
Example #3
0
 public void InitEE(IRobot robot, string eeId)
 {
     RobotId = robot.GetId();
     EEId    = eeId;
     SetLabel(robot.GetName(), eeId);
 }