Commit 941132b0 authored by Harshith Goka's avatar Harshith Goka

Final

parent 6be90ce3
......@@ -20,6 +20,10 @@ class LagQueue{
liveElement = new Live[noOfSlots];
for (int i=0; i<noOfSlots; i++) {
liveElement[i] = new Live();
}
shortlist = new boolean[noOfGestures];
for (int j=0; j<noOfGestures; j++) {
......@@ -73,15 +77,24 @@ class LagQueue{
}
public void arrayPrint(int [][]arr){
for (int j=0; j<arr[0].length; j++) {
for (int i=0; i<arr.length; i++) {
System.out.print(arr[i][j] + " ");
}
System.out.println();
}
}
public int[][] liveTempArrayComp(int slotNo, int gestNo){
int[][] x = new int[latestElement - (lowerBoundary + slotNo)][gesture[gestNo].getConsiderCount()];
int[][] x = new int[ - (lowerBoundary + slotNo)][gesture[gestNo].getConsiderCount()];
int index = 0;
for (int i=0; i<liveElement[slotNo].sensors; i++){
if(gesture[gestNo].consider[i]){
for (int j = lowerBoundary + slotNo + latestElement; j < latestElement; j++) {
x[j - (lowerBoundary + slotNo + latestElement)][index] = liveElement[j].reading[i]; //gesture[gestNo].point[j][i];
for (int j = 0; j < - slotNo - lowerBoundary; j++) {
x[j][index] = liveElement[j + latestElement + lowerBoundary].reading[i]; //gesture[gestNo].point[j][i];
}
index++;
}
......@@ -120,12 +133,13 @@ class LagQueue{
DTW x;
int [][] gestarraytemp = validSensorArrayComp(gestNo);
//arrayPrint(gestarraytemp);
// arrayPrint(gestarraytemp);
//System.out.println();
for (int i = 0; i < upperBoundary - lowerBoundary; i++) {
x = new DTWtwoD();
int [][] arraytemp = liveTempArrayComp(i, gestNo);
x.arrayInput(gestarraytemp, arraytemp);
//dtwGap[slotNo][i].add( Math.max( 0.0, (x.sdtwDistance() + dtwGap[slotNo][i].size()*alterFactor)) );
dtwValues[i] = x.dtwDistance();
......@@ -147,12 +161,13 @@ class LagQueue{
else shortlist[i] = false;
}
if(getShortlistCount()==0) latestElement = (latestElement+1)%noOfSlots;
if(getShortlistCount()==0){} //latestElement = (latestElement+1)%noOfSlots;
else if(getShortlistCount()==1) {
//gesture execute
System.out.println(firstShortlistGestureIndex());
return firstShortlistGestureIndex();
}
overflowCheck();
return -1;
}
......@@ -166,6 +181,7 @@ class LagQueue{
}
System.out.print('\n');
}
System.out.println(latestElement);
gestureStatusPrint();
}
......@@ -173,20 +189,12 @@ class LagQueue{
public void gestureStatusPrint(){
System.out.print('\n');
System.out.println("DTW Status:");
for (int i=0; i<noOfGestures; i++) {
System.out.print("Gesture " + i + " : " + minDtwGap[i]);
System.out.print('\n');
System.out.print(minDtwGap[i] + " ");
}
// System.out.println("Gesture Status:");
// for (int i=0; i<noOfGestures; i++) {
// for (int j=0; j<noOfSlots; j++) {
//
// int d=0;
// if(shortlist[j][i]) d=1;
// System.out.print(d + " ");
// }
// System.out.print('\n');
// }
// System.out.println(foremostElement + " " + latestElement);
System.out.print('\n');
}
}
\ No newline at end of file
......@@ -182,7 +182,7 @@ public class ReceiveDataThread extends Thread {
threshold[indx] = 40;
threshold = new int[]{0,0,0,0,0,0,0,0,0,0,0,0};
threshold = new int[]{10,10,10,10,10,10,10,10,10,10,10,10};
LagQueue q = new LagQueue(a,threshold);
Live dynamiclive = new Live();
......@@ -204,11 +204,11 @@ public class ReceiveDataThread extends Thread {
q.processQueue();
i = q.proceedExecution();
if (i != -1) {
Looper.prepare();
// Looper.prepare();
// handler.sendMessageDelayed(handler.obtainMessage(Constants.READ_STATUS, readStatus, i, null), 10000);
L.m("Gesture " + i + " is executed");
q.gestureStatusPrint();
Looper.loop();
// Looper.loop();
}
}
counter++;
......@@ -279,7 +279,7 @@ public class ReceiveDataThread extends Thread {
public int[][] readingsGenerate(int[] low,int[] high){
int size=0;
for(int i=0;i<low.length;i++){
int diff=high[i]-low[i];
int diff=Math.abs(high[i]-low[i]);
if(diff>size){
size=diff;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment