Commit 9e74a840 authored by Harshith Goka's avatar Harshith Goka

in process of debugging

parent 9908764b
...@@ -3,7 +3,7 @@ package com.example.harshith.ddc; ...@@ -3,7 +3,7 @@ package com.example.harshith.ddc;
import java.util.Scanner; import java.util.Scanner;
class DTW{ class DTW{
public int m; public int n; public int m; public int n,w;
public int [][]distance; public int [][]minAccDist; public int [][]distance; public int [][]minAccDist;
public void arrayInput(int []arr1, int []arr2){ public void arrayInput(int []arr1, int []arr2){
...@@ -38,10 +38,15 @@ class DTW{ ...@@ -38,10 +38,15 @@ class DTW{
distanceProcess(); distanceProcess();
minAccDist = new int[m][n]; minAccDist = new int[m][n];
for(int i = 0;i < m; i++){
for(int j = 0 ; j < n;j++){
minAccDist[i][j] = 0;
}
}
minAccDist[0][0] = distance[0][0]; minAccDist[0][0] = distance[0][0];
int w = 65536; // set window here w = 2000000; // set window here
w=Math.max(w,Math.abs(m-n)); w=Math.max(w,Math.abs(m-n));
for (int i=1; i<Math.min(m,w); i++) { for (int i=1; i<Math.min(m,w); i++) {
......
...@@ -2,11 +2,12 @@ package com.example.harshith.ddc; ...@@ -2,11 +2,12 @@ package com.example.harshith.ddc;
class DynamicGesture extends Gesture { class DynamicGesture extends Gesture {
public int dataPoints = 5; public int dataPoints;
public int [][] point; public int [][] point;
public boolean [] consider; public boolean [] consider;
public DynamicGesture(){ public DynamicGesture(int dataPt){
dataPoints = dataPt;
point = new int [dataPoints][sensors]; point = new int [dataPoints][sensors];
consider = new boolean[sensors]; consider = new boolean[sensors];
/*for (int i=0; i<sensors; i++) { /*for (int i=0; i<sensors; i++) {
......
...@@ -3,26 +3,59 @@ package com.example.harshith.ddc; ...@@ -3,26 +3,59 @@ package com.example.harshith.ddc;
class DynamicPrime{ class DynamicPrime{
public static void main(String [] args){ public static void main(String [] args){
int noOfGestures = 2; int noOfGestures = 1;
int indx; int [][]array;
DynamicGesture []a = new DynamicGesture[noOfGestures]; DynamicGesture []a = new DynamicGesture[noOfGestures];
for (int i = 0; i<noOfGestures; i++) {
a[i] = new DynamicGesture();
}
int [][]array = new int[5][11]; // initialising the 10 gestures
indx=0;
array = new int[][]
{
{ 90, 96, 92, 94, 100, 1942, 16036, -988, 1736, 15926, -528 },
{ 90, 96, 90, 92, 98, 1100, 16096, -282, 906, 16284, -164 },
{ 85, 96, 90, 92, 96, 914, 16214, -54, 1274, 16238, -236 } ,
{ 85, 94, 90, 89, 96, 1328, 16078, -82, 1184, 16408, -256 },
{ 80, 92, 88, 86, 94, 1004, 16016, -158, 1184, 15968, -346 },
{ 80, 90, 86, 81, 93, 1262, 15804, -176, 952, 15616, 38 },
{ 76, 88, 82, 76, 87, 854, 15820, 462, 940, 16080, 434 },
{ 71, 79, 74, 71, 84, 766, 16722, -90, 536, 16004, 60 },
{ 66, 73, 69, 65, 75, 922, 15938, 190, 1164, 16170, 210 },
{ 61, 67, 66, 60, 70, 1498, 16074, 286, 1134, 16042, 566 },
{ 61, 66, 62, 60, 65, 432, 16230, 766, 432, 16310, 706 },
{ 57, 62, 60, 55, 63, 916, 16092, 410, 778, 15850, 572 },
{ 57, 58, 58, 52, 58, 632, 15824, 790, 552, 16034, 872 },
{ 57, 56, 54, 50, 55, 690, 16208, 1040, 694, 16132, 954 },
{ 57, 52, 50, 47, 51, 644, 16104, 1136, 848, 15788, 886 },
{ 52, 49, 48, 44, 48, 900, 15890, 964, 818, 16166, 1006 },
{ 52, 45, 45, 39, 44, 790, 16286, 828, 894, 16004, 802 },
{ 47, 39, 40, 34, 41, 816, 15534, 670, 724, 15856, 864 },
{ 47, 32, 36, 31, 36, 692, 16274, 904, 800, 16146, 688 },
{ 42, 26, 30, 28, 32, 1204, 16032, 432, 1104, 15924, 382 },
{ 38, 20, 24, 23, 27, 862, 16080, 594, 308, 16028, 1072 },
{ 38, 16, 18, 18, 22, -192, 16002, 1148, 268, 15918, 1264 },
{ 33, 15, 14, 15, 17, 1284, 15888, 976, 1402, 15924, 1044 },
{ 28, 11, 10, 13, 10, 924, 16046, 1116, 668, 16112, 1078 },
{ 28, 9, 8, 10, 5, 602, 16180, 1292, 682, 16202, 1216 },
{ 28, 7, 6, 7, 5, 906, 15948, 442, 1234, 15856, 44 },
{ 19, 5, 2, 7, 1, 890, 16172, 672, 1072, 16340, 1196 },
{ 23, 5, 2, 5, 0, 1444, 16062, 1072, 1404, 16024, 490 },
{ 19, 3, 1, 5, 0, 1458, 15990, 328, 1244, 15848, 564 },
{ 14, 1, 0, 5, 0, 992, 16100, 1092, 1328, 15836, 1134 },
{ 14, 1, 0, 2, 0, 1708, 15950, 874, 1552, 15876, 1024 },
{ 4, 1, 0, 0, 0, 1410, 16110, 1012, 1334, 16220, 926 },
{ 0, 1, 0, 0, 0, 1814, 16118, 702, 2076, 16140, 674 },
{ 4, 3, 0, 0, 0, 2062, 16094, 438, 1614, 16294, 406 }
};
a[indx] = new DynamicGesture(array.length);
int []cons = new int[11]; int []cons = new int[11];
for (int i=0; i<5; i++) { cons = new int[] {1,1,1,1,1,0,0,0,0,1,0};
for (int j=0; j<5; j++) { a[indx].updateFrame(array,cons);
array[i][j] = i*2; a[indx].printData();
}
}
//cons = new int[] {1,1,1,1,1,0,0,0,0,0,0};
cons = new int[] {1,1,1,1,1,1,1,1,1,1,1};
a[0].updateFrame(array,cons);
a[0].printData();
int [][]array2 = new int[5][11];
/*int [][]array2 = new int[5][11];
int []cons2 = new int[11]; int []cons2 = new int[11];
for (int i=0; i<5; i++) { for (int i=0; i<5; i++) {
for (int j=0; j<11; j=j+2) { for (int j=0; j<11; j=j+2) {
...@@ -34,14 +67,12 @@ class DynamicPrime{ ...@@ -34,14 +67,12 @@ class DynamicPrime{
} }
cons2 = new int[] {1,1,1,1,1,0,0,0,1,0,0}; cons2 = new int[] {1,1,1,1,1,0,0,0,1,0,0};
a[1].updateFrame(array2,cons2); a[1].updateFrame(array2,cons2);
a[1].printData(); a[1].printData();*/
// initialising the 10 gestures
DynamicQueue q = new DynamicQueue(a); DynamicQueue q = new DynamicQueue(a);
Live dynamiclive = new Live(); Live dynamiclive = new Live();
//dynamiclive.update(100);
q.foremostElement = 0; q.foremostElement = 0;
for (int i=0; i<5; i++) { for (int i=0; i<5; i++) {
dynamiclive.update(i*2); dynamiclive.update(i*2);
......
package com.example.harshith.ddc; package com.example.harshith.ddc;
class DynamicQueue{ class DynamicQueue{
public int noOfSlots = 5000; public int noOfSlots = 2000;
public int noOfGestures; public int noOfGestures;
public DynamicGesture [] gesture; public DynamicGesture [] gesture;
public int [][] dtwGap; public int [][] dtwGap;
...@@ -110,7 +110,7 @@ class DynamicQueue{ ...@@ -110,7 +110,7 @@ class DynamicQueue{
} }
public void processLive(int slotNo, int livesTailNo){ public void processLive(int slotNo, int livesTailNo){
int threshold = 5; int threshold = 30;
DTW x; DTW x;
...@@ -140,6 +140,7 @@ class DynamicQueue{ ...@@ -140,6 +140,7 @@ class DynamicQueue{
if(getShortlistCount(i)==0) foremostElement = (foremostElement+1)%noOfSlots; if(getShortlistCount(i)==0) foremostElement = (foremostElement+1)%noOfSlots;
else if(getShortlistCount(i)==1) { else if(getShortlistCount(i)==1) {
//gesture execute //gesture execute
System.out.println(foremostElement);
return firstShortlistGestureIndex(foremostElement); return firstShortlistGestureIndex(foremostElement);
// foremostElement = (foremostElement+1)%noOfSlots; // foremostElement = (foremostElement+1)%noOfSlots;
} }
...@@ -171,16 +172,16 @@ class DynamicQueue{ ...@@ -171,16 +172,16 @@ class DynamicQueue{
} }
System.out.print('\n'); System.out.print('\n');
} }
System.out.println("Gesture Status:"); // System.out.println("Gesture Status:");
for (int i=0; i<noOfGestures; i++) { // for (int i=0; i<noOfGestures; i++) {
for (int j=0; j<noOfSlots; j++) { // for (int j=0; j<noOfSlots; j++) {
//
int d=0; // int d=0;
if(shortlist[j][i]) d=1; // if(shortlist[j][i]) d=1;
System.out.print(d + " "); // System.out.print(d + " ");
} // }
System.out.print('\n'); // System.out.print('\n');
} // }
System.out.println(foremostElement + " " + latestElement); // System.out.println(foremostElement + " " + latestElement);
} }
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ import android.os.Looper; ...@@ -6,6 +6,7 @@ import android.os.Looper;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.logging.LoggingPermission;
/** /**
* Created by harshith on 17/6/16. * Created by harshith on 17/6/16.
...@@ -36,40 +37,88 @@ public class ReceiveDataThread extends Thread { ...@@ -36,40 +37,88 @@ public class ReceiveDataThread extends Thread {
inputStream = tempIn; inputStream = tempIn;
int noOfGestures = 2; int noOfGestures = 2;
int indx; int [][]array;
DynamicGesture []a = new DynamicGesture[noOfGestures]; DynamicGesture []a = new DynamicGesture[noOfGestures];
for (int i = 0; i<noOfGestures; i++) {
a[i] = new DynamicGesture();
}
int [][]array = new int[5][11];
int []cons = new int[11];
for (int i=0; i<5; i++) {
for (int j=0; j<5; j++) {
array[i][j] = i*2;
}
}
//cons = new int[] {1,1,1,1,1,0,0,0,0,0,0};
cons = new int[] {1,1,1,1,1,1,1,1,1,1,1};
a[0].updateFrame(array,cons);
a[0].printData();
int [][]array2 = new int[5][11];
int []cons2 = new int[11];
for (int i=0; i<5; i++) {
for (int j=0; j<11; j=j+2) {
array2[i][j] = i*2;
}
for (int j=1; j<11; j=j+2) {
array2[i][j] = 0;
}
}
cons2 = new int[] {1,1,1,1,1,0,0,0,1,0,0};
a[1].updateFrame(array2,cons2);
a[1].printData();
// initialising the 10 gestures // initialising the 10 gestures
indx=0;
// array = new int[][]
// {
// { 90, 96, 92, 94, 100, 1942, 16036, -988, 1736, 15926, -528 },
// { 90, 96, 90, 92, 98, 1100, 16096, -282, 906, 16284, -164 },
// { 85, 96, 90, 92, 96, 914, 16214, -54, 1274, 16238, -236 } ,
// { 85, 94, 90, 89, 96, 1328, 16078, -82, 1184, 16408, -256 },
// { 80, 92, 88, 86, 94, 1004, 16016, -158, 1184, 15968, -346 },
// { 80, 90, 86, 81, 93, 1262, 15804, -176, 952, 15616, 38 },
// { 76, 88, 82, 76, 87, 854, 15820, 462, 940, 16080, 434 },
// { 71, 79, 74, 71, 84, 766, 16722, -90, 536, 16004, 60 },
// { 66, 73, 69, 65, 75, 922, 15938, 190, 1164, 16170, 210 },
// { 61, 67, 66, 60, 70, 1498, 16074, 286, 1134, 16042, 566 },
// { 61, 66, 62, 60, 65, 432, 16230, 766, 432, 16310, 706 },
// { 57, 62, 60, 55, 63, 916, 16092, 410, 778, 15850, 572 },
// { 57, 58, 58, 52, 58, 632, 15824, 790, 552, 16034, 872 },
// { 57, 56, 54, 50, 55, 690, 16208, 1040, 694, 16132, 954 },
// { 57, 52, 50, 47, 51, 644, 16104, 1136, 848, 15788, 886 },
// { 52, 49, 48, 44, 48, 900, 15890, 964, 818, 16166, 1006 },
// { 52, 45, 45, 39, 44, 790, 16286, 828, 894, 16004, 802 },
// { 47, 39, 40, 34, 41, 816, 15534, 670, 724, 15856, 864 },
// { 47, 32, 36, 31, 36, 692, 16274, 904, 800, 16146, 688 },
// { 42, 26, 30, 28, 32, 1204, 16032, 432, 1104, 15924, 382 },
// { 38, 20, 24, 23, 27, 862, 16080, 594, 308, 16028, 1072 },
// { 38, 16, 18, 18, 22, -192, 16002, 1148, 268, 15918, 1264 },
// { 33, 15, 14, 15, 17, 1284, 15888, 976, 1402, 15924, 1044 },
// { 28, 11, 10, 13, 10, 924, 16046, 1116, 668, 16112, 1078 },
// { 28, 9, 8, 10, 5, 602, 16180, 1292, 682, 16202, 1216 },
// { 28, 7, 6, 7, 5, 906, 15948, 442, 1234, 15856, 44 },
// { 19, 5, 2, 7, 1, 890, 16172, 672, 1072, 16340, 1196 },
// { 23, 5, 2, 5, 0, 1444, 16062, 1072, 1404, 16024, 490 },
// { 19, 3, 1, 5, 0, 1458, 15990, 328, 1244, 15848, 564 },
// { 14, 1, 0, 5, 0, 992, 16100, 1092, 1328, 15836, 1134 },
// { 14, 1, 0, 2, 0, 1708, 15950, 874, 1552, 15876, 1024 },
// { 4, 1, 0, 0, 0, 1410, 16110, 1012, 1334, 16220, 926 },
// { 0, 1, 0, 0, 0, 1814, 16118, 702, 2076, 16140, 674 },
// { 4, 3, 0, 0, 0, 2062, 16094, 438, 1614, 16294, 406 }
// };
array = new int[101][11];
for (int i = 0; i != 101;i++){
for (int j = 0; j != 5;j++){
array[i][j] = i;
}
array[i][9] = 16000;
}
a[indx] = new DynamicGesture(array.length);
int []cons = new int[11];
cons = new int[] {1,1,1,1,1,0,0,0,0,1,0};
a[indx].updateFrame(array,cons);
a[indx].printData();
indx = 1;
array = new int[][]
{
{ 4, 83, 88, 94, 94, 882, 2844, 14294, 206, 1894, 15050 },
{ 0, 81, 86, 94, 93, -750, 1270, 15836, -912, 1604, 15940 },
{ 0, 81, 85, 94, 93, 592, 3026, 14660, 628, 2050, 14218 },
{ 0, 81, 85, 94, 91, -526, 2094, 15172, -858, 1784, 15512 },
{ 4, 81, 85, 94, 93, -220, 1838, 14926, 352, 2142, 14472 },
{ 4, 81, 82, 94, 91, -264, 2630, 13686, -1984, 2526, 13590 },
{ 4, 81, 82, 92, 91, -4724, 2896, 13010, -8502, 4158, 10682 },
{ 4, 79, 84, 92, 91, -19204, 7996, 7284, -30724, 8484, 6058 },
{ 4, 79, 85, 92, 91, -32768, 4418, 8706, -32768, -274, 12506 },
{ 4, 79, 85, 89, 91, -32768, -5068, 17128, -32768, -10092, 20266 },
{ 4, 79, 82, 86, 87, -16616, -12792, 21146, -1464, -14152, 18000 },
{ 4, 79, 82, 89, 87, 9646, -17732, 18678, 15100, -21382, 22950 },
{ 4, 77, 82, 92, 87, 30192, -22396, 24002, 32767, -16526, 22208 },
{ 9, 77, 81, 92, 87, 27054, -8232, 18114, 20222, -5738, 15942 },
{ 9, 77, 82, 92, 87, 15016, -5922, 16380, 11628, -5202, 17620 },
{ 9, 77, 81, 89, 86, 6194, -2642, 17878, 3768, -952, 16812 }
};
a[indx] = new DynamicGesture(array.length);
cons = new int[] {1,1,1,1,1,1,0,0,0,1,0};
a[indx].updateFrame(array,cons);
DynamicQueue q = new DynamicQueue(a); DynamicQueue q = new DynamicQueue(a);
Live dynamiclive = new Live(); Live dynamiclive = new Live();
...@@ -91,9 +140,13 @@ public class ReceiveDataThread extends Thread { ...@@ -91,9 +140,13 @@ public class ReceiveDataThread extends Thread {
q.processQueue(); q.processQueue();
i = q.proceedExecution(); i = q.proceedExecution();
if(i != -1){ if(i != -1){
// handler.obtainMessage(Constants.READ_STATUS,readStatus,i,null).sendToTarget(); Looper.prepare();
handler.obtainMessage(Constants.READ_STATUS,readStatus,i,null).sendToTarget();
L.m("Gesture " + i + " is executed"); L.m("Gesture " + i + " is executed");
q.gestureStatusPrint();
Looper.loop();
} }
// q.print(); // q.print();
} }
} }
......
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