![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
my new gear...
actuator/IMC_motorDrive.hpp
- Committer:
- yootee
- Date:
- 22 months ago
- Revision:
- 22:394337a4205a
- Parent:
- 8:1ca5a2052b0c
File content as of revision 22:394337a4205a:
#pragma once #include<mbed.h> #include <portSet.hpp> #include <rotary_inc_sp.hpp> #ifdef constrain inline double constrain(double x,double minimum,double maximum){ return (x < minimum ? minimum : x > maximum ? maximum : x); } #endif class IMC_motor { public: IMC_motor(Port encoder,int resolution,double wheel_ensyu,Port motor_,double K_,double Tau_,double dt_,bool CW_flag); void IMCdrive(double target); void IMCreset(); void drive(int pwm); RotaryInc motor_enc; private: double imc_out(double target); double imc_controler(double y); double process_model(double x,double mv); double process_model_val; double out_pwm; double K; double Tau; double dt; bool cw_flag; Port motor; };