コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     //Initialize
     csvData     = gameObject.AddComponent <CsvRead>();
     Play_button = GameObject.Find("PlayButton");
     script_play = Play_button.GetComponent <changeText>();
 }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     //Initialize
     csvData     = gameObject.AddComponent <CsvRead>();
     Play_button = GameObject.Find("PlayButton");
     Debug.Log(fileName);
     csvData.csvRead(fileName);
     for (int i = 0; i < csvData.csvDatas.Count; i++)
     {
         //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
         //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
         //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
         phi.Add(double.Parse(csvData.csvDatas[i][0]));
         theta.Add(double.Parse(csvData.csvDatas[i][1]));
         psi.Add(double.Parse(csvData.csvDatas[i][2]));
     }
 }
コード例 #3
0
    ////// //////

    // Start is called before the first frame update
    void Start()
    {
        //Initialize
        csvData     = gameObject.AddComponent <CsvRead>();
        Play_button = GameObject.Find("PlayButton");

        //////Add new codes//////
        RotationSpeed   = GameObject.Find("RotationSpeed");
        BoomerangStatus = GameObject.Find("BoomerangStatus");
        Inclination     = GameObject.Find("Inclination");
        ThrowingSpeed   = GameObject.Find("ThrowingSpeed");

        frame = 0;
        //read sensor data from csv file
        csvData.csvRead(acc_dataset);
        //Accelerometer unit is not mG
        for (int i = 0; i < csvData.csvDatas.Count; i++)
        {
            //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
            //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
            //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
            xAcc.Add(double.Parse(csvData.csvDatas[i][0]));
            yAcc.Add(double.Parse(csvData.csvDatas[i][1]));
            zAcc.Add(double.Parse(csvData.csvDatas[i][2]));
        }
        csvData.clearData();

        csvData.csvRead(gyro_dataset);
        for (int i = 0; i < csvData.csvDatas.Count; i++)
        {
            //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
            //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
            //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
            xGyro.Add(double.Parse(csvData.csvDatas[i][0]));
            yGyro.Add(double.Parse(csvData.csvDatas[i][1]));
            zGyro.Add(double.Parse(csvData.csvDatas[i][2]));
        }
        csvData.clearData();

        csvData.csvRead(mag_dataset);
        for (int i = 0; i < csvData.csvDatas.Count; i++)
        {
            //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
            //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
            //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
            xMag.Add(double.Parse(csvData.csvDatas[i][0]));
            yMag.Add(double.Parse(csvData.csvDatas[i][1]));
            zMag.Add(double.Parse(csvData.csvDatas[i][2]));
        }
        csvData.clearData();

        csvData.csvRead(euler_dataset);
        for (int i = 0; i < csvData.csvDatas.Count; i++)
        {
            //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
            //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
            //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
            phi.Add(double.Parse(csvData.csvDatas[i][0]));
            theta.Add(double.Parse(csvData.csvDatas[i][1]));
            psi.Add(double.Parse(csvData.csvDatas[i][2]));
        }

        AHRS = new AHRS.MadgwickAHRS(1f / 60f, 0.1f);

        ///////////////
    }
