first publish

Dependents:   CleaningMachine_Betago CleaningMachine_Betago clean_V1 CleaningM-Palm ... more

Files at this revision

API Documentation at this revision

Comitter:
icyzkungz
Date:
Mon Feb 15 17:45:38 2016 +0000
Commit message:
first publish

Changed in this revision

Process.cpp Show annotated file Show diff for this revision Revisions of this file
Process.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r e4727bcb1054 Process.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Process.cpp	Mon Feb 15 17:45:38 2016 +0000
@@ -0,0 +1,49 @@
+#include "Process.h"
+
+Process::Process()
+{
+#ifdef PROCESS_DEBUG
+    pc = new Serial(USBTX, USBRX);
+    pc->baud(115200);
+#endif
+
+    for(int i=0; i<10; i++) {
+        weight[i] = 1;
+    }
+    sum_weight = 0;
+    mean = 0;
+}
+
+void Process::EdgeWalk()
+{
+
+}
+
+void Process::CalEdgeWalk()
+{
+    
+    //getSensorData(SensorData); //waiting for communicate
+    
+    //SD = StandardDeviation();
+}
+
+void Process::setWeight(int id, float data)
+{
+    weight[id] = data;
+}
+
+/*float Process::StandardDeviation()
+{
+    float mean=0.0, sum_deviation=0.0;
+    float data[10];
+    int i;
+    for(i=0; i<n;++i)
+    {
+        data[i] = weight[i]*SensorData[i];
+        mean+=data[i];
+    }
+    mean=mean/n;
+    for(i=0; i<n;++i)
+    sum_deviation+=(data[i]-mean)*(data[i]-mean);
+    return sqrt(sum_deviation/n);           
+}*/
\ No newline at end of file
diff -r 000000000000 -r e4727bcb1054 Process.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Process.h	Mon Feb 15 17:45:38 2016 +0000
@@ -0,0 +1,35 @@
+#ifndef PROCESS_H
+#define PROCESS_H
+#include "mbed.h"
+
+#define PROCESS_DEBUG
+
+class Process
+{
+public:
+    Serial *pc;
+    Process();
+    
+    //Walk Style
+    void EdgeWalk();
+    
+    //Calculation
+    void CalEdgeWalk();
+    float StandardDeviation();
+    
+    //Set
+    void setWeight(int,float);
+    
+    //void getSensorData(float*);
+    
+
+private:
+    float SensorData[10];
+    float weight[10];
+    float mean;
+    float sum_weight;
+    float SD;
+};
+
+
+#endif
\ No newline at end of file