Example #1
0
    public void Initialize()
    {
        this.initialPosition = Vector2.zero;
        this.initialForward  = Vector2.up;

        // Initialize according to the motion type
        if (this.movementController == MotionManager.MovementController.AutoPilot)
        {
            this.DISTANCE_TO_WAYPOINT_THRESHOLD = 0.05f;// 0.0001f;

            // Setup waypoints and pathseed
            InstantiateSimulationPrefab();

            switch (condPath)
            {
            case VirtualPathGenerator.PathSeedChoice.Office:
                currentPathSeed = VirtualPathGenerator.getPathSeedOfficeBuilding();
                break;

            case VirtualPathGenerator.PathSeedChoice.ExplorationSmall:
                currentPathSeed = VirtualPathGenerator.getPathSeedExplorationSmall();
                break;

            case VirtualPathGenerator.PathSeedChoice.ExplorationLarge:
                currentPathSeed = VirtualPathGenerator.getPathSeedExplorationLarge();
                break;

            case VirtualPathGenerator.PathSeedChoice.LongWalk:
                currentPathSeed = VirtualPathGenerator.getPathSeedLongCorridor();
                break;

            case VirtualPathGenerator.PathSeedChoice.ZigZag:
                currentPathSeed = VirtualPathGenerator.getPathSeedZigzag();
                break;

            case VirtualPathGenerator.PathSeedChoice.Maze:
                this.waypoints = VirtualPathGenerator.getPathSeedMaze();
                break;
            }

            if (condPath != VirtualPathGenerator.PathSeedChoice.Maze)
            {
                float sumOfDistances, sumOfRotations;
                this.waypoints = VirtualPathGenerator.generatePath(currentPathSeed, initialPosition, initialForward, out sumOfDistances, out sumOfRotations);
                Debug.Log("MOTION sumOfDistances: " + sumOfDistances);
                Debug.Log("MOTION sumOfRotations: " + sumOfRotations);
            }


            // Set First Waypoint Position and Enable It
            this.targetWaypoint.position = new Vector3(this.waypoints[0].x, this.targetWaypoint.position.y, this.waypoints[0].y);
            this.waypointIterator        = 0;
            this.targetWaypoint.gameObject.SetActive(true);
            Debug.Log("First waypoint initialized");
        }
    }
Example #2
0
    void setUpExperimentTrackingAreaShape(VirtualPathGenerator.PathSeedChoice pathSeedChoice, System.Type redirector, System.Type resetter)
    {
        // Initialize Values
        this.redirector            = redirector;
        this.resetter              = resetter;
        pathSeeds                  = new List <VirtualPathGenerator.PathSeed>();
        trackingSizes              = new List <TrackingSizeShape>();
        initialConfigurations      = new List <InitialConfiguration>();
        gainScaleFactors           = new List <Vector3>();
        trialsForCurrentExperiment = pathSeedChoice == VirtualPathGenerator.PathSeedChoice.LongWalk ? 1 : MAX_TRIALS;

        switch (pathSeedChoice)
        {
        case VirtualPathGenerator.PathSeedChoice.Office:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedOfficeBuilding());
            break;

        case VirtualPathGenerator.PathSeedChoice.ExplorationSmall:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedExplorationSmall());
            break;

        case VirtualPathGenerator.PathSeedChoice.ExplorationLarge:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedExplorationLarge());
            break;

        case VirtualPathGenerator.PathSeedChoice.LongWalk:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedLongCorridor());
            break;

        case VirtualPathGenerator.PathSeedChoice.ZigZag:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedZigzag());
            break;
        }

        for (int area = 100; area <= 200; area += 50)
        {
            for (float ratio = 1; ratio <= 2; ratio += 0.5f)
            {
                trackingSizes.Add(new TrackingSizeShape(Mathf.Sqrt(area) / Mathf.Sqrt(ratio), Mathf.Sqrt(area) * Mathf.Sqrt(ratio)));
            }
        }

        initialConfigurations.Add(new InitialConfiguration(new Vector2(0, 0), new Vector2(0, 1)));
        initialConfigurations.Add(new InitialConfiguration(new Vector2(0, 0), new Vector2(1, 0)));
        initialConfigurations.Add(new InitialConfiguration(new Vector2(0, 0), Vector2.one)); // HACK: THIS NON-NORMALIZED ORIENTATION WILL INDICATE DIAGONAL AND WILL BE FIXED LATER
        gainScaleFactors.Add(Vector3.one);
    }
