2 Commits 8aedffc156 ... f7827d0d8f

Author SHA1 Message Date
  fstange f7827d0d8f Update 6 years ago
  fstange 22d8ef0438 Update 6 years ago

BIN
ArduinoOutput/Hauptprojekt.ino.elf


+ 2 - 2
ArduinoOutput/Hauptprojekt.ino.hex

@@ -992,8 +992,8 @@
992 992
 :103DF000F091320553E0859FE00DF11D1124B18053
993 993
 :103E000001C0B12CB092880386E10E94A90E8A15E8
994 994
 :103E100058F4E0913105F091320593E0899FE00D6F
995
-:103E2000F11D1124828101C080E080938903A3E009
996
-:103E3000AB1568F4843058F01092A5021092A602D7
995
+:103E2000F11D1124828101C080E080938903A4E008
996
+:103E3000AB1568F4853058F01092A5021092A602D6
997 997
 :103E40001092A7021092A8020E94661633C0B80111
998 998
 :103E5000C8010E94450668EE73E080E090E00E9491
999 999
 :103E600058040E94B80A0E94BF0E80938A03809172

+ 2 - 2
ArduinoOutput/Hauptprojekt.ino.with_bootloader.hex

@@ -992,8 +992,8 @@
992 992
 :103DF000F091320553E0859FE00DF11D1124B18053
993 993
 :103E000001C0B12CB092880386E10E94A90E8A15E8
994 994
 :103E100058F4E0913105F091320593E0899FE00D6F
995
-:103E2000F11D1124828101C080E080938903A3E009
996
-:103E3000AB1568F4843058F01092A5021092A602D7
995
+:103E2000F11D1124828101C080E080938903A4E008
996
+:103E3000AB1568F4853058F01092A5021092A602D6
997 997
 :103E40001092A7021092A8020E94661633C0B80111
998 998
 :103E5000C8010E94450668EE73E080E090E00E9491
999 999
 :103E600058040E94B80A0E94BF0E80938A03809172

+ 13 - 13
ArduinoOutput/preproc/ctags_target_for_gcc_minus_e.cpp

@@ -1,7 +1,7 @@
1 1
 # 1 "c:\\Users\\Carolin\\Downloads\\VSCode\\Zumo32U4\\Zumo32U4\\Hauptprojekt\\Hauptprojekt.ino"
2 2
 # 1 "c:\\Users\\Carolin\\Downloads\\VSCode\\Zumo32U4\\Zumo32U4\\Hauptprojekt\\Hauptprojekt.ino"
3 3
 //Verfassser: Felix Stange, 4056379, MET2016 
4
-//Datum: erstellt am 19.07.2017, zuletzt geändert am 06.02.2018 
4
+//Datum: erstellt am 19.07.2017, zuletzt geändert am 21.02.2018 
5 5
 //Projektbeschreibung: Der Zumo fährt automatisch zwischen 2 Linien ohne diese zu überfahren mithilfe 
6 6
 //der Liniensensoren (3), ähnlich einer Spurhalteautomatik (heller Belag und dunkle Streifen). 
7 7
 //Außerdem werden Kollisionen verhindert durch Nutzung der vorderen Abstandssensoren. Kommt es 
@@ -17,19 +17,19 @@
17 17
 
18 18
 Zumo32U4ProximitySensors proxSensors; //Abstandssensoren
19 19
 Zumo32U4LineSensors lineSensors; //Liniensensoren
20
-Zumo32U4Motors motors;
21
-Zumo32U4ButtonA buttonA;
20
+Zumo32U4Motors motors; //Motoren
21
+Zumo32U4ButtonA buttonA; //Taste A
22 22
 Zumo32U4Encoders encoders; //Motorencoder
23 23
 LSM303 compass; //Beschleunigungssensor x-Achse
24 24
 L3G gyro; //Drehbewegungssensor z-Achse
25 25
 
26
-int16_t lineValue[3]; //von links (0) nach rechts (2)
27
-uint16_t lineOffset[3];
26
+int16_t lineValue[3]; //Liniensensoren
27
+uint16_t lineOffset[3]; //von links (0) nach rechts (2)
28 28
 
