navigation updated with completed dijkstra's algo
Dependents: R5 2016 Robotics Team 1
Diff: navigation.cpp
- Revision:
- 3:27cc2bacd6af
- Parent:
- 2:17bd430aeca1
- Child:
- 4:a5d44517c65c
diff -r 17bd430aeca1 -r 27cc2bacd6af navigation.cpp --- a/navigation.cpp Wed Jan 27 20:48:42 2016 +0000 +++ b/navigation.cpp Wed Feb 17 16:47:15 2016 +0000 @@ -200,34 +200,28 @@ { /* do nothing */ } -int returnVal = 0; + /* send -(differenceAngle) to motors */ - returnVal = drive.move(0, ((-differenceAngle)*(PI / 180.0)) ); - pc.printf("\nChanged angle %f degrees to %f", differenceAngle, targetAngle); -pc.printf("\n ReturnVal = %i\n", returnVal); + int returnVal = drive.move(0, ((-differenceAngle)*(PI / 180.0)) ); + pc.printf("\nChanged angle %f degrees to %f", differenceAngle, targetAngle); + // wait for move to complete while(!drive.isMoveDone()) { -pc.printf("\n Value of isMoveDone = %i", drive.isMoveDone()); -pc.printf("\n leftSteps - %i", drive.getLeftSteps() ); -pc.printf("\n rightSteps - %i", drive.getRightSteps() ); - wait(1); + wait(1e-6); } } -int returnVal = 0; + /* send targetDist to motors */ - returnVal = drive.move(targetDist, 0); + int returnVal = drive.move(targetDist, 0); pc.printf("\nMoved forward a distance of %f to node %i", targetDist, target); -pc.printf("\n ReturnVal = %i\n", returnVal); + // wait for move to complete while(!drive.isMoveDone()) { -pc.printf("\n Value of isMoveDone = %i", drive.isMoveDone()); -pc.printf("\n leftSteps - %i", drive.getLeftSteps() ); -pc.printf("\n rightSteps - %i", drive.getRightSteps() ); - wait(1); + wait(1e-6); } -pc.printf("\n Made it past the wait for move to complete"); + vertex = target; angle = targetAngle; }