コード例 #1
0
 public virtual void InitActionObject(string id, string type, Vector3 position, Quaternion orientation, string uuid, ActionObjectMetadata actionObjectMetadata, IO.Swagger.Model.CollisionModels customCollisionModels = null, bool loadResuources = true)
 {
     Data.Id   = id;
     Data.Type = type;
     SetScenePosition(position);
     SetSceneOrientation(orientation);
     Data.Id = uuid;
     ActionObjectMetadata = actionObjectMetadata;
     CreateModel(customCollisionModels);
     enabled    = true;
     visibility = PlayerPrefsHelper.LoadFloat(SceneManager.Instance.SceneMeta.Id + "/ActionObject/" + id + "/visibility", 1);
     SetVisibility(visibility);
 }
コード例 #2
0
 public abstract void CreateModel(IO.Swagger.Model.CollisionModels customCollisionModels = null);
コード例 #3
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);
            }
        }
コード例 #4
0
 public override void InitActionObject(string id, string type, Vector3 position, Quaternion orientation, string uuid, ActionObjectMetadata actionObjectMetadata, IO.Swagger.Model.CollisionModels customCollisionModels = null)
 {
     throw new System.NotImplementedException();
 }
コード例 #5
0
 public override void InitActionObject(string id, string type, Vector3 position, Quaternion orientation, string uuid, ActionObjectMetadata actionObjectMetadata, IO.Swagger.Model.CollisionModels customCollisionModels = null)
 {
     base.InitActionObject(id, type, position, orientation, uuid, actionObjectMetadata);
     Data.Id   = id;
     Data.Type = type;
     SetScenePosition(position);
     SetSceneOrientation(orientation);
     Data.Id = uuid;
     ActionObjectMetadata = actionObjectMetadata;
     CreateModel(customCollisionModels);
     enabled = true;
     SetVisibility(visibility);
 }
コード例 #6
0
        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;
        }
コード例 #7
0
        public async override void InitActionObject(string id, string type, Vector3 position, Quaternion orientation, string uuid, ActionObjectMetadata actionObjectMetadata, IO.Swagger.Model.CollisionModels customCollisionModels = null, bool loadResources = true)
        {
            base.InitActionObject(id, type, position, orientation, uuid, actionObjectMetadata);
            //UrdfManager.Instance.OnUrdfReady += OnUrdfDownloaded;

            // if there should be an urdf robot model
            if (ActionsManager.Instance.RobotsMeta.TryGetValue(type, out RobotMeta robotMeta) && !string.IsNullOrEmpty(robotMeta.UrdfPackageFilename))
            {
                // check if robot model exists
                if (UrdfManager.Instance.CheckIfRobotModelExists(type))
                {
                    // check if newer robot model exists on the server
                    if (UrdfManager.Instance.CheckIfNewerRobotModelExists(robotMeta.UrdfPackageFilename, type))
                    {
                        // TODO destroy the old robot version
                        UrdfManager.Instance.RemoveOldModels(type);

                        // download newer version of the urdf
                        UrdfManager.Instance.OnRobotUrdfModelLoaded += OnRobotModelLoaded;
                        StartCoroutine(UrdfManager.Instance.DownloadUrdfPackage(robotMeta.UrdfPackageFilename, robotMeta.Type));
                    }
                    else
                    {
                        // get the robot model
                        RobotModel = UrdfManager.Instance.GetRobotModelInstance(type);
                        if (RobotModel != null)
                        {
                            RobotModelLoaded();
                        }
                        else
                        {
                            Debug.LogError("Fatal error, robot model should be present and loaded, but it is not. Report bug.");
                        }
                    }
                }
                // robot model is not loaded at all, check if urdf is downloaded locally and import it, otherwise download it
                else
                {
                    // check if newer robot model exists on the server.. if it is not downloaded at all, it will return true
                    if (UrdfManager.Instance.CheckIfNewerRobotModelExists(robotMeta.UrdfPackageFilename, type))
                    {
                        UrdfManager.Instance.OnRobotUrdfModelLoaded += OnRobotModelLoaded;
                        StartCoroutine(UrdfManager.Instance.DownloadUrdfPackage(robotMeta.UrdfPackageFilename, robotMeta.Type));
                    }
                    else     // the robot zip is downloaded, thus start direct build
                    {
                        UrdfManager.Instance.OnRobotUrdfModelLoaded += OnRobotModelLoaded;
                        UrdfManager.Instance.BuildRobotModelFromUrdf(type);
                    }
                }
            }
            //LoadResources = loadResources;
            ResourcesLoaded = false;
        }