29
-uint8_t proxValue[4]; //von links (0) nach rechts (3)
29
+uint8_t proxValue[4]; //Abstandssensoren v.l.(0)n.r.(3)
30 30
 
31
-int16_t encoderCounts[2]; //von links (0) nach rechts (1)
32
-int16_t driveRotation[2];
31
+int16_t encoderCounts[2]; //Anzahl der Umdrehungen
32
+int16_t driveRotation[2]; //von links (0) nach rechts (1)
33 33
 
34 34
 int32_t rotationAngle = 0; //Drehwinkel
35 35
 int32_t turnAngle = 0;
@@ -45,10 +45,10 @@ uint16_t compassLastUpdate;
45 45
 
46 46
 uint16_t LastUpdate = 0; //Systemzeit
47 47
 uint16_t CycleTime = 0; //Zykluszeit
48
-int maxSpeed = 200; //Maximale Geschwindigkeit (möglich 400)
48
+int maxSpeed = 200; //Maximale Geschwindigkeit (max. 400)
49 49
 char dir; //Fahrtrichtung, Ereignis
50 50
 char report[200]; //Ausgabe
51
-String btData;
51
+String btData; //Gelesene Daten aus Bluetooth
52 52
 
53 53
 /*-----------------------------------------------------------------*/
54 54
 
@@ -97,7 +97,7 @@ void GyroSetup()
97 97
   int32_t total = 0;
98 98
   for (uint16_t i = 0; i < 1024; i++)
99 99
   {
100
-    while(!gyro.readReg(L3G::STATUS_REG) & 0x08);
100
+    while(!gyro.readReg(L3G::STATUS_REG) & 0x08); //Fehlerabfrage
101 101
     gyro.read();
102 102
     total += gyro.g.z;
103 103
   }
@@ -220,7 +220,7 @@ void EncoderUpdate()
220 220
 
221 221
 /*-----------------------------------------------------------------*/
222 222
 
223
- //Funktion Kollisionserkennung
223
+//Funktion Kollisionserkennung
224 224
 void Kollisionserkennung()
