Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 1:f4b2dde3fa3a, committed 2018-04-20
- Comitter:
- kueenste
- Date:
- Fri Apr 20 14:10:09 2018 +0000
- Parent:
- 0:d87b2f1196e7
- Commit message:
- fertig ohni seich
Changed in this revision
--- 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();
+
}
}