Commit fb3b938d authored by Harshith Goka's avatar Harshith Goka

Change number of sensors to 4

parent 9ad41b5e
......@@ -34,8 +34,7 @@ public class Frame{
}
public void print(){
System.out.print(upperBound);
System.out.print(' ');
System.out.println(lowerBound);
L.m(upperBound + "");
L.m(lowerBound + "");
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ package com.example.harshith.ddc;
public class Gesture{
public int dataPoints = 15;
public int sensors = 11;
public int sensors = 10;
public int adcLevels = 2;
public int adcUpper = 60;
public int adcLower = 200;
......@@ -15,33 +15,33 @@ public class Gesture{
public Gesture(){}
public void printData(){
System.out.println("Printing data...");
L.m("Printing data...");
}
public void updateFrame(int [][] sensorLimits){
System.out.println("Updating static frame...");
L.m("Updating static frame...");
}
public void updateFrame(int [][][] sensorLimits){
System.out.println("Updating dynamic frame...");
L.m("Updating dynamic frame...");
}
public void updateFrame(int []fing){
System.out.println("Updating frame for real...");
L.m("Updating frame for real...");
}
public boolean isInFrame(Live live){
System.out.println("Checking if the value is in the static frame...");
L.m("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...");
L.m("Checking if the value is in the dynamic frame...");
return true;
}
public void execute(int gest){
// perform system function
System.out.println(gest);
L.m("" + gest);
}
}
\ No newline at end of file
......@@ -8,17 +8,18 @@ import java.util.Scanner;
public class Live {
int reading[];
int sensors = 11 ;
int sensors = 10;
public Live(){
reading = new int [sensors];
}
public Live(Live staticLive){
reading = new int [staticLive.sensors];
for (int i=0; i<sensors; i++) {
reading[i] = staticLive.reading[i];
}
// reading = new int [staticLive.sensors];
// for (int i=0; i<sensors; i++) {
// reading[i] = staticLive.reading[i];
// }
reading = staticLive.reading.clone();
}
......@@ -30,13 +31,12 @@ public class Live {
}
public void update(int[] readings){
reading = readings;
reading = readings.clone();
}
public void print(){
for (int i=0; i<sensors; i++) {
System.out.print(reading[i] + " ");
L.m(reading[i] + " ");
}
System.out.print('\n');
}
}
......@@ -33,7 +33,7 @@ public class ReceiveDataThread extends Thread {
a[i] = new StaticGesture();
}
int []hand = {0,0,0,0,0,0,0,0,0,0,0}; int q=0;
int[]hand; int q=0;
q=0; hand = new int [] {0,0,0,0,0,8,8,8,8,8,8};
// neutral
......
......@@ -15,38 +15,32 @@ public class StaticGesture extends Gesture {
for (int i=0; i<5; i++) {
String text = String.format("%03d", eFrame[i][0]);
System.out.print(text);
System.out.print(" ");
L.m(text);
}
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(" ");
L.m(text);
}
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(" ");
L.m(text);
}
for (int i=5; i<sensors; i++) {
String text = String.format("%05d", eFrame[i][1]);
System.out.print(text);
System.out.print(" ");
L.m(text);
}
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];
}
}
// for (int i=0; i<sensors; i++) {
// for (int j=0; j<2; j++) {
// eFrame[i][j] = sensorLimits[i][j];
// }
// }
eFrame = sensorLimits.clone();
}
public void updateFrame(int []hand){
......@@ -55,10 +49,10 @@ public class StaticGesture extends Gesture {
Frame []f = new Frame[sensors];
for (int i=0; i<5; i++) {
for (int i=0; i<4; i++) {
f[i] = new Frame(hand[i], false, adcUpper, adcLower, 2);
}
for (int i=5; i<sensors; i++) {
for (int i=4; i<sensors; i++) {
f[i] = new Frame(hand[i], true, mpuUpper, mpuLower, 3);
}
......@@ -69,7 +63,8 @@ public class StaticGesture extends Gesture {
this.updateFrame(data);
}
public boolean isInFrame(Live live){for (int i=0; i<sensors; i++) {
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;
}
......
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