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: ROBOCON2017_archan ROBOCON2017_suchan
Revision 1:f1f6c98a4b12, committed 2016-09-28
- Comitter:
- Akito914
- Date:
- Wed Sep 28 01:42:33 2016 +0000
- Parent:
- 0:52549f6dd024
- Child:
- 2:e340bdcb9bca
- Commit message:
- ???????????????????
Changed in this revision
| cal_PID.cpp | Show annotated file Show diff for this revision Revisions of this file |
| cal_PID.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/cal_PID.cpp Fri Aug 26 11:30:08 2016 +0000
+++ b/cal_PID.cpp Wed Sep 28 01:42:33 2016 +0000
@@ -32,7 +32,7 @@
past_error=0;
integral_error=0;
}
-signed long cal_pid::get_pid(signed long position,signed long targ){
+signed long cal_pid::get_pid(signed long position,signed long targ,int rd){
error=targ-position;
integral_error+=error*control_period;
differential_error=(error-past_error)/control_period;
@@ -41,6 +41,7 @@
i_part=integral_error*i_gain;
d_part=differential_error*d_gain;
operate=p_part+i_part+d_part;
+ operate*=rd;
if(operate<output_min)operate=output_min;
else if(operate>output_max)operate=output_max;
--- a/cal_PID.hpp Fri Aug 26 11:30:08 2016 +0000
+++ b/cal_PID.hpp Wed Sep 28 01:42:33 2016 +0000
@@ -12,7 +12,7 @@
void period(float _control_period);
void output(signed long _min,signed long _max);
void reset();
- signed long get_pid(signed long position,signed long targ);
+ signed long get_pid(signed long position,signed long targ,int rd=1);
private:
signed long error;
signed long past_error;