Cubic Hand project for EECS 249A course.
Dependencies: MMA8451Q TSI cc3000_hostdriver_mbedsocket NVIC_set_all_priorities mbed Multi_WS2811
Diff: DataGlove.cpp
- Revision:
- 37:996bd22a633f
- Parent:
- 35:b6fb5dd65a98
- Parent:
- 36:4a58639da6cf
- Child:
- 41:367cab0162de
diff -r b6fb5dd65a98 -r 996bd22a633f DataGlove.cpp --- a/DataGlove.cpp Thu Dec 11 06:44:30 2014 +0000 +++ b/DataGlove.cpp Thu Dec 11 07:08:47 2014 +0000 @@ -99,11 +99,7 @@ id = (Buf[4] << 8) + Buf[5]; pkgtype = Buf[3]; ReceiveCount++; - /*if(ReceiveCount > 501 && ReceiveCount%25 == 0) {//printf("%d %c\r\n", ReceiveCount, Buf[0]); - printf("%f %f %f %f %f %f %f %f\r\n", corrected->roll, corrected->pitch, corrected->yaw, - corrected->fingers[0], corrected->fingers[1], corrected->fingers[2], - corrected->fingers[3], corrected->fingers[4]); - }*/ + switch (pkgtype){ case STREAM_FINGERS_QUATERNION: { @@ -144,21 +140,6 @@ notConnectedCount++; } } - // Normalize the data for the first 1000 samples - /*if (ReceiveCount < 500) { - correction->roll = (correction->roll*ReceiveCount + gl->roll)/(ReceiveCount+1); - correction->pitch = (correction->pitch*ReceiveCount + gl->pitch)/(ReceiveCount+1); - correction->yaw = (correction->yaw*ReceiveCount + gl->yaw)/(ReceiveCount+1); - for (int iter = 0; iter < 5; iter++) - correction->fingers[iter] = (correction->fingers[iter]*ReceiveCount + gl->fingers[iter])/(ReceiveCount+1); - } - else { - corrected->roll = gl->roll - correction->roll; - corrected->pitch = gl->pitch - correction->pitch; - corrected->yaw = gl->yaw - correction->yaw; - for (int iter = 0; iter < 5; iter++) - corrected->fingers[iter] = gl->fingers[iter] - correction->fingers[iter]; - }*/ } else { //printf("couldn't get data %d\r\n", notConnectedCount);