TeamSurface / Mbed 2 deprecated ROME_P5_normal

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kueenste
Date:
Fri Apr 20 14:10:09 2018 +0000
Parent:
0:d87b2f1196e7
Commit message:
fertig ohni seich

Changed in this revision

LIDAR.cpp Show annotated file Show diff for this revision Revisions of this file
LIDAR.h Show annotated file Show diff for this revision Revisions of this file
Main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/LIDAR.cpp	Fri Apr 20 13:49:49 2018 +0000
+++ b/LIDAR.cpp	Fri Apr 20 14:10:09 2018 +0000
@@ -85,7 +85,7 @@
  * This method implements an algorithm that looks for the position of a beacon.
  * It should be called periodically by a low-priority background task.
  */
-void LIDAR::lookForBeacon(int direction) {
+void LIDAR::lookForBeacon() {
     
     distanceOfBeacon = 0;
     angleOfBeacon = 0;
@@ -109,23 +109,10 @@
     short sumAngle = 0;
     int lastPFound = 0;
     
-    /*
-    if(direction) {
-        for(i=0;i<360;i++) {
-            mydist[i] = distances[i]; 
-        }      
-    } else {
-        int j = 0;
-        for(i=359;i>=0;i--) {
-            mydist[j] = distances[i];     
-            j++;
-        }
-    }
-    */
-    
     for(i=0;i<360;i++) {
         mydist[i] = distances[i]; 
-    }   
+    } 
+    
     
     
     
@@ -148,17 +135,8 @@
             } else {
                 if(lastPFound && anz >= 2 && anz <= 9) {
                     distanceOfBeacon = sumDist/anz;
-                    
                     angleOfBeacon = sumAngle / anz;
                     
-                    /*
-                    if(direction) {
-                        angleOfBeacon = sumAngle / anz;
-                    } else {
-                        angleOfBeacon = sumAngle / anz;
-                    }
-                    */
-                    
                 }
                 sumDist = 0;
                 sumAngle = 0;
--- a/LIDAR.h	Fri Apr 20 13:49:49 2018 +0000
+++ b/LIDAR.h	Fri Apr 20 14:10:09 2018 +0000
@@ -22,7 +22,7 @@
         short       getDistance(short angle);
         short       getDistanceOfBeacon();
         short       getAngleOfBeacon();
-        void        lookForBeacon(int direction);
+        void        lookForBeacon();
         
     private:
         
--- a/Main.cpp	Fri Apr 20 13:49:49 2018 +0000
+++ b/Main.cpp	Fri Apr 20 14:10:09 2018 +0000
@@ -87,7 +87,6 @@
     reset = 0; wait(0.1f);
     reset = 1; wait(0.1f);
     
-    int leftright = 0;
     
     SerialServer serialServer(serial, lidar, controller);
     
@@ -97,13 +96,8 @@
         
         wait(0.2f); // wait for 200 ms
         
-        lidar.lookForBeacon(leftright);
-        
-        if(leftright) {
-            leftright = 0;
-        } else {
-            leftright = 1;
-        }
+        lidar.lookForBeacon();
+
     }
 }