Files at this revision

API Documentation at this revision

Comitter:
oehlemar
Date:
Fri Jun 12 08:19:42 2020 +0000
Parent:
0:893a1e710078
Commit message:
asdf

Changed in this revision

HTTPServer.cpp Show annotated file Show diff for this revision Revisions of this file
LIDAR.cpp 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/HTTPServer.cpp	Tue Apr 28 13:59:27 2020 +0000
+++ b/HTTPServer.cpp	Fri Jun 12 08:19:42 2020 +0000
@@ -240,7 +240,7 @@
                         output += "<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\r\n";
                         output += "  <script type=\"text/javascript\">\r\n";
                         output += "  var xmlhttp = null;\r\n";
-                        output += "  var task = window.setInterval(\"update()\", 100);\r\n";
+                        output += "  var task = window.setInterval(\"update()\", 250);\r\n";
                         output += "  function update() {\r\n";
                         output += "    if (window.XMLHttpRequest) {\r\n";
                         output += "      xmlhttp = new XMLHttpRequest();\r\n";
--- a/LIDAR.cpp	Tue Apr 28 13:59:27 2020 +0000
+++ b/LIDAR.cpp	Fri Jun 12 08:19:42 2020 +0000
@@ -97,15 +97,41 @@
     deque<Point> beacons;
     
     // bitte implementieren!
-    for (unsigned short i = 0; i < 358; i++) {
+        for (unsigned short i = 0; i < scan.size(); i++) {
+         
+              
+                 bool beacon = true; // flag to check if this point is possibly a beacon
+            
+            
+        // check distance to other points
         
-        if ((DISTANCES[i] < 1) && ((((DISTANCES[i+1]-DISTANCES[i])<0.1)&&(DISTANCES[i+2]-DISTANCES[i+1])<0.1))) { //||((DISTANCES[i+1]-DISTANCES[i])>0.5))
-             
-             beacons.push_back(Point(distances[i], (float)i*M_PI/180.0f));
+        for (unsigned short j = 0; j < scan.size(); j++) {
+            
+            float distance1 = scan[i].manhattanDistance(scan[j]);
+            float distance2 = scan[i].manhattanDistance(scan[j+1]);
+            float distance3 = scan[i].manhattanDistance();
+            
+            if (distance3 > 3.0f){
+                
+                beacon = false; // this point cannot be part of a beacon
+                
+            }
+                
+            if ((distance1 > 0.1f) && (distance1 < 0.5f)) {//
+                
+                beacon = false; // this point cannot be part of a beacon
+            }
+            
+            if ((distance2 > 0.1f)) {
+
+               beacon = false; // this point cannot be part of a beacon
+            }
+            
+        }
         
-        }  
+        if (beacon) beacons.push_back(scan[i]);
+    } 
 
-    }
     
     return beacons;
 }
--- a/Main.cpp	Tue Apr 28 13:59:27 2020 +0000
+++ b/Main.cpp	Fri Jun 12 08:19:42 2020 +0000
@@ -40,7 +40,7 @@
     printf("Create ethernet interface and webserver (please wait!)...\r\n");
     
     EthernetInterface* ethernet = new EthernetInterface();
-    ethernet->set_network("169.254.20.110", "255.255.0.0", "0.0.0.0"); // configure IP address, netmask and gateway address
+    ethernet->set_network("192.168.201.44", "255.255.255.0", "169.168.201.1"); // configure IP address, netmask and gateway address
     ethernet->connect();
     
     HTTPServer* httpServer = new HTTPServer(*ethernet);
@@ -51,7 +51,13 @@
     printf("Enter main loop...\r\n");
     
     while (true) {
-        
+        Timer timer;
+        timer.start();
+        lidar.getBeacons();
+        int duration = timer.read_us();
+        printf("Zeit für getBeacons: %d \r\n",duration);
+        timer.reset();
+        ThisThread::sleep_for(100);
         // set LEDs on microcontroller
         
         ledGreen = 1;