void Start() { if (!ovrIsInitialized) { DisplayedPosition = new Vector3(0.0f, 1.0f, 0.0f); OVR_Initialize(); ovrIsInitialized = true; //AHRS = new AHRS.MadgwickAHRS(1f / 75f, 0.1f); AHRS = new AHRS.MadgwickAHRS(1f / 75f, 0.033f); } }
public Form1() { InitializeComponent(); glControl.InitializeContexts(); imu = new MadgwickAHRS(0.02F, 1.0F); Q = new float[4]; Q[0] = 0; Q[1] = 0; Q[2] = 0; Q[3] = 1; M = new float[16]; M[0] = 1; M[1] = 0; M[2] = 0; M[3] = 0; M[4] = 0; M[5] = 1; M[6] = 0; M[7] = 0; M[8] = 0; M[9] = 0; M[10] = 1; M[11] = 0; M[12] = 0; M[13] = 0; M[14] = 0; M[15] = 1; x = 0; _sampleTime = new long[100]; data_receiver.RunWorkerAsync(); Ax_series = new Series("Ax"); Ax_series.ChartType = SeriesChartType.Line; Ay_series = new Series("Ay"); Ay_series.ChartType = SeriesChartType.Line; Az_series = new Series("Az"); Az_series.ChartType = SeriesChartType.Line; chartAcc.Series.Clear(); chartAcc.Series.Add(Ax_series); chartAcc.Series.Add(Ay_series); chartAcc.Series.Add(Az_series); }
void Start() { style = new GUIStyle(); style.normal.textColor = Color.black; int count = MoveManager.GetNumConnected(); for (int i = 0; i < count; i++) { MoveManager move = gameObject.AddComponent <MoveManager>(); if (!move.Init(i)) { Destroy(move); continue; } PSMoveConnectionType conn = move.ConnectionType; if (conn == PSMoveConnectionType.Unknown || conn == PSMoveConnectionType.USB) { Destroy(move); } else { moves.Add(move); move.OnControllerDisconnected += HandleControllerDisconnected; move.SetLED(Color.cyan); DisplayedPosition = new Vector3(0.0f, 1.0f, 0.0f); TransformMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one); // The proposed algorithm’s adjustable parameter, ß, was set to 0.033 for the MARG // implementation and 0.041 for the IMU implementation. //AHRS = new AHRS.MadgwickAHRS(1f / 75f, 0.1f); AHRS = new AHRS.MadgwickAHRS(1f / 75f, 0.033f); } } }
////// ////// // 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); /////////////// }
// 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"; /////////////// }