Created
June 16, 2016 17:16
-
-
Save adityakamath/f7f39753fc4ada0ca353d42ceb4ae17f to your computer and use it in GitHub Desktop.
Main function for Pledge_Algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
emc::Rate r(10); | |
while (io.ok()) | |
{ | |
if (io.readLaserData(scan)) | |
{ | |
check_for_invalid_LRF(); | |
detection(); | |
open_space_detect(); | |
if (openflag1 == 0) { | |
if (dead_end == 0) { | |
cout << "mode 1" << endl; | |
pledge_alg(); | |
adjust_LRF(); | |
potential_fields(0, 0, 0.1, 0); | |
} | |
else dead_end_act(); | |
} | |
else if (openflag1 == 1) { | |
cout << "mode 2" << endl; | |
random_walk(); | |
adjust_LRF(); | |
potential_fields(0, 0, 0.1, 0); | |
detection(); | |
if (openspace == 0 || left_turn || right_turn) | |
openflag1 = 0; | |
} | |
io.sendBaseReference(vx, vy, w); | |
} | |
} | |
// Sleep remaining time | |
r.sleep(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment