Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DDC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GOKA HARSHITH
DDC
Commits
941132b0
Commit
941132b0
authored
Jun 30, 2016
by
Harshith Goka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final
parent
6be90ce3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
37 deletions
+45
-37
app/src/main/java/com/example/harshith/ddc/LagQueue.java
app/src/main/java/com/example/harshith/ddc/LagQueue.java
+41
-33
app/src/main/java/com/example/harshith/ddc/ReceiveDataThread.java
...main/java/com/example/harshith/ddc/ReceiveDataThread.java
+4
-4
No files found.
app/src/main/java/com/example/harshith/ddc/LagQueue.java
View file @
941132b0
...
@@ -12,14 +12,18 @@ class LagQueue{
...
@@ -12,14 +12,18 @@ class LagQueue{
public
int
[]
threshold
;
public
int
[]
threshold
;
public
int
lowerBoundary
=
-
200
;
public
int
lowerBoundary
=
-
200
;
public
int
upperBoundary
=
-
50
;
public
int
upperBoundary
=
-
50
;
public
LagQueue
(
DynamicGesture
[]
gest
,
int
[]
threshold
){
public
LagQueue
(
DynamicGesture
[]
gest
,
int
[]
threshold
){
gesture
=
gest
.
clone
();
gesture
=
gest
.
clone
();
noOfGestures
=
gesture
.
length
;
noOfGestures
=
gesture
.
length
;
this
.
threshold
=
threshold
.
clone
();
this
.
threshold
=
threshold
.
clone
();
liveElement
=
new
Live
[
noOfSlots
];
liveElement
=
new
Live
[
noOfSlots
];
for
(
int
i
=
0
;
i
<
noOfSlots
;
i
++)
{
liveElement
[
i
]
=
new
Live
();
}
shortlist
=
new
boolean
[
noOfGestures
];
shortlist
=
new
boolean
[
noOfGestures
];
for
(
int
j
=
0
;
j
<
noOfGestures
;
j
++)
{
for
(
int
j
=
0
;
j
<
noOfGestures
;
j
++)
{
...
@@ -42,7 +46,7 @@ class LagQueue{
...
@@ -42,7 +46,7 @@ class LagQueue{
public
void
updateQueue
(
Live
live
){
public
void
updateQueue
(
Live
live
){
latestElement
=
(
latestElement
+
1
)%
noOfSlots
;
latestElement
=
(
latestElement
+
1
)%
noOfSlots
;
liveElement
[
latestElement
]
=
new
Live
(
live
);
liveElement
[
latestElement
]
=
new
Live
(
live
);
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
shortlist
[
i
]
=
true
;
shortlist
[
i
]
=
true
;
...
@@ -73,19 +77,28 @@ class LagQueue{
...
@@ -73,19 +77,28 @@ 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
){
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
;
int
index
=
0
;
for
(
int
i
=
0
;
i
<
liveElement
[
slotNo
].
sensors
;
i
++){
for
(
int
i
=
0
;
i
<
liveElement
[
slotNo
].
sensors
;
i
++){
if
(
gesture
[
gestNo
].
consider
[
i
]){
if
(
gesture
[
gestNo
].
consider
[
i
]){
for
(
int
j
=
lowerBoundary
+
slotNo
+
latestElement
;
j
<
latestElement
;
j
++)
{
for
(
int
j
=
0
;
j
<
-
slotNo
-
lowerBoundary
;
j
++)
{
x
[
j
-
(
lowerBoundary
+
slotNo
+
latestElement
)][
index
]
=
liveElement
[
j
].
reading
[
i
];
//gesture[gestNo].point[j][i];
x
[
j
][
index
]
=
liveElement
[
j
+
latestElement
+
lowerBoundary
].
reading
[
i
];
//gesture[gestNo].point[j][i];
}
}
index
++;
index
++;
}
}
}
}
return
x
;
return
x
;
}
}
...
@@ -102,9 +115,9 @@ class LagQueue{
...
@@ -102,9 +115,9 @@ class LagQueue{
index
++;
index
++;
}
}
}
}
return
x
;
return
x
;
}
}
public
int
arrayMin
(
int
[]
arr
){
public
int
arrayMin
(
int
[]
arr
){
int
mini
=
1000000
;
int
mini
=
1000000
;
...
@@ -115,24 +128,25 @@ class LagQueue{
...
@@ -115,24 +128,25 @@ class LagQueue{
}
}
public
int
minDtwGapProcess
(
int
gestNo
){
public
int
minDtwGapProcess
(
int
gestNo
){
int
[]
dtwValues
=
new
int
[
upperBoundary
-
lowerBoundary
];
int
[]
dtwValues
=
new
int
[
upperBoundary
-
lowerBoundary
];
DTW
x
;
DTW
x
;
int
[][]
gestarraytemp
=
validSensorArrayComp
(
gestNo
);
int
[][]
gestarraytemp
=
validSensorArrayComp
(
gestNo
);
//arrayPrint(gestarraytemp);
// arrayPrint(gestarraytemp);
//System.out.println();
for
(
int
i
=
0
;
i
<
upperBoundary
-
lowerBoundary
;
i
++)
{
for
(
int
i
=
0
;
i
<
upperBoundary
-
lowerBoundary
;
i
++)
{
x
=
new
DTWtwoD
();
x
=
new
DTWtwoD
();
int
[][]
arraytemp
=
liveTempArrayComp
(
i
,
gestNo
);
int
[][]
arraytemp
=
liveTempArrayComp
(
i
,
gestNo
);
x
.
arrayInput
(
gestarraytemp
,
arraytemp
);
x
.
arrayInput
(
gestarraytemp
,
arraytemp
);
//dtwGap[slotNo][i].add( Math.max( 0.0, (x.sdtwDistance() + dtwGap[slotNo][i].size()*alterFactor)) );
//dtwGap[slotNo][i].add( Math.max( 0.0, (x.sdtwDistance() + dtwGap[slotNo][i].size()*alterFactor)) );
dtwValues
[
i
]
=
x
.
dtwDistance
();
dtwValues
[
i
]
=
x
.
dtwDistance
();
}
}
return
arrayMin
(
dtwValues
);
return
arrayMin
(
dtwValues
);
}
}
public
void
processQueue
(){
public
void
processQueue
(){
...
@@ -147,14 +161,15 @@ class LagQueue{
...
@@ -147,14 +161,15 @@ class LagQueue{
else
shortlist
[
i
]
=
false
;
else
shortlist
[
i
]
=
false
;
}
}
if
(
getShortlistCount
()==
0
)
latestElement
=
(
latestElement
+
1
)%
noOfSlots
;
if
(
getShortlistCount
()==
0
)
{}
//
latestElement = (latestElement+1)%noOfSlots;
else
if
(
getShortlistCount
()==
1
)
{
else
if
(
getShortlistCount
()==
1
)
{
//gesture execute
//gesture execute
System
.
out
.
println
(
firstShortlistGestureIndex
());
System
.
out
.
println
(
firstShortlistGestureIndex
());
return
firstShortlistGestureIndex
();
return
firstShortlistGestureIndex
();
}
}
overflowCheck
();
overflowCheck
();
return
-
1
;
return
-
1
;
}
}
public
void
print
(){
public
void
print
(){
...
@@ -164,8 +179,9 @@ class LagQueue{
...
@@ -164,8 +179,9 @@ class LagQueue{
for
(
int
j
=
0
;
j
<
noOfSlots
;
j
++)
{
for
(
int
j
=
0
;
j
<
noOfSlots
;
j
++)
{
System
.
out
.
print
(
liveElement
[
j
].
reading
[
i
]
+
" "
);
System
.
out
.
print
(
liveElement
[
j
].
reading
[
i
]
+
" "
);
}
}
System
.
out
.
print
(
'\n'
);
System
.
out
.
print
(
'\n'
);
}
}
System
.
out
.
println
(
latestElement
);
gestureStatusPrint
();
gestureStatusPrint
();
}
}
...
@@ -173,20 +189,12 @@ class LagQueue{
...
@@ -173,20 +189,12 @@ class LagQueue{
public
void
gestureStatusPrint
(){
public
void
gestureStatusPrint
(){
System
.
out
.
print
(
'\n'
);
System
.
out
.
print
(
'\n'
);
System
.
out
.
println
(
"DTW Status:"
);
System
.
out
.
println
(
"DTW Status:"
);
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
System
.
out
.
print
(
"Gesture "
+
i
+
" : "
+
minDtwGap
[
i
]);
System
.
out
.
print
(
minDtwGap
[
i
]
+
" "
);
System
.
out
.
print
(
'\n'
);
}
}
// System.out.println("Gesture Status:");
System
.
out
.
print
(
'\n'
);
// 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);
}
}
}
}
\ No newline at end of file
app/src/main/java/com/example/harshith/ddc/ReceiveDataThread.java
View file @
941132b0
...
@@ -182,7 +182,7 @@ public class ReceiveDataThread extends Thread {
...
@@ -182,7 +182,7 @@ public class ReceiveDataThread extends Thread {
threshold
[
indx
]
=
40
;
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
,
1
0
};
LagQueue
q
=
new
LagQueue
(
a
,
threshold
);
LagQueue
q
=
new
LagQueue
(
a
,
threshold
);
Live
dynamiclive
=
new
Live
();
Live
dynamiclive
=
new
Live
();
...
@@ -204,11 +204,11 @@ public class ReceiveDataThread extends Thread {
...
@@ -204,11 +204,11 @@ public class ReceiveDataThread extends Thread {
q
.
processQueue
();
q
.
processQueue
();
i
=
q
.
proceedExecution
();
i
=
q
.
proceedExecution
();
if
(
i
!=
-
1
)
{
if
(
i
!=
-
1
)
{
Looper
.
prepare
();
//
Looper.prepare();
// handler.sendMessageDelayed(handler.obtainMessage(Constants.READ_STATUS, readStatus, i, null), 10000);
// handler.sendMessageDelayed(handler.obtainMessage(Constants.READ_STATUS, readStatus, i, null), 10000);
L
.
m
(
"Gesture "
+
i
+
" is executed"
);
L
.
m
(
"Gesture "
+
i
+
" is executed"
);
q
.
gestureStatusPrint
();
q
.
gestureStatusPrint
();
Looper
.
loop
();
//
Looper.loop();
}
}
}
}
counter
++;
counter
++;
...
@@ -279,7 +279,7 @@ public class ReceiveDataThread extends Thread {
...
@@ -279,7 +279,7 @@ public class ReceiveDataThread extends Thread {
public
int
[][]
readingsGenerate
(
int
[]
low
,
int
[]
high
){
public
int
[][]
readingsGenerate
(
int
[]
low
,
int
[]
high
){
int
size
=
0
;
int
size
=
0
;
for
(
int
i
=
0
;
i
<
low
.
length
;
i
++){
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
){
if
(
diff
>
size
){
size
=
diff
;
size
=
diff
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment