hello
Dependencies: AVEncoder QEI mbed-src-AV
Revision 9:e2feaadf504c, committed 2015-11-20
- Comitter:
- intgsull
- Date:
- Fri Nov 20 04:18:00 2015 +0000
- Parent:
- 8:a254346f20aa
- Commit message:
- IR stuff added
Changed in this revision
AVEncoder.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a254346f20aa -r e2feaadf504c AVEncoder.lib --- a/AVEncoder.lib Wed Nov 18 07:55:13 2015 +0000 +++ b/AVEncoder.lib Fri Nov 20 04:18:00 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/aravindsv/code/AVEncoder/#e0e5901955cd +https://developer.mbed.org/users/intgsull/code/AVEncoder/#e0e5901955cd
diff -r a254346f20aa -r e2feaadf504c main.cpp --- a/main.cpp Wed Nov 18 07:55:13 2015 +0000 +++ b/main.cpp Fri Nov 20 04:18:00 2015 +0000 @@ -100,7 +100,7 @@ void stop(); void moveForward(); void turn(); - +void irReset(); //irPID function to not crash into stuff @@ -127,14 +127,12 @@ eRS = 1; if(rLS > leftWall && rRS > rightWall)//walls on both sides { - leftDistance = rLS; - rightDistance = rRS; - irError = rightDistance; //– leftDistance – irOffset; - irError -= leftDistance; - irError -= irOffset; + //leftDistance = rLS; +// rightDistance = rRS; + irError = rRS-rLS-irOffset; //– leftDistance – irOffset; - irErrorD = irError; - irErrorD -= oldirError;//(irError – oldirError); + irErrorD = irError-oldirError; + //irErrorD -= oldirError;//(irError – oldirError); irErrorI += irError; } @@ -375,7 +373,7 @@ { mouse_state = TURNING; float angle = 0; - while (angle < 0.9) + while (angle < 0.90) { float gyro_val = _gyro.read() - gyro_offset; angle += gyro_val; @@ -387,4 +385,11 @@ motor2_forward = 0; motor2_reverse = 0.5; } -} \ No newline at end of file +} +void irReset() //maybe split resets +{ + eRF = 0; + eRS = 0; + eLF = 0; + eRF = 0; + } \ No newline at end of file