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.
Revision 10:63381713610c, committed 2019-03-03
- Comitter:
- Stevie
- Date:
- Sun Mar 03 11:22:24 2019 +0000
- Parent:
- 9:0d274fc2e6df
- Commit message:
- Initial tuning complete.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Mar 03 11:16:16 2019 +0000 +++ b/main.cpp Sun Mar 03 11:22:24 2019 +0000 @@ -73,8 +73,8 @@ float pos_change = 0; //temp variable for speed control float speed_error = 0; //temp variable for speed control - float Kp = 0.01; //proportional constant - float Ki = 0.01; //integral constant + float Kp = 0.02; //proportional constant + float Ki = 0.05; //integral constant int i = 0; // float distance_error = 0; @@ -123,7 +123,7 @@ targetSpeed=(int)calcSpeed((float)m_count[i], 0.0f, (float)m_distance_ref[i], (float)max_accel, (float)m_top_speed[i]);//m_speed_ref is used as top speed speed_error = pos_change - targetSpeed; //calculate different between current speed and reference speed integral[i] = integral[i] + speed_error; - m_duty[i] = Kp*0.1*speed_error + Ki*integral[i]; //speed proportional control + m_duty[i] = Kp*0.1*speed_error + Ki*0.1*integral[i]; //speed proportional control } }