Exemple #1
0
    // Start is called before the first frame update
    void Start()

    {
        Application.targetFrameRate = 20;
        // Initialize sensor manager
        LpSensorManager.initSensorManager();

        // connects to sensor
        LpSensorManager.connectToLpms(LpSensorManager.DEVICE_LPMS_B2, lpmsSensor);

        // Wait for establishment of sensor1 connection
        while (LpSensorManager.getConnectionStatus(lpmsSensor) != 1)
        {
            //System.Threading.Thread.Sleep(100);
        }
        Debug.Log("Sensor connected");

        // Sets sensor offset
        LpSensorManager.setOrientationOffset(lpmsSensor, LpSensorManager.LPMS_OFFSET_MODE_HEADING);
        Debug.Log("Offset set");
        tracking = false;
        if (LpSensorManager.getConnectionStatus(lpmsSensor) == LpSensorManager.SENSOR_CONNECTION_CONNECTED)
        {
            SensorData sd;
            unsafe
            {
                sd = *((SensorData *)LpSensorManager.getSensorData(lpmsSensor));
            }
            last_sensor    = new Vector3(0, 0, 0);
            current_sensor = last_sensor;
        }
    }
    // Start is called before the first frame update
    void Start()

    {
        //default_rot = new Vector3((float)0.01, (float)0.01, (float)0.01);
        //transform.rotation = Quaternion.Euler(default_rot);
        Application.targetFrameRate = 20;
        // Initialize sensor manager
        LpSensorManager.initSensorManager();
        // connects to sensor
        LpSensorManager.connectToLpms(LpSensorManager.DEVICE_LPMS_B2, lpmsSensor);
        // Wait for establishment of sensor1 connection
        while (LpSensorManager.getConnectionStatus(lpmsSensor) != 1)
        {
            //System.Threading.Thread.Sleep(100);
        }
        if (LpSensorManager.getConnectionStatus(lpmsSensor) == 1)
        {
            Debug.Log("Sensor connected");
        }

        // Sets sensor offset
        LpSensorManager.setOrientationOffset(lpmsSensor, LpSensorManager.LPMS_OFFSET_MODE_HEADING);
        first_time     = true;
        last_sensor    = new Vector3(0, 0, 0);
        current_sensor = last_sensor;
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        offset = new Quaternion(0, 0, 0, 0);
        // Initialize sensor manager
        LpSensorManager.initSensorManager();

        // connects to sensor
        LpSensorManager.connectToLpms(LpSensorManager.DEVICE_LPMS_B2, lpmsSensor);

        // Wait for establishment of sensor1 connection
        while (LpSensorManager.getConnectionStatus(lpmsSensor) != 1)
        {
            //System.Threading.Thread.Sleep(100);
        }
        Debug.Log("Sensor connected");

        // Sets sensor offset
        LpSensorManager.setOrientationOffset(lpmsSensor, LpSensorManager.LPMS_OFFSET_MODE_HEADING);
        Debug.Log("Offset set");
    }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        // Initialize sensor manager
        dm = GameObject.Find("DataManager");
        if (dm != null)
        {
            Debug.Log("DataManager found!\n");
        }
        LpSensorManager.initSensorManager();

        // connects to sensor
        LpSensorManager.connectToLpms(LpSensorManager.DEVICE_LPMS_B2, lpmsSensor);

        // Wait for establishment of sensor1 connection
        while (LpSensorManager.getConnectionStatus(lpmsSensor) != 1)
        {
            System.Threading.Thread.Sleep(100);
        }
        Debug.Log("Sensor connected");

        // Sets sensor offset
        LpSensorManager.setOrientationOffset(lpmsSensor, LpSensorManager.LPMS_OFFSET_MODE_HEADING);
        Debug.Log("Offset set");
    }