shata
Revision 2:113b6a35d37c, committed 2021-12-10
- Comitter:
- shatari
- Date:
- Fri Dec 10 14:04:16 2021 +0000
- Parent:
- 1:76da1a46652f
- Commit message:
- a
Changed in this revision
MotorController.cpp | Show annotated file Show diff for this revision Revisions of this file |
MotorController.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MotorController.cpp Mon Oct 25 10:20:35 2021 +0000 +++ b/MotorController.cpp Fri Dec 10 14:04:16 2021 +0000 @@ -111,6 +111,7 @@ { ///////////////////////////////////////////////加速度制限 double target_omega=target_omega_input; + present_target_omega = target_omega; if((target_omega_input-pre_target_omega)>acceleration_max) { target_omega=pre_target_omega+acceleration_max; } else if((target_omega_input-pre_target_omega)<-acceleration_max) { @@ -120,6 +121,7 @@ ec_->calOmega(); double omega = ec_->getOmega(); double devia = target_omega - omega; + present_devia_omega = devia; double pid = sc_pid->calP_D(devia,ec_->getAcceleration()); double duty_; if (target_omega > 0.0) {
--- a/MotorController.h Mon Oct 25 10:20:35 2021 +0000 +++ b/MotorController.h Fri Dec 10 14:04:16 2021 +0000 @@ -34,6 +34,9 @@ public: MotorController(PinName motor_p_, PinName motor_n_,double dt, Ec &ec, CalPID &sc_, CalPID &ac_duty, CalPID &ac_omega);//引数は下行 //モーター正転、逆転、周期[s]、エンコーダ、速度制御用のPID、角度制御のPID、速度制御利用の角度制御のPID + + double present_devia_omega; + double present_target_omega; //////////////////////////////////////////各クラスのコンストラクタ引数で設定はされているので呼び出しは不要。変更したい場合などに void period(double s);//pwm周期設定用関数