Example #1
0
        public virtual void InitActionObject(IO.Swagger.Model.SceneObject sceneObject, Vector3 position, Quaternion orientation, ActionObjectMetadata actionObjectMetadata, IO.Swagger.Model.CollisionModels customCollisionModels = null, bool loadResuources = true)
        {
            Data.Id              = sceneObject.Id;
            Data.Type            = sceneObject.Type;
            name                 = sceneObject.Name; // show actual object name in unity hierarchy
            ActionObjectMetadata = actionObjectMetadata;
            if (actionObjectMetadata.HasPose)
            {
                SetScenePosition(position);
                SetSceneOrientation(orientation);
            }
            CreateModel(customCollisionModels);
            enabled      = true;
            SelectorItem = SelectorMenu.Instance.CreateSelectorItem(this);
            if (VRModeManager.Instance.VRModeON)
            {
                SetVisibility(PlayerPrefsHelper.LoadFloat("AOVisibilityVR", 1f));
            }
            else
            {
                SetVisibility(PlayerPrefsHelper.LoadFloat("AOVisibilityAR", 0f));
            }

            if (PlayerPrefsHelper.LoadBool($"ActionObject/{GetId()}/blocklisted", false))
            {
                Enable(false, true, false);
            }
        }
        public async override void InitActionObject(IO.Swagger.Model.SceneObject sceneObject, Vector3 position, Quaternion orientation, ActionObjectMetadata actionObjectMetadata, IO.Swagger.Model.CollisionModels customCollisionModels = null, bool loadResources = true)
        {
            base.InitActionObject(sceneObject, position, orientation, actionObjectMetadata);

            // if there should be an urdf robot model
            if (ActionsManager.Instance.RobotsMeta.TryGetValue(sceneObject.Type, out RobotMeta robotMeta))
            {
                RobotMeta = robotMeta;
                if (!string.IsNullOrEmpty(robotMeta.UrdfPackageFilename))
                {
                    // Get the robot model, if it returns null, the robot will be loading itself
                    RobotModel = UrdfManager.Instance.GetRobotModelInstance(robotMeta.Type, robotMeta.UrdfPackageFilename);

                    if (RobotModel != null)
                    {
                        RobotModelLoaded();
                    }
                    else
                    {
                        // Robot is not loaded yet, let's wait for it to be loaded
                        UrdfManager.Instance.OnRobotUrdfModelLoaded += OnRobotModelLoaded;
                        modelLoading = true;
                    }
                }
            }

            ResourcesLoaded = false;
        }
 public override void ActionObjectUpdate(IO.Swagger.Model.SceneObject actionObjectSwagger)
 {
     base.ActionObjectUpdate(actionObjectSwagger);
     ActionObjectName.text = actionObjectSwagger.Name;
     // update label on each end effector
     foreach (List <RobotEE> arm in EndEffectors.Values)
     {
         foreach (RobotEE ee in arm)
         {
             ee.UpdateLabel();
         }
     }
     ResetPosition();
 }
Example #4
0
        public virtual void ActionObjectUpdate(IO.Swagger.Model.SceneObject actionObjectSwagger, bool visibility, bool interactivity)
        {
            if (Data != null & Data.Name != actionObjectSwagger.Name)
            {
                UpdateUserId(actionObjectSwagger.Name);
            }
            Data = actionObjectSwagger;
            foreach (IO.Swagger.Model.Parameter p in Data.Parameters)
            {
                if (!ObjectParameters.ContainsKey(p.Name))
                {
                    if (TryGetParameterMetadata(p.Name, out ParameterMeta parameterMeta))
                    {
                        ObjectParameters[p.Name] = new Parameter(parameterMeta, p.Value);
                    }
                    else
                    {
                        Debug.LogError("Failed to load metadata for parameter " + p.Name);
                        Notifications.Instance.ShowNotification("Critical error", "Failed to load parameter's metadata.");
                        return;
                    }
                }
                else
                {
                    ObjectParameters[p.Name].Value = p.Value;
                }
            }

            //TODO: update all action points and actions.. ?
            ResetPosition();
            // update position and rotation based on received data from swagger
            if (visibility)
            {
                Show();
            }
            else
            {
                Hide();
            }

            SetInteractivity(interactivity);
        }
Example #5
0
 public override void ActionObjectUpdate(IO.Swagger.Model.SceneObject actionObjectSwagger, bool visibility, bool interactivity)
 {
     Debug.Assert(Model != null);
     base.ActionObjectUpdate(actionObjectSwagger, visibility, interactivity);
     ActionObjectName.text = actionObjectSwagger.Name;
 }
Example #6
0
 public override void ActionObjectUpdate(IO.Swagger.Model.SceneObject actionObjectSwagger)
 {
     base.ActionObjectUpdate(actionObjectSwagger);
     ActionObjectName.text = actionObjectSwagger.Name;
     ResetPosition();
 }