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
Diff: Control/drivecontrol.cpp
- Revision:
- 10:e69cb200dc15
- Parent:
- 7:7215adbae3da
- Child:
- 11:61c9b9bb9294
--- a/Control/drivecontrol.cpp Sun May 14 19:57:34 2017 +0000 +++ b/Control/drivecontrol.cpp Tue May 16 02:45:23 2017 +0000 @@ -32,6 +32,8 @@ float total_error = 0.0f; float P = 18.0f, D = 3.0f; +float turn_degree = 0.0f; + namespace pid_controller { void navigate() { bool has_left_wall = leftDiagonalIR.readIR() > LEFT_WALL_THRES; @@ -79,9 +81,14 @@ // todo void turn (int dir) { // https://github.com/austinxiao-ucsd/Falcon-MicroMouse/blob/master/Micromouse_test/drive_control.h - if (TURN_LEFT) { // Flip motor + if (dir == TURN_LEFT) { + turn_degree = -90.0; } - else { // TODO: ... + else if (dir == TURN_RIGHT){ + turn_degree = 90.0; + } + else{ + turn_degree = 180.0; } } }