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-rtos mbed-src pixylib
tuning.cpp@8:b0478286ad21, 2016-03-25 (annotated)
- Committer:
- balsamfir
- Date:
- Fri Mar 25 20:05:04 2016 +0000
- Revision:
- 8:b0478286ad21
- Parent:
- 7:5ef312aa2678
- Child:
- 9:62fbb69b612c
- Child:
- 10:1acbcd54359b
commit 4 james
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| balsamfir | 2:2bc519e14bae | 1 | #include "tuning.h" |
| balsamfir | 8:b0478286ad21 | 2 | #include "robot.h" |
| balsamfir | 2:2bc519e14bae | 3 | |
| balsamfir | 7:5ef312aa2678 | 4 | void SystemTuning(void) { |
| balsamfir | 8:b0478286ad21 | 5 | RunMotor(); |
| balsamfir | 8:b0478286ad21 | 6 | RunNavigation(); |
| balsamfir | 8:b0478286ad21 | 7 | char key; |
| balsamfir | 8:b0478286ad21 | 8 | float increment = 0.0000001; |
| balsamfir | 7:5ef312aa2678 | 9 | |
| balsamfir | 8:b0478286ad21 | 10 | while (1) { |
| balsamfir | 8:b0478286ad21 | 11 | |
| balsamfir | 8:b0478286ad21 | 12 | ResetWatchDog(); |
| balsamfir | 8:b0478286ad21 | 13 | |
| balsamfir | 8:b0478286ad21 | 14 | if (bt.readable()) { |
| balsamfir | 8:b0478286ad21 | 15 | char key = bt.getc(); |
| balsamfir | 8:b0478286ad21 | 16 | switch(key) { |
| balsamfir | 8:b0478286ad21 | 17 | case 'e': |
| balsamfir | 8:b0478286ad21 | 18 | motorKP = motorKP + increment; |
| balsamfir | 8:b0478286ad21 | 19 | break; |
| balsamfir | 8:b0478286ad21 | 20 | case 'e': |
| balsamfir | 8:b0478286ad21 | 21 | motorKP = motorKP + increment; |
| balsamfir | 8:b0478286ad21 | 22 | break; |
| balsamfir | 8:b0478286ad21 | 23 | case 'e': |
| balsamfir | 8:b0478286ad21 | 24 | motorKP = motorKP + increment; |
| balsamfir | 8:b0478286ad21 | 25 | break; |
| balsamfir | 8:b0478286ad21 | 26 | } |
| balsamfir | 8:b0478286ad21 | 27 | if (inKey == 'i') Kp = Kp + 0.000001; |
| balsamfir | 8:b0478286ad21 | 28 | else if (inKey == 'k') Kp = Kp - 0.000001; |
| balsamfir | 8:b0478286ad21 | 29 | else if (inKey == 'w') Ki = Ki + 0.000001; |
| balsamfir | 8:b0478286ad21 | 30 | else if (inKey == 's') Ki = Ki - 0.000001; |
| balsamfir | 8:b0478286ad21 | 31 | |
| balsamfir | 8:b0478286ad21 | 32 | if (Setpoint == 6) Setpoint = 3; |
| balsamfir | 8:b0478286ad21 | 33 | else Setpoint = 6; |
| balsamfir | 8:b0478286ad21 | 34 | |
| balsamfir | 8:b0478286ad21 | 35 | led4=0; |
| balsamfir | 8:b0478286ad21 | 36 | } |
| balsamfir | 8:b0478286ad21 | 37 | |
| balsamfir | 8:b0478286ad21 | 38 | bt.printf("X Coordinate: %d, Height: %d \r\n", x, height); |
| balsamfir | 8:b0478286ad21 | 39 | bt.printf("Speed Set: %f, Steering Set: %f \r\n", speed, steering); |
| balsamfir | 8:b0478286ad21 | 40 | bt.printf("Left Motor Set: %f, Right Motor Set: %f \n\r", leftMotor, rightMotor); |
| balsamfir | 8:b0478286ad21 | 41 | |
| balsamfir | 8:b0478286ad21 | 42 | Thread::wait(500); // Go to sleep for 500 ms |
| balsamfir | 8:b0478286ad21 | 43 | } |
| balsamfir | 7:5ef312aa2678 | 44 | } |
| balsamfir | 7:5ef312aa2678 | 45 | |
| balsamfir | 2:2bc519e14bae | 46 | void MotorTuning(void) { |
| balsamfir | 2:2bc519e14bae | 47 | |
| balsamfir | 2:2bc519e14bae | 48 | } |
| balsamfir | 2:2bc519e14bae | 49 | |
| balsamfir | 2:2bc519e14bae | 50 | void SpeedTuning(void) { |
| balsamfir | 2:2bc519e14bae | 51 | |
| balsamfir | 2:2bc519e14bae | 52 | } |
| balsamfir | 2:2bc519e14bae | 53 | |
| balsamfir | 2:2bc519e14bae | 54 | void SteeringTuning(void) { |
| balsamfir | 2:2bc519e14bae | 55 | |
| balsamfir | 2:2bc519e14bae | 56 | } |
| balsamfir | 2:2bc519e14bae | 57 | |
| balsamfir | 2:2bc519e14bae | 58 | void TiltTuning(void) { |
| balsamfir | 2:2bc519e14bae | 59 | |
| balsamfir | 2:2bc519e14bae | 60 | } |
