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.
IMC_motorDrive.hpp
00001 #pragma once 00002 #include<mbed.h> 00003 #include <portSet.hpp> 00004 #include <rotary_inc_sp.hpp> 00005 00006 #ifdef constrain 00007 inline double constrain(double x,double minimum,double maximum){ 00008 return (x < minimum ? minimum : x > maximum ? maximum : x); 00009 } 00010 #endif 00011 00012 class IMC_motor 00013 { 00014 public: 00015 IMC_motor(Port encoder,int resolution,double wheel_ensyu,Port motor_,double K_,double Tau_,double dt_,bool CW_flag); 00016 void IMCdrive(double target); 00017 void IMCreset(); 00018 void drive(int pwm); 00019 RotaryInc motor_enc; 00020 private: 00021 double imc_out(double target); 00022 double imc_controler(double y); 00023 double process_model(double x,double mv); 00024 double process_model_val; 00025 double out_pwm; 00026 double K; 00027 double Tau; 00028 double dt; 00029 bool cw_flag; 00030 Port motor; 00031 };
Generated on Sat Oct 15 2022 07:52:33 by
1.7.2