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.
Dependents: harurobo1006 harurobo_1026
Fork of EC by
Revision 35:d491d9a8343f, committed 2018-10-10
- Comitter:
- aoikoizumi
- Date:
- Wed Oct 10 04:21:47 2018 +0000
- Parent:
- 34:b34dc495b3c8
- Commit message:
- SpeedController ???1.1 by??
; ??????????????
Changed in this revision
| SpeedController.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/SpeedController.cpp Thu Jul 05 01:23:58 2018 +0000
+++ b/SpeedController.cpp Wed Oct 10 04:21:47 2018 +0000
@@ -18,13 +18,15 @@
void SpeedControl::Sc(double target_omega){ //スカンジウムじゃないよ
now_omega=omega;
now_time_=timer.read();
- diff= target_omega-now_omega;
+ diff= (target_omega-now_omega)/C;
out_duty=Kv_p*diff+Kv_d*(diff-diff_old)/(now_time_-old_time_);
diff_old=diff;
+
if(out_duty>0.1)out_duty=0.1;
if(out_duty<-0.1)out_duty=-0.1;
- if((duty>=-0.95)&&(duty<=0.95)) out+=out_duty;
- duty=0.00002*out+target_omega/C;
+
+ if((duty>=-0.95)&&(duty<=0.95)) duty=duty+out_duty;
+ //duty=target_omega/C;
if(duty<-0.95)duty=-0.95;
else if(duty>0.95)duty=0.95;
old_time_=now_time_;
