der Roboter
/
Test_SlowDown
The robot's name is Geoffry in this program. This program tests the "slowstop" function
main.cpp@0:1242cb9e4142, 2014-05-20 (annotated)
- Committer:
- satyson
- Date:
- Tue May 20 14:01:44 2014 +0000
- Revision:
- 0:1242cb9e4142
This test uses the slowstop function to stop the robot without jerrking
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
satyson | 0:1242cb9e4142 | 1 | #include "m3pi_ng.h" |
satyson | 0:1242cb9e4142 | 2 | #include "mbed.h" |
satyson | 0:1242cb9e4142 | 3 | |
satyson | 0:1242cb9e4142 | 4 | m3pi Geoffry; |
satyson | 0:1242cb9e4142 | 5 | |
satyson | 0:1242cb9e4142 | 6 | int main () |
satyson | 0:1242cb9e4142 | 7 | { |
satyson | 0:1242cb9e4142 | 8 | // Give time to back away |
satyson | 0:1242cb9e4142 | 9 | |
satyson | 0:1242cb9e4142 | 10 | //set a slow speed of the robot |
satyson | 0:1242cb9e4142 | 11 | float speed = 0.3; |
satyson | 0:1242cb9e4142 | 12 | |
satyson | 0:1242cb9e4142 | 13 | // Make robot go forward |
satyson | 0:1242cb9e4142 | 14 | // Test to see if forward command operates with the wait command |
satyson | 0:1242cb9e4142 | 15 | |
satyson | 0:1242cb9e4142 | 16 | |
satyson | 0:1242cb9e4142 | 17 | Geoffry.forward(speed); |
satyson | 0:1242cb9e4142 | 18 | wait(0.5); |
satyson | 0:1242cb9e4142 | 19 | Geoffry.slowstop(speed,0.01,100); |
satyson | 0:1242cb9e4142 | 20 | Geoffry.stop(); |
satyson | 0:1242cb9e4142 | 21 | |
satyson | 0:1242cb9e4142 | 22 | |
satyson | 0:1242cb9e4142 | 23 | Geoffry.backward(speed); |
satyson | 0:1242cb9e4142 | 24 | wait(0.5); |
satyson | 0:1242cb9e4142 | 25 | Geoffry.slowstop(-1*speed,0.01,100); |
satyson | 0:1242cb9e4142 | 26 | |
satyson | 0:1242cb9e4142 | 27 | |
satyson | 0:1242cb9e4142 | 28 | |
satyson | 0:1242cb9e4142 | 29 | //This section is to test out the slowstop function |
satyson | 0:1242cb9e4142 | 30 | /* |
satyson | 0:1242cb9e4142 | 31 | Geoffry.forward(speed+0.2); |
satyson | 0:1242cb9e4142 | 32 | Geoffry.slowstop(speed+0.2,0.1,10.0); |
satyson | 0:1242cb9e4142 | 33 | |
satyson | 0:1242cb9e4142 | 34 | wait(1.0); |
satyson | 0:1242cb9e4142 | 35 | |
satyson | 0:1242cb9e4142 | 36 | Geoffry.backward(speed+0.2); |
satyson | 0:1242cb9e4142 | 37 | Geoffry.slowstop(speed+0.2,0.1,10.0); |
satyson | 0:1242cb9e4142 | 38 | wait(1.0); |
satyson | 0:1242cb9e4142 | 39 | */ |
satyson | 0:1242cb9e4142 | 40 | } |