コード例 #4
0
    // Start is called before the first frame update
    void Start()
    {
        RotationSpeed   = GameObject.Find("RotationSpeed");
        BoomerangStatus = GameObject.Find("BoomerangStatus");
        Inclination     = GameObject.Find("Inclination");
        ThrowingSpeed   = GameObject.Find("ThrowingSpeed");
        if (isBluetooth)
        {
            //setting to receive data sent from device
        }
        else
        {
            //Initialize
            csvData     = gameObject.AddComponent <CsvRead>();
            Play_button = GameObject.Find("PlayButton");
            script_play = Play_button.GetComponent <changeText>();
            frame       = 0;

            //read sensor data from csv file
            csvData.csvRead(acc_dataset);
            for (int i = 0; i < csvData.csvDatas.Count; i++)
            {
                //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
                //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
                //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
                xAcc.Add(double.Parse(csvData.csvDatas[i][0]));
                yAcc.Add(double.Parse(csvData.csvDatas[i][1]));
                zAcc.Add(double.Parse(csvData.csvDatas[i][2]));
            }
            csvData.clearData();
            csvData.csvRead(gyro_dataset);
            for (int i = 0; i < csvData.csvDatas.Count; i++)
            {
                //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
                //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
                //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
                xGyro.Add(double.Parse(csvData.csvDatas[i][0]));
                yGyro.Add(double.Parse(csvData.csvDatas[i][1]));
                zGyro.Add(double.Parse(csvData.csvDatas[i][2]));
            }
            csvData.clearData();
            csvData.csvRead(mag_dataset);
            for (int i = 0; i < csvData.csvDatas.Count; i++)
            {
                //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
                //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
                //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
                xMag.Add(double.Parse(csvData.csvDatas[i][0]));
                yMag.Add(double.Parse(csvData.csvDatas[i][1]));
                zMag.Add(double.Parse(csvData.csvDatas[i][2]));
            }
            csvData.clearData();
            csvData.csvRead(euler_dataset);
            for (int i = 0; i < csvData.csvDatas.Count; i++)
            {
                //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
                //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
                //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
                phi.Add(double.Parse(csvData.csvDatas[i][0]));
                theta.Add(double.Parse(csvData.csvDatas[i][1]));
                psi.Add(double.Parse(csvData.csvDatas[i][2]));
            }
        }
    }
コード例 #5
0
    // Start is called before the first frame update
    void Start()
    {
        //Initialize
        csvData     = gameObject.AddComponent <CsvRead>();
        Play_button = GameObject.Find("PlayButton");

        //////Add new codes//////
        RotationSpeed   = GameObject.Find("RotationSpeed");
        BoomerangStatus = GameObject.Find("BoomerangStatus");
        Inclination     = GameObject.Find("Inclination");
        ThrowingSpeed   = GameObject.Find("ThrowingSpeed");

        frame = 0;
        //read sensor data from csv file
        csvData.csvRead(acc_dataset);
        //Accelerometer unit is not mG
        for (int i = 0; i < csvData.csvDatas.Count; i++)
        {
            //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
            //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
            //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
            xAcc.Add(double.Parse(csvData.csvDatas[i][0]));
            yAcc.Add(double.Parse(csvData.csvDatas[i][1]));
            zAcc.Add(double.Parse(csvData.csvDatas[i][2]));
        }
        csvData.clearData();

        csvData.csvRead(gyro_dataset);
        for (int i = 0; i < csvData.csvDatas.Count; i++)
        {
            //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
            //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
            //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
            xGyro.Add(double.Parse(csvData.csvDatas[i][0]));
            yGyro.Add(double.Parse(csvData.csvDatas[i][1]));
            zGyro.Add(double.Parse(csvData.csvDatas[i][2]));
        }
        csvData.clearData();

        csvData.csvRead(mag_dataset);
        for (int i = 0; i < csvData.csvDatas.Count; i++)
        {
            //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
            //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
            //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
            xMag.Add(double.Parse(csvData.csvDatas[i][0]));
            yMag.Add(double.Parse(csvData.csvDatas[i][1]));
            zMag.Add(double.Parse(csvData.csvDatas[i][2]));
        }
        csvData.clearData();

        csvData.csvRead(euler_dataset);
        for (int i = 0; i < csvData.csvDatas.Count; i++)
        {
            //Debug.Log("csv data[0]: " + csvData.csvDatas[i][0]);
            //Debug.Log("[1]: "+csvData.csvDatas[i][1]);
            //Debug.Log("[2]: " + csvData.csvDatas[i][2]);
            phi.Add(double.Parse(csvData.csvDatas[i][0]));
            theta.Add(double.Parse(csvData.csvDatas[i][1]));
            psi.Add(double.Parse(csvData.csvDatas[i][2]));
        }

        AHRS = new AHRS.MadgwickAHRS(1f / 60f, 0.1f);

        Text    = GameObject.Find("debugText");
        message = GameObject.Find("message").GetComponent <InputField>();
        //connect BLE
        BLE = new AndroidJavaObject("fr.boomerang.takumi.ble_module.BLE", this.gameObject.name, "received");
        Text.GetComponent <Text>().text = "Create BLE  AndroidJavaObject";
        ///////////////
    }