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
9ad41b5e
Commit
9ad41b5e
authored
Jun 19, 2016
by
Harshith Goka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Five Flex Sensors
parent
fe37890b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
212 additions
and
0 deletions
+212
-0
app/src/main/java/com/example/harshith/ddc/DynamicGesture.java
...rc/main/java/com/example/harshith/ddc/DynamicGesture.java
+45
-0
app/src/main/java/com/example/harshith/ddc/Frame.java
app/src/main/java/com/example/harshith/ddc/Frame.java
+41
-0
app/src/main/java/com/example/harshith/ddc/Gesture.java
app/src/main/java/com/example/harshith/ddc/Gesture.java
+47
-0
app/src/main/java/com/example/harshith/ddc/StaticGesture.java
...src/main/java/com/example/harshith/ddc/StaticGesture.java
+79
-0
No files found.
app/src/main/java/com/example/harshith/ddc/DynamicGesture.java
0 → 100644
View file @
9ad41b5e
package
com.example.harshith.ddc
;
public
class
DynamicGesture
extends
Gesture
{
public
int
[][][]
eFrame
;
public
DynamicGesture
(){
eFrame
=
new
int
[
sensors
][][];
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
eFrame
[
i
]
=
new
int
[
dataPoints
][];
for
(
int
j
=
0
;
j
<
dataPoints
;
j
++)
{
eFrame
[
i
][
j
]
=
new
int
[
2
];
}
}
}
public
void
printData
(){
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
for
(
int
j
=
0
;
j
<
dataPoints
;
j
++)
{
System
.
out
.
print
(
eFrame
[
i
][
j
][
0
]);
System
.
out
.
print
(
":"
);
System
.
out
.
print
(
eFrame
[
i
][
j
][
1
]
+
" "
);
}
System
.
out
.
print
(
'\n'
);
}
}
public
void
updateFrame
(
int
[][][]
sensorLimits
){
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
for
(
int
j
=
0
;
j
<
dataPoints
;
j
++)
{
for
(
int
k
=
0
;
k
<
2
;
k
++)
{
eFrame
[
i
][
j
][
k
]
=
sensorLimits
[
i
][
j
][
k
];
}
}
}
}
public
boolean
isInFrame
(
Live
live
,
int
index
){
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
if
(!((
eFrame
[
i
][
index
][
0
]<
live
.
reading
[
i
])
&&
(
live
.
reading
[
i
]<
eFrame
[
i
][
index
][
1
]))){
return
false
;
}
}
return
true
;
}
}
\ No newline at end of file
app/src/main/java/com/example/harshith/ddc/Frame.java
0 → 100644
View file @
9ad41b5e
package
com.example.harshith.ddc
;
public
class
Frame
{
boolean
mpu
;
public
int
upperBound
;
public
int
lowerBound
;
public
Frame
(
int
index
,
boolean
isMpu
,
int
upBound
,
int
lrBound
,
int
levels
){
if
(!
isMpu
){
upperBound
=
upBound
+
index
*((
lrBound
-
upBound
)/
levels
);
lowerBound
=
upBound
+
(
index
+
1
)*((
lrBound
-
upBound
)/
levels
);
}
else
{
upperBound
=
lrBound
-
(
index
+
2
)*((
lrBound
-
upBound
)/
levels
);
lowerBound
=
lrBound
-
(
index
+
1
)*((
lrBound
-
upBound
)/
levels
);
}
if
(
index
==
8
){
upperBound
=
upBound
;
lowerBound
=
lrBound
;
}
}
public
void
pushLimits
(
int
[]
d
){
d
[
0
]
=
upperBound
;
d
[
1
]
=
lowerBound
;
}
public
void
print
(){
System
.
out
.
print
(
upperBound
);
System
.
out
.
print
(
' '
);
System
.
out
.
println
(
lowerBound
);
}
}
\ No newline at end of file
app/src/main/java/com/example/harshith/ddc/Gesture.java
0 → 100644
View file @
9ad41b5e
package
com.example.harshith.ddc
;
public
class
Gesture
{
public
int
dataPoints
=
15
;
public
int
sensors
=
11
;
public
int
adcLevels
=
2
;
public
int
adcUpper
=
60
;
public
int
adcLower
=
200
;
public
int
mpuLevels
=
3
;
public
int
mpuUpper
=
18000
;
public
int
mpuLower
=
-
18000
;
public
Gesture
(){}
public
void
printData
(){
System
.
out
.
println
(
"Printing data..."
);
}
public
void
updateFrame
(
int
[][]
sensorLimits
){
System
.
out
.
println
(
"Updating static frame..."
);
}
public
void
updateFrame
(
int
[][][]
sensorLimits
){
System
.
out
.
println
(
"Updating dynamic frame..."
);
}
public
void
updateFrame
(
int
[]
fing
){
System
.
out
.
println
(
"Updating frame for real..."
);
}
public
boolean
isInFrame
(
Live
live
){
System
.
out
.
println
(
"Checking if the value is in the static frame..."
);
return
true
;
}
public
boolean
isInFrame
(
Live
live
,
int
index
){
System
.
out
.
println
(
"Checking if the value is in the dynamic frame..."
);
return
true
;
}
public
void
execute
(
int
gest
){
// perform system function
System
.
out
.
println
(
gest
);
}
}
\ No newline at end of file
app/src/main/java/com/example/harshith/ddc/StaticGesture.java
0 → 100644
View file @
9ad41b5e
package
com.example.harshith.ddc
;
public
class
StaticGesture
extends
Gesture
{
public
int
[][]
eFrame
;
public
StaticGesture
(){
eFrame
=
new
int
[
sensors
]
[];
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
eFrame
[
i
]
=
new
int
[
2
];
}
}
public
void
printData
(){
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
String
text
=
String
.
format
(
"%03d"
,
eFrame
[
i
][
0
]);
System
.
out
.
print
(
text
);
System
.
out
.
print
(
" "
);
}
for
(
int
i
=
5
;
i
<
sensors
;
i
++)
{
if
(
eFrame
[
i
][
1
]<
0
)
System
.
out
.
print
(
" "
);
String
text
=
String
.
format
(
"%05d"
,
eFrame
[
i
][
0
]);
System
.
out
.
print
(
text
);
System
.
out
.
print
(
" "
);
}
System
.
out
.
print
(
'\n'
);
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
String
text
=
String
.
format
(
"%03d"
,
eFrame
[
i
][
1
]);
System
.
out
.
print
(
text
);
System
.
out
.
print
(
" "
);
}
for
(
int
i
=
5
;
i
<
sensors
;
i
++)
{
String
text
=
String
.
format
(
"%05d"
,
eFrame
[
i
][
1
]);
System
.
out
.
print
(
text
);
System
.
out
.
print
(
" "
);
}
System
.
out
.
print
(
'\n'
);
}
public
void
updateFrame
(
int
[][]
sensorLimits
){
//super.updateFrame(sensorLimits);
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
for
(
int
j
=
0
;
j
<
2
;
j
++)
{
eFrame
[
i
][
j
]
=
sensorLimits
[
i
][
j
];
}
}
}
public
void
updateFrame
(
int
[]
hand
){
int
[][]
data
=
new
int
[
sensors
][
2
];
Frame
[]
f
=
new
Frame
[
sensors
];
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
f
[
i
]
=
new
Frame
(
hand
[
i
],
false
,
adcUpper
,
adcLower
,
2
);
}
for
(
int
i
=
5
;
i
<
sensors
;
i
++)
{
f
[
i
]
=
new
Frame
(
hand
[
i
],
true
,
mpuUpper
,
mpuLower
,
3
);
}
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
f
[
i
].
pushLimits
(
data
[
i
]);
}
this
.
updateFrame
(
data
);
}
public
boolean
isInFrame
(
Live
live
){
for
(
int
i
=
0
;
i
<
sensors
;
i
++)
{
if
(!((
eFrame
[
i
][
0
]<
live
.
reading
[
i
])
&&
(
live
.
reading
[
i
]<
eFrame
[
i
][
1
]))){
return
false
;
}
}
return
true
;
}
}
\ No newline at end of file
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