private void Start()
 {
     Debug.Log(Application.persistentDataPath + "/" + Configuration.Instance.GetAttemptId());
     screenCapturePath = DXManager.Instance.GetDirectoryFor(DataCapturePaths.ScreenCapture);
     // Data logger defaults to the same run directory as ScreenCapture
     dataLogger = new Unity.AI.Simulation.Logger("DataCapture");
 }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        objDict = new Dictionary <string, GameObject>();
        objDict.Add("cube", CubePrefab);
        objDict.Add("sphere", SpherePrefab);

        // Create a specific logger for AppParams for debugging purposes
        paramLogger       = new Unity.AI.Simulation.Logger("ParamReader");
        cubeLogger        = new Unity.AI.Simulation.Logger("CubeLogger");
        simElapsedSeconds = 0;

        // NOTE: AppParams can be loaded anytime except during `RuntimeInitializeLoadType.BeforeSceneLoad`
        // If the simulation is running locally load app_param_0.json
        if (!Configuration.Instance.IsSimulationRunningInCloud())
        {
            string app_param_name = AppParamToggle ? "mountain_app_param_1.json" : "mountain_app_param_0.json";
            Configuration.Instance.SimulationConfig.app_param_uri =
                "file://" + Application.dataPath + "/StreamingAssets/" + app_param_name;
            Debug.Log(Configuration.Instance.SimulationConfig.app_param_uri);
        }

        appParams = Configuration.Instance.GetAppParams <MountainParam>();

        // Check if AppParam file was passed during command line execution
        if (appParams != null)
        {
            // Log AppParams to Player.Log file and Editor Console
            Debug.Log(appParams.ToString());

            // Log AppParams to DataLogger
            paramLogger.Log(appParams);
            paramLogger.Flushall();

            // Update the screen capture interval through an app-param
            float screenCaptureInterval = Mathf.Min(Mathf.Max(0, appParams.screenCaptureInterval), 100.0f);
            GameObject.FindGameObjectsWithTag("DataCapture")[0].GetComponent <CameraGrab>()._screenCaptureInterval =
                screenCaptureInterval;

            // Set the Simulation exit time.
            quitAfterSeconds = appParams.quitAfterSeconds;
            red          = appParams.red;
            green        = appParams.green;
            blue         = appParams.blue;
            whichObjects = appParams.whichObjects;
        }
        else
        {
            Debug.Log("NULL");
        }
    }
Esempio n. 3
0
    // Create and Log a vector
    void Start()
    {
        // Print the location where data will be written
        Debug.Log(Application.persistentDataPath + "/" + Configuration.Instance.GetAttemptId());

        // Create new data logger with output files named DataCapture
        dataLogger = new Unity.AI.Simulation.Logger("DataCapture");

        Vector3 examplePosition = new Vector3(0, 1, 2);

        //Create a new data point
        ObjectPosition objectPosition = new ObjectPosition(examplePosition, "ExampleObjectName");

        dataLogger.Log(objectPosition);

        // Flush written objectPosition to file
        dataLogger.Flushall();
    }
Esempio n. 4
0
    private void Update()
    {
        // Get total time sim elapsed
        simElapsed += Time.deltaTime;

        // Sim has hit duration, flush all data and quit application
        if (simElapsed >= duration && !quit)
        {
            dataLogger.Flushall();
            quit = true;
            Debug.Log("Quitting...");
            Unity.AI.Simulation.Logger successLogger = new Unity.AI.Simulation.Logger("_Success");
            Application.Quit();
        }

        // Capture Data if last time capture time was over 1 second ago
        if ((int)simElapsed - lastCapture >= captureInterval && !quit)
        {
            Capture(lastCapture);
            lastCapture = (int)simElapsed;
        }
    }
    void Start()
    {
        // Create a specific logger for AppParams for debugging purposes
        paramLogger       = new Unity.AI.Simulation.Logger("ParamReader");
        cubeLogger        = new Unity.AI.Simulation.Logger("CubeLogger");
        simElapsedSeconds = 0;

        // NOTE: AppParams can be loaded anytime except during `RuntimeInitializeLoadType.BeforeSceneLoad`
        // If the simulation is running locally load app_param_0.json
        if (!Configuration.Instance.IsSimulationRunningInCloud())
        {
            Configuration.Instance.SimulationConfig.app_param_uri = "file://" + Application.dataPath + "/StreamingAssets/app_param_0.json";
            Debug.Log(Configuration.Instance.SimulationConfig.app_param_uri);
        }

        appParams = Configuration.Instance.GetAppParams <CubeAppParam>();

        // Check if AppParam file was passed during command line execution
        if (appParams != null)
        {
            // Log AppParams to Player.Log file and Editor Console
            Debug.Log(appParams.ToString());

            // Log AppParams to DataLogger
            paramLogger.Log(appParams);
            paramLogger.Flushall();

            // Update the screen capture interval through an app-param
            float screenCaptureInterval = Mathf.Min(Mathf.Max(0, appParams.screenCaptureInterval), 100.0f);
            GameObject.FindGameObjectsWithTag("DataCapture")[0].GetComponent <CameraGrab>()._screenCaptureInterval = screenCaptureInterval;
            // ReplicateCube
            ReplicateCube(GameObject.FindGameObjectsWithTag("Cube")[0], appParams.replicateCube);

            // Set the Simulation exit time.
            quitAfterSeconds = appParams.quitAfterSeconds;
        }
    }