/// <summary> /// Copy the given raw data into this ApolloHandData. /// Data present in hand data but not in the raw data (e.g. processed IMU data) will not be altered. /// </summary> /// <param name="input">The joint data to copy.</param> public void SetRawData(ApolloRawData input) { endpointID = input.endpointID; deviceID = input.deviceID; rawWristImu = input.imus[0]; rawThumbImu = input.imus[1]; for (int fingerNum = 0; fingerNum < fingers.Length; fingerNum++) { for (int segmentNum = 0; segmentNum < fingers[fingerNum].flexSensorRaw.Length; segmentNum++) { fingers[fingerNum].flexSensorRaw[segmentNum] = input.flex((fingerNum * ApolloHandData.numFlexSensorSegmentsPerFinger) + segmentNum); } } }
private static void NewRawData(ApolloRawData data, GloveLaterality side) { //Log("Received new raw data for a " + side + " glove with device ID " + data.deviceID + "."); // Get ready to store the new data. int playerIndex = -1; device_type_t deviceType = device_type_t.GLOVE_LEFT; if (!PrepareForNewData(data.IsValid, side, data.deviceID, out playerIndex, out deviceType)) { // Failed to prepare for the new data. The new data cannot be stored. // Printing a log message is done in the function, so don't print anything here. return; } // Set the data. playerData[playerIndex].handData[deviceType].SetRawData(data); }