// Update is called once per frame void Update() { switch (logStatus) { case LoggingStatus.Clear: buffer.Clear(); // clear buffer currentTime = 0.0f; // update current time break; case LoggingStatus.Active: // record data float[] row = new float[21]; currentTime += Time.deltaTime; row[0] = currentTime; // timestamp Vector3 handPosition = mplHand.transform.position; row[1] = handPosition.x; row[2] = handPosition.y; row[3] = handPosition.z; Quaternion handRotation = mplHand.transform.rotation; row[4] = handRotation.w; row[5] = handRotation.x; row[6] = handRotation.y; row[7] = handRotation.z; PHAM_ManagerPro.ObjectPrimitive currentPrimitive = manager.GetPrimitive(); Vector3 objPosition = objPrimitives[currentPrimitive].transform.position; row[8] = objPosition.x; row[9] = objPosition.y; row[10] = objPosition.z; Quaternion objRotation = objPrimitives[currentPrimitive].transform.rotation; row[11] = objRotation.w; row[12] = objRotation.x; row[13] = objRotation.y; row[14] = objRotation.z; row[15] = (float)arbiter.GetMovementState(); float[] forces = sensors.GetForceValues(); row[16] = forces[0]; row[17] = forces[1]; row[18] = forces[2]; row[19] = forces[3]; row[20] = forces[4]; // add to list buffer.Add(row); break; case LoggingStatus.Pause: break; } }
// Update is called once per frame void Update() { float [] joints = arbiter.GetRightUpperArmAngles(); float [] force = sensors.GetForceValues(); string new_text = string.Format("SHOULDER FLEXION: {0}\n", joints[0].ToString("F1")) + string.Format("SHOULDER ABDUCTION: {0}\n", joints[1].ToString("F1")) + string.Format("HUMERAL ROTATION: {0}\n", joints[2].ToString("F1")) + string.Format("ELBOW FLEXION: {0}\n", joints[3].ToString("F1")) + string.Format("WRIST ROTATION: {0}\n", joints[4].ToString("F1")) + string.Format("WRIST DEVIATION: {0}\n", joints[5].ToString("F1")) + string.Format("WRIST FLEXION: {0}\n", joints[6].ToString("F1")) + "\n-----------------------------------------\n\n" + string.Format("THUMB FORCE: {0}\n", force[0].ToString("F1")) + string.Format("INDEX FORCE: {0}\n", force[1].ToString("F1")) + string.Format("MIDDLE FORCE: {0}\n", force[2].ToString("F1")) + string.Format("RING FORCE: {0}\n", force[3].ToString("F1")) + string.Format("LITTLE FORCE: {0}\n", force[4].ToString("F1")); hud.text = new_text; }