public void AddCubeRegion(string command)
        {
            GameObject     cube   = CreateGameObject.CubeRegion();
            IRuntimeEditor editor = IOC.Resolve <IRuntimeEditor>();

            editor.Selection.activeGameObject = cube;
        }
        public void AddDataVisualization(string dateType)
        {
            if (dateType == "pointcloud2")
            {
                GameObject createdObject = CreateGameObject.PointCloud2("PointCloud2", "/", true);

                // Focus and Select Created Object
                IRuntimeEditor editor = IOC.Resolve <IRuntimeEditor>();
                editor.Selection.activeGameObject = createdObject;
                Debug.Log($"New {createdObject} added");
            }
            else if (dateType == "boundingboxes")
            {
                GameObject createdObject = CreateGameObject.BoudingBoxes("BoundingBoxes", "/", true);

                // Focus and Select Created Object
                IRuntimeEditor editor = IOC.Resolve <IRuntimeEditor>();
                editor.Selection.activeGameObject = createdObject;
                Debug.Log($"New {createdObject} added");
            }
            else if (dateType == "trajectory")
            {
                GameObject createdObject = CreateGameObject.Trajectory("Trajectory", "/");

                IRuntimeEditor editor = IOC.Resolve <IRuntimeEditor>();
                editor.Selection.activeGameObject = createdObject;
                Debug.Log($"New {createdObject.name} added");
            }
            else if (dateType == "socialdistance")
            {
            }
            else if (dateType == "heatmap")
            {
            }
        }
Exemple #3
0
        public void AutoLoadFromROS()
        {
            Debug.Log("AutoLoadFromROS");

            // Devices
            RosConnection rosConnection = rosGameObject.GetComponent <RosConnection>();

            string[]            DeviceNames         = rosConnection.GetDeviceNames();
            RosTransformManager rosTransformManager = rosGameObject.GetComponent <RosTransformManager>();

            foreach (string name in DeviceNames)
            {
                GameObject newDevice = CreateGameObject.DeviceWithPointCloud("Hokuyo3D", name);
                rosTransformManager.RequestGetParams(newDevice.name);
            }

            // Bounding Boxes
            CreateGameObject.BoudingBoxes("Human BoundingBoxes", "/tracked_humans", false);

            // Point Cloud
            Color      red   = new Color(0.0f, 1.0f, 0.0f, 0.7f);
            GameObject front = CreateGameObject.PointCloud2("Front Point Cloud", "/front", false, true, red);
            // SubscribePointCloud2 subscribe_front = front.GetComponent<SubscribePointCloud2>();
            // subscribe_front.Enabled = true;

            Color      blue       = new Color(0.1f, 0.2f, 1.0f, 0.5f);
            GameObject background = CreateGameObject.PointCloud2("Background Point Cloud", "/background", false, true, blue);

            // SubscribePointCloud2 subscribe_background = background.GetComponent<SubscribePointCloud2>();
            // subscribe_background.Enabled = true;

            CreateGameObject.PointCloud2("Raw Point Cloud", "/point_cloud2", false);
        }
        public void AddDevice(string deviceType)
        {
            GameObject newDeviceObject = CreateGameObject.DeviceWithPointCloud(deviceType);

            // Focus and Select Created Object
            IRuntimeEditor editor = IOC.Resolve <IRuntimeEditor>();

            editor.Selection.activeGameObject = newDeviceObject;
            Debug.Log($"New {deviceType} added");
        }
        public void AddFloorPlan(string floorType)
        {
            Debug.Log("Add Floor: " + floorType);

            if (floorType == "png")
            {
                ExtensionFilter[] extensionFilters = new[] {
                    new ExtensionFilter("2D Map (PNG, BMP, JPG)", "png", "bmp", "jpg", "jpeg")
                };
                string[] paths = StandaloneFileBrowser.OpenFilePanel("Open File", "", extensionFilters, false);
                if (paths.Length != 1)
                {
                    return;
                }
                string path = paths[0];
                if (!File.Exists(path))
                {
                    Debug.LogError($"{path} does not exits");
                    return;
                }

                GameObject FloorPlanImage = CreateGameObject.ImageFile(path);

                // Select
                IRuntimeEditor editor = IOC.Resolve <IRuntimeEditor>();
                editor.Selection.activeGameObject = FloorPlanImage;
            }
            else if (floorType == "obj")
            {
                ExtensionFilter[] extensionFilters = new[] { new ExtensionFilter("3D Map (OBJ)", "obj") };
                string[]          paths            = StandaloneFileBrowser.OpenFilePanel("Open File", "", extensionFilters, false);
                if (paths.Length != 1)
                {
                    return;
                }
                string path = paths[0];
                if (!File.Exists(path))
                {
                    Debug.LogError($"{path} does not exits");
                    return;
                }

                GameObject FloorMapObj = CreateGameObject.ObjFile(path);

                // Select
                IRuntimeEditor editor = IOC.Resolve <IRuntimeEditor>();
                editor.Selection.activeGameObject = FloorMapObj;
            }
        }
        static public GameObject DeviceWithPointCloud(string deviceType)
        {
            GameObject newDevice    = Device(deviceType);
            string     defaultTopic = "/";

            GameObject frontPointCloud      = CreateGameObject.PointCloud2("Front Point Cloud", defaultTopic, false);
            GameObject backgroundPointCloud = CreateGameObject.PointCloud2("Background Point Cloud", defaultTopic, false);
            GameObject rawPointCloud        = CreateGameObject.PointCloud2("Raw Point Cloud", defaultTopic, false);

            frontPointCloud.transform.SetParent(newDevice.transform);
            backgroundPointCloud.transform.SetParent(newDevice.transform);
            rawPointCloud.transform.SetParent(newDevice.transform);

            return(newDevice);
        }
        static public GameObject DeviceWithPointCloud(string deviceType, string deviceName)
        {
            GameObject newDevice = Device(deviceType);

            newDevice.name = deviceName;

            string frontTopic      = $"/lidars/{deviceName}/front";
            string backgroundTopic = $"/lidars/{deviceName}/background";
            string rawTopic        = $"/lidars/{deviceName}/point_cloud2";

            GameObject frontPointCloud      = CreateGameObject.PointCloud2("Front Point Cloud", frontTopic, false);
            GameObject backgroundPointCloud = CreateGameObject.PointCloud2("Background Point Cloud", backgroundTopic, false);
            GameObject rawPointCloud        = CreateGameObject.PointCloud2("Raw Point Cloud", rawTopic, false);

            frontPointCloud.transform.SetParent(newDevice.transform);
            backgroundPointCloud.transform.SetParent(newDevice.transform);
            rawPointCloud.transform.SetParent(newDevice.transform);

            return(newDevice);
        }