Example #3
0
    void setUpExperimentTrackingAreaSizePerformance(VirtualPathGenerator.PathSeedChoice pathSeedChoice, System.Type redirector, System.Type resetter)
    {
        // Initialize Values
        this.redirector            = redirector;
        this.resetter              = resetter;
        pathSeeds                  = new List <VirtualPathGenerator.PathSeed>();
        trackingSizes              = new List <TrackingSizeShape>();
        initialConfigurations      = new List <InitialConfiguration>();
        gainScaleFactors           = new List <Vector3>();
        trialsForCurrentExperiment = pathSeedChoice == VirtualPathGenerator.PathSeedChoice.LongWalk ? 1 : MAX_TRIALS;

        switch (pathSeedChoice)
        {
        case VirtualPathGenerator.PathSeedChoice.Office:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedOfficeBuilding());
            break;

        case VirtualPathGenerator.PathSeedChoice.ExplorationSmall:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedExplorationSmall());
            break;

        case VirtualPathGenerator.PathSeedChoice.ExplorationLarge:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedExplorationLarge());
            break;

        case VirtualPathGenerator.PathSeedChoice.LongWalk:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedLongCorridor());
            break;

        case VirtualPathGenerator.PathSeedChoice.ZigZag:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedZigzag());
            break;
        }

        for (int i = 2; i <= 60; i += 1)
        {
            trackingSizes.Add(new TrackingSizeShape(i, i));
        }

        initialConfigurations.Add(new InitialConfiguration(new Vector2(0, 0), new Vector2(0, 1)));
        gainScaleFactors.Add(Vector3.one);
    }
Example #4
0
    void setUpExperimentFixedTrackingArea(VirtualPathGenerator.PathSeedChoice pathSeedChoice, System.Type redirector, System.Type resetter)
    {
        // Initialize Values
        this.redirector            = redirector;
        this.resetter              = resetter;
        pathSeeds                  = new List <VirtualPathGenerator.PathSeed>();
        trackingSizes              = new List <TrackingSizeShape>();
        initialConfigurations      = new List <InitialConfiguration>();
        gainScaleFactors           = new List <Vector3>();
        trialsForCurrentExperiment = pathSeedChoice == VirtualPathGenerator.PathSeedChoice.LongWalk ? 1 : MAX_TRIALS;

        switch (pathSeedChoice)
        {
        case VirtualPathGenerator.PathSeedChoice.Office:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedOfficeBuilding());
            break;

        case VirtualPathGenerator.PathSeedChoice.ExplorationSmall:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedExplorationSmall());
            break;

        case VirtualPathGenerator.PathSeedChoice.ExplorationLarge:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedExplorationLarge());
            break;

        case VirtualPathGenerator.PathSeedChoice.LongWalk:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedLongCorridor());
            break;

        case VirtualPathGenerator.PathSeedChoice.ZigZag:
            pathSeeds.Add(VirtualPathGenerator.getPathSeedZigzag());
            break;
        }

        trackingSizes.Add(new TrackingSizeShape(simulationManager.envManager.trackedSpace.localScale.x, simulationManager.envManager.trackedSpace.localScale.z));

        initialConfigurations.Add(new InitialConfiguration(new Vector2(0, 0), new Vector2(0, 1)));
        gainScaleFactors.Add(Vector3.one);
    }