Cubic Hand project for EECS 249A course.

Dependencies:   MMA8451Q TSI cc3000_hostdriver_mbedsocket NVIC_set_all_priorities mbed Multi_WS2811

Committer:
kalbers
Date:
Thu Dec 11 06:44:30 2014 +0000
Revision:
35:b6fb5dd65a98
Parent:
32:bf5f545621aa
Child:
37:996bd22a633f
Fixed Merge Issues

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kalbers 3:5f5d75cba8e1 1 #include "GloveWifi.h"
kalbers 3:5f5d75cba8e1 2
kalbers 13:c701f1122797 3 #pragma once
kalbers 13:c701f1122797 4
naren 14:0c4a26dc6873 5 struct Glove {
naren 14:0c4a26dc6873 6 double roll;
naren 14:0c4a26dc6873 7 double pitch;
naren 14:0c4a26dc6873 8 double yaw;
naren 14:0c4a26dc6873 9 double fingers[5];
naren 14:0c4a26dc6873 10 double gyro[3];
naren 14:0c4a26dc6873 11 double magn[3];
naren 14:0c4a26dc6873 12 double accel[3];
naren 14:0c4a26dc6873 13 int lastPkgTime;
naren 14:0c4a26dc6873 14 };
naren 14:0c4a26dc6873 15
kalbers 3:5f5d75cba8e1 16 class DataGlove
kalbers 3:5f5d75cba8e1 17 {
kalbers 35:b6fb5dd65a98 18 public:
kalbers 35:b6fb5dd65a98 19 DataGlove();
kalbers 35:b6fb5dd65a98 20 ~DataGlove();
kalbers 35:b6fb5dd65a98 21 void Init();
kalbers 35:b6fb5dd65a98 22 bool Receive();
kalbers 35:b6fb5dd65a98 23 Glove ReceiveBlocking();
kalbers 35:b6fb5dd65a98 24
kalbers 35:b6fb5dd65a98 25 //Returns the latest glove values in a structure.
kalbers 35:b6fb5dd65a98 26 Glove GetCurrentValues();
kalbers 35:b6fb5dd65a98 27 //Returns true if new data since last function call, false otherwise.
kalbers 35:b6fb5dd65a98 28 bool CheckForNewValues();
kalbers 35:b6fb5dd65a98 29
kalbers 3:5f5d75cba8e1 30 int16_t finger1, finger2, finger3, finger4, finger5;
kalbers 3:5f5d75cba8e1 31 int16_t accelx, accely, accelz;
kalbers 3:5f5d75cba8e1 32 int16_t gyrox, gyroy, gyroz;
kalbers 3:5f5d75cba8e1 33
kalbers 35:b6fb5dd65a98 34 private:
kalbers 3:5f5d75cba8e1 35 uint8_t SendBuf[20];
kalbers 3:5f5d75cba8e1 36 int16_t notConnectedCount;
kalbers 35:b6fb5dd65a98 37 long numReceived;
kalbers 35:b6fb5dd65a98 38 char Buf[256], buffer[256];
kalbers 35:b6fb5dd65a98 39 bool raw;
kalbers 35:b6fb5dd65a98 40 unsigned char bcc;
kalbers 35:b6fb5dd65a98 41 int pkglen, u;
kalbers 35:b6fb5dd65a98 42 int timeOfArrival, id, pkgtype;
kalbers 35:b6fb5dd65a98 43 int j, k, y;
kalbers 35:b6fb5dd65a98 44 double roll, yaw, pitch;
kalbers 35:b6fb5dd65a98 45 double norm, test;
kalbers 35:b6fb5dd65a98 46 int q0, q1, q2, q3;
kalbers 35:b6fb5dd65a98 47 double q00, q11, q22, q33;
kalbers 35:b6fb5dd65a98 48 long ReceiveCount;
kalbers 35:b6fb5dd65a98 49 bool NewData;
kalbers 35:b6fb5dd65a98 50 // Stores glove data
kalbers 35:b6fb5dd65a98 51 Glove *gl;
kalbers 35:b6fb5dd65a98 52 // Stores the correction matrix
kalbers 35:b6fb5dd65a98 53 Glove *correction;
kalbers 35:b6fb5dd65a98 54 // Stores the corrected glove values
kalbers 35:b6fb5dd65a98 55 Glove *corrected;
kalbers 3:5f5d75cba8e1 56 GloveWifi GloveSocket;
kalbers 18:6737bf53ccd1 57
kalbers 18:6737bf53ccd1 58 private:
kalbers 35:b6fb5dd65a98 59 void Parse();
kalbers 35:b6fb5dd65a98 60 void StreamData(uint8_t DataType);
kalbers 35:b6fb5dd65a98 61 void StopSampling();
kalbers 35:b6fb5dd65a98 62 void ExtractFingersQuat();
kalbers 35:b6fb5dd65a98 63 void ExtractQuat();
kalbers 35:b6fb5dd65a98 64 void ExtractFingersRaw();
kalbers 35:b6fb5dd65a98 65 void ExtractRaw();
kalbers 35:b6fb5dd65a98 66 void ExtractFingers();
kalbers 3:5f5d75cba8e1 67 };