James Heavey / Mbed 2 deprecated 3875_DISSERTATION

Dependencies:   mbed 3875_Individualproject

Revision:
60:ea69bd1a9889
Parent:
59:11e31ce4d675
Child:
61:b31d8c997279
--- a/main/main.cpp	Sat Apr 18 18:02:36 2020 +0000
+++ b/main/main.cpp	Sat Apr 18 18:16:51 2020 +0000
@@ -466,7 +466,7 @@
         }
     }
     
-    if( fully_explored == true && completed == false) {  completed = true; looped_goal(); }
+    if( fully_explored == true ) { looped_goal(); }
     
     else {
             // compare node coordinates to previous node coordinates
@@ -1061,7 +1061,7 @@
     
     looped_goal_simplification();
     
-    bool _switch = true;
+    _switch = ~_switch;
     
     while(1) {
         
@@ -1110,25 +1110,12 @@
                 
                 update_index();
                 
-                if( _switch == true && point[curr_index] == 100 )  { break; }
-                else if( _switch == false && point[curr_index] == 0 ) { break; }
-                
                 choose_turn(); //looks at the point we are at, examines the type vs explored and makes the appropriate turn also updates the explored
             
             }
         }
         
-        turn_select('B');
-        robot.stop();
-        
-        if( dir == 'N' ) { dir = 'S'; }
-        else if( dir == 'S' ) { dir = 'N'; }
-        else if( dir == 'E' ) { dir = 'W'; }
-        else if( dir == 'W' ) { dir = 'E'; }
-        
-        robot.stop();
-        
-        _switch = ~ _switch;
+        //_switch = ~ _switch;
     }  
 }
 
@@ -1139,7 +1126,7 @@
     if ( inverse == false ) {
         for(int j = goal_length1; j >= 0; j--) {
             int curr_node = path_to_point_index(goal_path1[j]);
-            int next_node = path_to_point_index(goal_path2[j-1]);
+            int next_node = path_to_point_index(goal_path1[j-1]);
             if(coords_x[next_node] != coords_x[curr_node]) {
                 if(coords_x[next_node] - coords_x[curr_node] > 0){
                     dir_diff = 'E';
@@ -1173,7 +1160,7 @@
         
         for(int j = 0; j <= goal_length1; j++) {
             int curr_node = path_to_point_index(goal_path1[j]);
-            int next_node = path_to_point_index(goal_path2[j+1]);
+            int next_node = path_to_point_index(goal_path1[j+1]);
             if(coords_x[next_node] != coords_x[curr_node]) {
                 if(coords_x[next_node] - coords_x[curr_node] > 0){
                     dir_diff = 'E';