Ejemplo n.º 1
0
    public async override void Confirm()
    {
        string cameraName = (string)Dropdown.GetValue();

        if (SceneManager.Instance.TryGetActionObjectByName(cameraName, out ActionObject camera))
        {
            try {
                GameManager.Instance.ShowLoadingScreen("Calibrating robot...");
                await WebsocketManager.Instance.CalibrateRobot(robotId, camera.Data.Id, (bool)Switch.GetValue());
            } catch (RequestFailedException ex) {
                GameManager.Instance.HideLoadingScreen();
                Notifications.Instance.ShowNotification("Failed to calibrate robot", ex.Message);
            } finally {
                Close();
            }
        }
    }
 public async void MoveHereRobot()
 {
     try {
         if (isOrientationDetail)
         {
             string armId = null;
             if (SceneManager.Instance.SelectedRobot.MultiArm())
             {
                 armId = SceneManager.Instance.SelectedArmId;
             }
             await WebsocketManager.Instance.MoveToActionPointOrientation(SceneManager.Instance.SelectedRobot.GetId(), SceneManager.Instance.SelectedEndEffector.GetName(), (decimal)SpeedSlider.value, orientation.Id, (bool)SafeMove.GetValue(), armId);
         }
         else
         {
             await WebsocketManager.Instance.MoveToActionPointJoints(joints.RobotId, (decimal)SpeedSlider.value, joints.Id, (bool)SafeMove.GetValue(), joints.ArmId);
         }
     } catch (ItemNotFoundException ex) {
         Notifications.Instance.ShowNotification("Failed to move robot", ex.Message);
     } catch (RequestFailedException ex) {
         Notifications.Instance.ShowNotification("Failed to move robot", ex.Message);
     }
 }
Ejemplo n.º 3
0
    private void OnProjectOrSceneLoaded(bool project)
    {
        foreach (GameObject obj in ProjectRelatedSettings)
        {
            obj.SetActive(project);
        }
        if (project)
        {
            APSizeSlider.gameObject.SetActive(true);
            APOrientationsVisibility.gameObject.SetActive(true);
            APSizeSlider.value = ProjectManager.Instance.APSize;
            APOrientationsVisibility.SetValue(Base.ProjectManager.Instance.APOrientationsVisible);

            SwitchToProjectParametersBtn.SetInteractivity(true);
            SwitchToProjectParametersBtnImage.color = Color.white;
            GenerateParameterButtons();
            WebsocketManager.Instance.OnProjectParameterAdded   += OnProjectParameterAdded;
            WebsocketManager.Instance.OnProjectParameterRemoved += OnProjectParameterRemoved;
        }
        else
        {
            APSizeSlider.gameObject.SetActive(false);
            APOrientationsVisibility.gameObject.SetActive(false);
            SwitchToProjectParametersBtn.SetInteractivity(false, "Project parameters are available only in project editor.");
            SwitchToProjectParametersBtnImage.color = Color.gray;
        }

        Interactibility.SetValue(Base.SceneManager.Instance.ActionObjectsInteractive);
        RobotsEEVisible.SetValue(Base.SceneManager.Instance.RobotsEEVisible, false);
        ActionObjectsVisibilitySlider.SetValueWithoutNotify(SceneManager.Instance.ActionObjectsVisibility * 100f);

#if UNITY_ANDROID && AR_ON
        recalibrationTime.SetValue(CalibrationManager.Instance.AutoRecalibrateTime);
        Trackables.SetValue(PlayerPrefsHelper.LoadBool("control_box_display_trackables", false));
        CalibrationElements.Interactable = false;
        CalibrationElements.SetValue(true);
        CalibrationElementsTooltip.DisplayAlternativeDescription = true;


        bool useAutoCalib = PlayerPrefsHelper.LoadBool("control_box_autoCalib", true);

        AutoCalibTooltip.DisplayAlternativeDescription = useAutoCalib;


        AutoCalibration.SetValue(useAutoCalib);
        // If the toggle is unchanged, we need to manually call the EnableAutoReCalibration function.
        // If the toggle has changed, the function will be called automatically. So we need to avoid calling it twice.
        if (((bool)AutoCalibration.GetValue() && useAutoCalib) || (!(bool)AutoCalibration.GetValue() && !useAutoCalib))
        {
            EnableAutoReCalibration(useAutoCalib);
        }
#endif
        ConnectionsSwitch.SetValue(PlayerPrefsHelper.LoadBool("control_box_display_connections", true));
        recalibrationTime.SetValue(PlayerPrefsHelper.LoadString("/autoCalib/recalibrationTime", "120"));
        string uri = PlayerPrefsHelper.LoadString("ProjectServiceURI", "");
        ProjectServiceURI.Input.SetValue(GetProjectServiceURI(false));
        if (string.IsNullOrEmpty(uri))
        {
            ResetProjectServiceURIButton.SetInteractivity(false, "Default value is already set");
        }
        else
        {
            ResetProjectServiceURIButton.SetInteractivity(true);
        }
    }