Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        ShapeCastObject = ShapeDisplayObject.GetComponent <ShapeCast>();

        workspace = WorkspaceObject.GetComponent <TableRenderVive> ();

        // Generate map objects and targets
        GetMapObjectsAndTargets();

        // Set all recognition objects as inactive
        //Debug.Log("Non-targets are: ");
        foreach (GameObject obj in mapObjects)
        {
            obj.transform.rotation = workspace.transform.rotation;
            obj.transform.Rotate(new Vector3(90, 0, 0));
            obj.transform.parent = workspace.transform;
            //Debug.Log(obj.name);
        }
        //Debug.Log("Target objects are: ");
        foreach (GameObject obj in targetObjects)
        {
            obj.transform.rotation = workspace.transform.rotation;
            obj.transform.Rotate(new Vector3(90, 0, 0));
            obj.transform.parent = workspace.transform;
        }

        // Create folder directories to save data into for this study
        string baseFilePath   = Directory.GetCurrentDirectory() + "/Assets/Data/";
        string userFolderName = filename + "_" + "mapNum_" + mapNum;
        string userFolder     = baseFilePath + userFolderName;

        // Determine whether the directory exists.
        if (Directory.Exists(userFolder))
        {
            Debug.Log("WARNING! User folder exists already. Did you update subject number?");
        }
        else
        {
            Directory.CreateDirectory(userFolder);
        }

        filename = userFolderName + "/" + filename;

        // Init object selection list
        targetSelection.ClearOptions();
        options = new List <string>();
        foreach (GameObject obj in allObjects)
        {
            options.Add(obj.name);
        }
        targetSelection.AddOptions(options);
        targetSelection.gameObject.SetActive(false);
    }
Beispiel #2
0
    private const float CONV_M_TO_MM = 1000; // [mm/m]

    #region Unity updates
    // Use this for initialization
    void Start()
    {
        // Get the shape display object
        _ShapeRenderer = renderingPlane.GetComponent <ShapeCast>();

        // Initially send slave setup data
        _SetupSlaves = true;

        // Initialize thread
        _ShapeDispSerialThread = new SerialThreadLoop(
            "shapeDisplayThread", true, System.Threading.ThreadPriority.Lowest, 5, 4,
            comPort, baudRate, readTimeout, writeTimeout);

        // Start the thread
        _ShapeDispSerialThread.Start();

        // Register for a notification of the SerialDataReceivedEvent
        //SerialThreadLoop.SerialReceivedDataEvent +=
        //    new SerialThreadLoop.SerialReceivedDataEventHandler(SerialReceivedEvent);
    }