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
9908764b
Commit
9908764b
authored
Jun 29, 2016
by
Harshith Goka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Selective sensor DTW, few changes to classes
parent
e37a6d8c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
108 additions
and
32 deletions
+108
-32
app/src/main/java/com/example/harshith/ddc/DynamicGesture.java
...rc/main/java/com/example/harshith/ddc/DynamicGesture.java
+32
-1
app/src/main/java/com/example/harshith/ddc/DynamicPrime.java
app/src/main/java/com/example/harshith/ddc/DynamicPrime.java
+9
-6
app/src/main/java/com/example/harshith/ddc/DynamicQueue.java
app/src/main/java/com/example/harshith/ddc/DynamicQueue.java
+37
-11
app/src/main/java/com/example/harshith/ddc/Gesture.java
app/src/main/java/com/example/harshith/ddc/Gesture.java
+9
-1
app/src/main/java/com/example/harshith/ddc/Live.java
app/src/main/java/com/example/harshith/ddc/Live.java
+5
-5
app/src/main/java/com/example/harshith/ddc/ReceiveDataThread.java
...main/java/com/example/harshith/ddc/ReceiveDataThread.java
+15
-8
app/src/main/java/com/example/harshith/ddc/ReceiveService.java
...rc/main/java/com/example/harshith/ddc/ReceiveService.java
+1
-0
No files found.
app/src/main/java/com/example/harshith/ddc/DynamicGesture.java
View file @
9908764b
...
...
@@ -4,9 +4,14 @@ class DynamicGesture extends Gesture {
public
int
dataPoints
=
5
;
public
int
[][]
point
;
public
boolean
[]
consider
;
public
DynamicGesture
(){
point
=
new
int
[
dataPoints
][
sensors
];
consider
=
new
boolean
[
sensors
];
/*for (int i=0; i<sensors; i++) {
consider[i] = true;
}*/
}
public
int
[][]
getPoint
(){
...
...
@@ -14,6 +19,12 @@ class DynamicGesture extends Gesture {
}
public
void
printData
(){
System
.
out
.
print
(
'\n'
);
for
(
int
j
=
0
;
j
<
sensors
;
j
++)
{
int
prnt
=
0
;
if
(
consider
[
j
])
prnt
=
1
;
System
.
out
.
print
(
prnt
+
" "
);
}
System
.
out
.
print
(
'\n'
);
for
(
int
i
=
0
;
i
<
dataPoints
;
i
++)
{
for
(
int
j
=
0
;
j
<
sensors
;
j
++)
{
...
...
@@ -23,12 +34,32 @@ class DynamicGesture extends Gesture {
}
}
public
void
updateFrame
(
int
[][]
sensorPoint
){
public
void
updateFrame
(
int
[][]
sensorPoint
,
int
[]
considerPoints
){
for
(
int
i
=
0
;
i
<
dataPoints
;
i
++)
{
for
(
int
j
=
0
;
j
<
sensors
;
j
++)
{
point
[
i
][
j
]
=
sensorPoint
[
i
][
j
];
}
}
updateConsider
(
considerPoints
);
}
public
void
updateConsider
(
int
[]
array
){
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
if
(
array
[
i
]==
1
)
consider
[
i
]
=
true
;
//else consider[i] = false;
}
}
public
int
getConsiderCount
(){
int
count
=
0
;
for
(
int
i
=
0
;
i
<
consider
.
length
;
i
++)
{
if
(
consider
[
i
])
count
++;
}
return
count
;
}
}
\ No newline at end of file
app/src/main/java/com/example/harshith/ddc/DynamicPrime.java
View file @
9908764b
...
...
@@ -5,22 +5,25 @@ class DynamicPrime{
int
noOfGestures
=
2
;
Gesture
[]
a
=
new
Gesture
[
noOfGestures
];
DynamicGesture
[]
a
=
new
Dynamic
Gesture
[
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
<
11
;
j
++)
{
for
(
int
j
=
0
;
j
<
5
;
j
++)
{
array
[
i
][
j
]
=
i
*
2
;
}
}
a
[
0
].
updateFrame
(
array
);
//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
;
...
...
@@ -29,8 +32,8 @@ class DynamicPrime{
array2
[
i
][
j
]
=
0
;
}
}
a
[
1
].
updateFrame
(
array2
);
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
...
...
app/src/main/java/com/example/harshith/ddc/DynamicQueue.java
View file @
9908764b
...
...
@@ -3,7 +3,7 @@ package com.example.harshith.ddc;
class
DynamicQueue
{
public
int
noOfSlots
=
5000
;
public
int
noOfGestures
;
public
Gesture
[]
gesture
;
public
Dynamic
Gesture
[]
gesture
;
public
int
[][]
dtwGap
;
public
Live
[]
liveElement
;
public
boolean
[][]
shortlist
;
...
...
@@ -11,7 +11,7 @@ class DynamicQueue{
public
int
latestElement
=
0
;
public
int
foremostElement
=
0
;
public
DynamicQueue
(
Gesture
[]
gest
){
public
DynamicQueue
(
Dynamic
Gesture
[]
gest
){
gesture
=
gest
.
clone
();
noOfGestures
=
gesture
.
length
;
...
...
@@ -73,28 +73,54 @@ class DynamicQueue{
}
public
int
[][]
liveTempArrayComp
(
int
slotNo
,
int
livesTailNo
){
public
int
[][]
liveTempArrayComp
(
int
slotNo
,
int
livesTailNo
,
int
gestNo
){
int
count
=
0
;
for
(
int
i
=
slotNo
;
i
!=
livesTailNo
;
i
=(
i
+
1
)%
noOfSlots
){
count
++;}
int
[][]
x
=
new
int
[
count
][
liveElement
[
0
].
sensors
];
int
[][]
x
=
new
int
[
count
][
gesture
[
gestNo
].
getConsiderCount
()];
int
index
=
0
;
for
(
int
i
=
0
;
i
<
liveElement
[
slotNo
].
sensors
;
i
++){
if
(
gesture
[
gestNo
].
consider
[
i
]){
for
(
int
j
=
0
;
j
<
count
;
j
++)
{
x
[
j
][
index
]
=
liveElement
[(
j
+
slotNo
)%
noOfSlots
].
reading
[
i
];
//gesture[gestNo].point[j][i];
}
index
++;
}
}
return
x
;
}
for
(
int
i
=
0
;
i
<
count
;
i
++){
// for (int i=slotNo; i!=livesTailNo; i=(i+1)%noOfSlots){
x
[
i
]
=
liveElement
[(
i
+
slotNo
)%
noOfSlots
].
reading
;
public
int
[][]
validSensorArrayComp
(
int
gestNo
){
int
[][]
x
=
new
int
[
gesture
[
gestNo
].
dataPoints
][
gesture
[
gestNo
].
getConsiderCount
()];
int
index
=
0
;
for
(
int
i
=
0
;
i
<
gesture
[
gestNo
].
sensors
;
i
++){
if
(
gesture
[
gestNo
].
consider
[
i
]){
for
(
int
j
=
0
;
j
<
gesture
[
gestNo
].
dataPoints
;
j
++)
{
x
[
j
][
index
]
=
gesture
[
gestNo
].
point
[
j
][
i
];
}
index
++;
}
}
return
x
;
}
}
public
void
processLive
(
int
slotNo
,
int
livesTailNo
){
int
threshold
=
5
;
DTW
x
;
int
[][]
arraytemp
=
liveTempArrayComp
(
slotNo
,
livesTailNo
);
DTW
x
;
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
x
=
new
DTWtwoD
();
x
.
arrayInput
(
gesture
[
i
].
getPoint
(),
arraytemp
);
int
[][]
arraytemp
=
liveTempArrayComp
(
slotNo
,
livesTailNo
,
i
);
int
[][]
gestarraytemp
=
validSensorArrayComp
(
i
);
x
.
arrayInput
(
gestarraytemp
,
arraytemp
);
dtwGap
[
slotNo
][
i
]
=
x
.
sdtwDistance
();
}
for
(
int
i
=
0
;
i
<
noOfGestures
;
i
++)
{
...
...
app/src/main/java/com/example/harshith/ddc/Gesture.java
View file @
9908764b
...
...
@@ -21,7 +21,7 @@ class Gesture{
System
.
out
.
println
(
"Printing data..."
);
}
public
void
updateFrame
(
int
[][]
sensor
Limi
ts
){
public
void
updateFrame
(
int
[][]
sensor
Point
,
int
[]
considerPoin
ts
){
System
.
out
.
println
(
"Updating static frame..."
);
}
...
...
@@ -33,6 +33,14 @@ class Gesture{
System
.
out
.
println
(
"Updating frame for real..."
);
}
public
void
updateConsider
(
int
[]
array
){
}
public
int
getConsiderCount
(){
return
0
;
}
public
boolean
isInFrame
(
Live
live
){
System
.
out
.
println
(
"Checking if the value is in the static frame..."
);
return
true
;
...
...
app/src/main/java/com/example/harshith/ddc/Live.java
View file @
9908764b
...
...
@@ -4,7 +4,7 @@ import java.util.Scanner;
class
Live
{
public
int
reading
[];
public
int
sensors
=
11
;
public
int
sensors
=
11
;
public
Live
(){
reading
=
new
int
[
sensors
];
...
...
@@ -17,14 +17,14 @@ class Live{
}
}
public
void
update
(
int
p
){
public
void
update
(
int
reading
){
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
reading
[
i
]
=
p
;
this
.
reading
[
i
]
=
reading
;
}
}
public
void
update
(
int
[]
p
){
reading
=
p
.
clone
();
public
void
update
(
int
[]
readings
){
reading
=
readings
.
clone
();
}
public
void
updateConsole
(){
...
...
app/src/main/java/com/example/harshith/ddc/ReceiveDataThread.java
View file @
9908764b
...
...
@@ -37,21 +37,25 @@ public class ReceiveDataThread extends Thread {
int
noOfGestures
=
2
;
Gesture
[]
a
=
new
Gesture
[
noOfGestures
];
DynamicGesture
[]
a
=
new
Dynamic
Gesture
[
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
<
11
;
j
++)
{
for
(
int
j
=
0
;
j
<
5
;
j
++)
{
array
[
i
][
j
]
=
i
*
2
;
}
}
a
[
0
].
updateFrame
(
array
);
//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
;
...
...
@@ -60,14 +64,16 @@ public class ReceiveDataThread extends Thread {
array2
[
i
][
j
]
=
0
;
}
}
a
[
1
].
updateFrame
(
array2
);
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
DynamicQueue
q
=
new
DynamicQueue
(
a
);
Live
dynamiclive
=
new
Live
();
byte
[]
buffer
=
new
byte
[
64
];
int
bytes
=
-
1
;
String
readMessage
;
...
...
@@ -79,13 +85,14 @@ public class ReceiveDataThread extends Thread {
readMessage
=
new
String
(
buffer
,
0
,
bytes
);
stringBuilder
.
append
(
readMessage
);
convert
();
if
(
readings
.
length
==
11
)
{
if
(
readings
!=
null
&&
readings
.
length
==
11
)
{
dynamiclive
.
update
(
readings
);
q
.
updateQueue
(
dynamiclive
);
q
.
processQueue
();
i
=
q
.
proceedExecution
();
if
(
i
!=
-
1
){
handler
.
obtainMessage
(
Constants
.
READ_STATUS
,
readStatus
,
i
,
null
).
sendToTarget
();
// handler.obtainMessage(Constants.READ_STATUS,readStatus,i,null).sendToTarget();
L
.
m
(
"Gesture "
+
i
+
" is executed"
);
}
// q.print();
}
...
...
app/src/main/java/com/example/harshith/ddc/ReceiveService.java
View file @
9908764b
...
...
@@ -16,6 +16,7 @@ import java.util.UUID;
*/
public
class
ReceiveService
extends
Service
{
int
mode
=
0
;
ConnectThread
connectThread
;
ReceiveDataThread
receiveDataThread
;
private
static
final
UUID
uuid
=
UUID
.
fromString
(
"00001101-0000-1000-8000-00805F9B34FB"
);
...
...
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