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 3875_Individualproject
Diff: main/main.cpp
- Revision:
- 56:1cd434b28322
- Parent:
- 55:18ea9529afb2
- Child:
- 57:9f9067e3f99e
--- a/main/main.cpp Fri Apr 17 23:52:23 2020 +0000 +++ b/main/main.cpp Fri Apr 17 23:57:07 2020 +0000 @@ -168,7 +168,7 @@ coords_x[total_points] = curr_coords[0]; coords_y[total_points] = curr_coords[1]; type[total_points] = 0b0100; // start is always 1 exit type in the north direction - explored[total_points] = 0b0100; + explored[total_points] = 0b0000; looped_path[total_points] = 0; // start node is '0' } @@ -443,7 +443,7 @@ // if( turn_angle != 180 ) { robot.forward(speed); wait(0.05); } // maybe remove - if( turn_angle == 0) { robot.forward(speed); wait(0.1); turn_select('S'); } + if( turn_angle == 0) { robot.forward(speed); wait(0.15); turn_select('S'); } else if( turn_angle == 90) { turn_select('R'); } else if( turn_angle == 180) { turn_select('B'); } else if( turn_angle == 270) { turn_select('L'); } @@ -566,102 +566,6 @@ // print_data("aft bt"); - //int curr_node = curr_index; -// bool before = false; -// bool after = false; -// int before_index; -// int after_index; -// -// bool desired_discovered = false; -// for(int k = 0; k <= path_length; k++) { -// if(looped_path[k] == point[d_node]) { desired_discovered = true; } // maybe set a variable -// if(desired_discovered == false && looped_path[k] == point[curr_node]) { before = true; before_index = k; } -// if(desired_discovered == true && looped_path[k] == point[curr_node]) { after_index = k; break; } -// } -// -// -// if( before_index < after_index ){ -// before = true; -// after = false; -// } -// else{ -// before = false; -// after = true; -// } -// -// -// char dir_diff; -// -// if(after == true) { -// -// for(int j = after_index; j >= 0; j--) { -// curr_node = path_to_point_index(looped_path[j]); -// -// int prev_node = path_to_point_index(looped_path[j-1]); -// if(coords_x[prev_node] != coords_x[curr_node]) { -// if(coords_x[prev_node] - coords_x[curr_node] > 0){ -// dir_diff = 'E'; -// } else { -// dir_diff = 'W'; -// } -// } else if( coords_y[prev_node] != coords_y[curr_node] ) { -// if(coords_y[prev_node] - coords_y[curr_node] > 0){ -// dir_diff = 'N'; -// } else { -// dir_diff = 'S'; -// } -// } -// -// if( dir_diff == 'N' ) { -// explored[curr_node] &= 0b1011; -// } -// else if( dir_diff == 'E' ) { -// explored[curr_node] &= 0b1101; -// } -// else if( dir_diff == 'S' ) { -// explored[curr_node] &= 0b1110; -// } -// else if( dir_diff == 'W' ) { -// explored[curr_node] &= 0b0111; -// } -// if(point[prev_node] == point[d_node]) { break; } -// } -// } -// -// else if( before == true ) { -// for(int j = before_index; j <= path_length; j++) { -// curr_node = path_to_point_index(looped_path[j]); -// -// int next_node = path_to_point_index(looped_path[j+1]); -// if(coords_x[next_node] != coords_x[curr_node]) { -// if(coords_x[next_node] - coords_x[curr_node] > 0){ -// dir_diff = 'E'; -// } else { -// dir_diff = 'W'; -// } -// } else if( coords_y[next_node] != coords_y[curr_node] ) { -// if(coords_y[next_node] - coords_y[curr_node] > 0){ -// dir_diff = 'N'; -// } else { -// dir_diff = 'S'; -// } -// } -// -// if( dir_diff == 'N' ) { -// explored[curr_node] &= 0b1011; -// } -// else if( dir_diff == 'E' ) { -// explored[curr_node] &= 0b1101; -// } -// else if( dir_diff == 'S' ) { -// explored[curr_node] &= 0b1110; -// } -// else if( dir_diff == 'W' ) { -// explored[curr_node] &= 0b0111; -// } -// if(point[next_node] == point[d_node]) { break; } -// } -// } } }