225 225
 {
226 226
   dir = 'X';
@@ -273,7 +273,7 @@ void Hindernisumfahren()
273 273
   proxSensors.read();
274 274
   proxValue[1] = proxSensors.countsFrontWithLeftLeds();
275 275
   proxValue[2] = proxSensors.countsFrontWithRightLeds();
276
-  if(proxValue[1] < 4 || proxValue[2] < 4)
276
+  if(proxValue[1] < 5 || proxValue[2] < 5)
277 277
   {
278 278
     //Schritt 2: Hindernis passieren
279 279
     motors.setSpeeds(maxSpeed, maxSpeed);

+ 14 - 13
ArduinoOutput/sketch/Hauptprojekt.ino.cpp

@@ -2,7 +2,7 @@
2 2
 #line 1 "c:\\Users\\Carolin\\Downloads\\VSCode\\Zumo32U4\\Zumo32U4\\Hauptprojekt\\Hauptprojekt.ino"
3 3
 #line 1 "c:\\Users\\Carolin\\Downloads\\VSCode\\Zumo32U4\\Zumo32U4\\Hauptprojekt\\Hauptprojekt.ino"
4 4
 //Verfassser: Felix Stange, 4056379, MET2016 
5
-//Datum: erstellt am 19.07.2017, zuletzt geändert am 06.02.2018 
5
+//Datum: erstellt am 19.07.2017, zuletzt geändert am 21.02.2018 
6 6
 //Projektbeschreibung: Der Zumo fährt automatisch zwischen 2 Linien ohne diese zu überfahren mithilfe 
7 7
 //der Liniensensoren (3), ähnlich einer Spurhalteautomatik (heller Belag und dunkle Streifen). 
8 8
 //Außerdem werden Kollisionen verhindert durch Nutzung der vorderen Abstandssensoren. Kommt es 
@@ -18,19 +18,19 @@
18 18
 
19 19
 Zumo32U4ProximitySensors  proxSensors;  //Abstandssensoren
20 20
 Zumo32U4LineSensors       lineSensors;  //Liniensensoren
21
-Zumo32U4Motors            motors;
22
-Zumo32U4ButtonA           buttonA;
21
+Zumo32U4Motors            motors;       //Motoren
22
+Zumo32U4ButtonA           buttonA;      //Taste A
23 23
 Zumo32U4Encoders          encoders;     //Motorencoder
24 24
 LSM303                    compass;      //Beschleunigungssensor x-Achse
25 25
 L3G                       gyro;         //Drehbewegungssensor z-Achse
26 26
 
27
-int16_t   lineValue[3];                 //von links (0) nach rechts (2)
28
-uint16_t  lineOffset[3]; 
27
+int16_t   lineValue[3];                 //Liniensensoren
28
+uint16_t  lineOffset[3];                //von links (0) nach rechts (2)
29 29
 
30
-uint8_t   proxValue[4];                 //von links (0) nach rechts (3)
30
+uint8_t   proxValue[4];                 //Abstandssensoren v.l.(0)n.r.(3)
31 31
 
32
-int16_t   encoderCounts[2];             //von links (0) nach rechts (1)
33
-int16_t   driveRotation[2];
32
+int16_t   encoderCounts[2];             //Anzahl der Umdrehungen
33
+int16_t   driveRotation[2];             //von links (0) nach rechts (1)
34 34
 
35 35
 int32_t   rotationAngle = 0;            //Drehwinkel
36 36
 int32_t   turnAngle = 0; 
@@ -46,10 +46,10 @@ uint16_t  compassLastUpdate;
46 46
 
47 47
 uint16_t  LastUpdate = 0;               //Systemzeit
48 48
 uint16_t  CycleTime = 0;                //Zykluszeit
49
-int       maxSpeed = 200;               //Maximale Geschwindigkeit (möglich 400)
49
+int       maxSpeed = 200;               //Maximale Geschwindigkeit (max. 400)
50 50
 char      dir;                          //Fahrtrichtung, Ereignis
51 51
 char      report[200];                  //Ausgabe
52
-String    btData;
52
+String    btData;                       //Gelesene Daten aus Bluetooth
53 53
 
54 54
 /*-----------------------------------------------------------------*/
55 55
 
@@ -133,7 +133,7 @@ void GyroSetup()
133 133
   int32_t total = 0;                                              
134 134
   for (uint16_t i = 0; i < 1024; i++)
135 135
   {
136
-    while(!gyro.readReg(L3G::STATUS_REG) & 0x08);
136
+    while(!gyro.readReg(L3G::STATUS_REG) & 0x08);                 //Fehlerabfrage
137 137
     gyro.read();
138 138
     total += gyro.g.z;
139 139
   }
@@ -256,7 +256,7 @@ void EncoderUpdate()
256 256
 
257 257
 /*-----------------------------------------------------------------*/
258 258
 
259
- //Funktion Kollisionserkennung
259
+//Funktion Kollisionserkennung
260 260
 void Kollisionserkennung()                                            
261 261
 {
262 262
   dir = 'X';
@@ -309,7 +309,7 @@ void Hindernisumfahren()
309 309
   proxSensors.read();                                                 
310 310
   proxValue[1] = proxSensors.countsFrontWithLeftLeds();
311 311
   proxValue[2] = proxSensors.countsFrontWithRightLeds();  
312
-  if(proxValue[1] < 4 || proxValue[2] < 4)
312
+  if(proxValue[1] < 5 || proxValue[2] < 5)
313 313
   {
314 314
     //Schritt 2: Hindernis passieren
315 315
     motors.setSpeeds(maxSpeed, maxSpeed);                    
@@ -527,3 +527,4 @@ void loop()
527 527
   //Ausgabe über Bluetoothverbindung
528 528
   SerialOutput();                                                         
529 529
 }
530
+

BIN
ArduinoOutput/sketch/Hauptprojekt.ino.cpp.o


+ 28 - 27
Zumo32U4/Hauptprojekt/Hauptprojekt.ino

@@ -1,5 +1,5 @@
1 1
 //Verfassser: Felix Stange, 4056379, MET2016 
2
-//Datum: erstellt am 19.07.2017, zuletzt geändert am 15.02.2018 
2
+//Datum: erstellt am 19.07.2017, zuletzt geändert am 01.03.2018 
3 3
 //Projektbeschreibung: Der Zumo fährt automatisch zwischen 2 Linien ohne diese zu überfahren mithilfe 
4 4
 //der Liniensensoren (3), ähnlich einer Spurhalteautomatik (heller Belag und dunkle Streifen). 
5 5
 //Außerdem werden Kollisionen verhindert durch Nutzung der vorderen Abstandssensoren. Kommt es 
@@ -15,19 +15,19 @@
15 15
 
16 16
 Zumo32U4ProximitySensors  proxSensors;  //Abstandssensoren
17 17
 Zumo32U4LineSensors       lineSensors;  //Liniensensoren
18
-Zumo32U4Motors            motors;
19
-Zumo32U4ButtonA           buttonA;
18
+Zumo32U4Motors            motors;       //Motoren
19
+Zumo32U4ButtonA           buttonA;      //Taste A
20 20
 Zumo32U4Encoders          encoders;     //Motorencoder
21 21
 LSM303                    compass;      //Beschleunigungssensor x-Achse
22 22
 L3G                       gyro;         //Drehbewegungssensor z-Achse
23 23
 
24
-int16_t   lineValue[3];                 //von links (0) nach rechts (2)
25
-uint16_t  lineOffset[3]; 
24
+int16_t   lineValue[3];                 //Liniensensoren
25
+uint16_t  lineOffset[3];                //von links (0) nach rechts (2)
26 26
 
27
-uint8_t   proxValue[4];                 //von links (0) nach rechts (3)
27
+uint8_t   proxValue[4];                 //Abstandssensoren v.l.(0)n.r.(3)
28 28
 
29
-int16_t   encoderCounts[2];             //von links (0) nach rechts (1)
30
-int16_t   driveRotation[2];
29
+int16_t   encoderCounts[2];             //Anzahl der Umdrehungen
30
+int16_t   driveRotation[2];             //von links (0) nach rechts (1)
31 31
 
32 32
 int32_t   rotationAngle = 0;            //Drehwinkel
33 33
 int32_t   turnAngle = 0; 
@@ -43,10 +43,10 @@ uint16_t  compassLastUpdate;
43 43
 
44 44
 uint16_t  LastUpdate = 0;               //Systemzeit
45 45
 uint16_t  CycleTime = 0;                //Zykluszeit
46
-int       maxSpeed = 200;               //Maximale Geschwindigkeit (möglich 400)
46
+int       maxSpeed = 200;               //Maximale Geschwindigkeit (max. 400)
47 47
 char      dir;                          //Fahrtrichtung, Ereignis
48 48
 char      report[200];                  //Ausgabe
49
-String    btData;
49
+String    btData;                       //Gelesene Daten aus Bluetooth
50 50
 
51 51
 /*-----------------------------------------------------------------*/
52 52
 
@@ -95,7 +95,7 @@ void GyroSetup()
95 95
   int32_t total = 0;                                              
96 96
   for (uint16_t i = 0; i < 1024; i++)
97 97
   {
98
-    while(!gyro.readReg(L3G::STATUS_REG) & 0x08);
98
+    while(!gyro.readReg(L3G::STATUS_REG) & 0x08);                 //Fehlerabfrage
99 99
     gyro.read();
100 100
     total += gyro.g.z;
101 101
   }
@@ -218,20 +218,23 @@ void EncoderUpdate()
218 218
 
219 219
 /*-----------------------------------------------------------------*/
220 220
 
221
- //Funktion Kollisionserkennung
222
-void Kollisionserkennung()                                            
221
+//Funktion Kontaktvermeiden
222
+void Kontaktvermeiden()                                            
223 223
 {
224 224
   dir = 'X';
225
-  Serial1.println("Kollision");
225
+  Serial1.println("Kontaktvermeiden");
226 226
   ledRed(1);
227 227
 
228 228
   motors.setSpeeds(0, 0);
229 229
   delay(500);
230
-  while(lineValue[0] < 300 && lineValue[2] < 300)
230
+  while(proxValue[1] == 0 || proxValue[2] == 0)
231 231
   {
232
+    ProxUpdate();
232 233
     motors.setSpeeds(-maxSpeed/2, -maxSpeed/2);
234
+    if(lineValue[0] > 300 || lineValue[2] > 300) return;
233 235
   }
234 236
   delay(500); 
237
+  Serial1.println("Vermeiden beendet");
235 238
 }
236 239
 
237 240
 //Funktion Hindernisumfahrung
@@ -268,21 +271,17 @@ void Hindernisumfahren()
268 271
   motors.setSpeeds(maxSpeed, maxSpeed); 
269 272
 
270 273
   //Gegenverkehr beachten
271
-  proxSensors.read();                                                 
272
-  proxValue[1] = proxSensors.countsFrontWithLeftLeds();
273
-  proxValue[2] = proxSensors.countsFrontWithRightLeds();  
274
+  ProxUpdate();
274 275
   if(proxValue[1] < 5 || proxValue[2] < 5)
275 276
   {
276 277
     //Schritt 2: Hindernis passieren
277 278
     motors.setSpeeds(maxSpeed, maxSpeed);                    
278 279
     delay(1000);
279
-    proxSensors.read();
280
-    proxValue[3] = proxSensors.countsRightWithRightLeds();  
280
+    ProxUpdate(); 
281 281
     while(proxValue[3] > 4)
282 282
     {
283 283
       motors.setSpeeds(maxSpeed, maxSpeed);  
284
-      proxSensors.read();
285
-      proxValue[3] = proxSensors.countsRightWithRightLeds();  
284
+      ProxUpdate();
286 285
       Spurhalten();
287 286
     }
288 287
   }
@@ -323,7 +322,7 @@ void Abbiegen()
323 322
   ledYellow(1); 
324 323
   Serial1.println("Abbiegen");  
325 324
 
326
-  //Kodierung analysieren
325
+  //Markierung analysieren
327 326
   bool  leftCode;                                                         //links => 1
328 327
   bool  rightCode;                                                        //rechts => 2
329 328
   if(lineValue[0] > 1000) leftCode = true;
@@ -420,13 +419,14 @@ void Spurhalten()
420 419
   { 
421 420
     dir = 'B';  
422 421
     ledRed(1); 
423
-    Serial1.println("Spur verlassen");  
422
+    Serial1.println("Spurfinden");  
424 423
     Serial1.println("1"); 
425 424
     while(lineValue[0] < 300 && lineValue[2] < 300)                 //Zumo fährt solange rückwärst bis er wieder auf der Spur steht
426 425
     {
427 426
       motors.setSpeeds(-maxSpeed/2, -maxSpeed/2);
428 427
     }
429 428
     delay(500);    
429
+    Serial1.println("Spur gefunden");  
430 430
   }  
431 431
 
432 432
   //normale Fahrt
@@ -469,7 +469,8 @@ void loop()
469 469
   //Funktionsauswahl
470 470
   btData = Serial1.readString();
471 471
   //verfügbare Funktionen bei laufenden Manövern
472
-  if(btData == "Abbiegen" || btData == "Hindernisumfahren" || btData == "Kollision")                                                  
472
+  if(btData == "Abbiegen" || btData == "Hindernisumfahren" 
473
+  || btData == "Kontaktvermeiden"|| btData == "Spurfinden")                                                  
473 474
   {
474 475
     maxSpeed = 100;
475 476
     if(moveRate > 1000 || proxValue[1] > 4 || proxValue[2] > 4 || lineValue[0] > 1000 || 
@@ -479,7 +480,7 @@ void loop()
479 480
   //verfügbare Funktionen im Normalfall
480 481
   else                                                              
481 482
   {
482
-    if(moveRate > 1000) Kollisionserkennung();         
483
+    if(moveRate > 1000) Kontaktvermeiden();         
483 484
     else if(proxValue[1] == 6 || proxValue[2] == 6) motors.setSpeeds(0, 0);  
484 485
     else if(proxValue[1] == 5 || proxValue[2] == 5) Hindernisumfahren();
485 486
     else if(lineValue[0] > 1000 || lineValue[2] > 1000) Abbiegen();
@@ -488,4 +489,4 @@ void loop()
488 489
 
489 490
   //Ausgabe über Bluetoothverbindung
490 491
   SerialOutput();                                                         
491
-}
492
+}