my new gear...

Dependencies:   mbed

Revision:
2:e7b09385d197
Parent:
0:1456b6f84c75
Child:
8:1ca5a2052b0c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/actuator/IMC_motorDrive.hpp	Sun Mar 27 04:39:16 2022 +0000
@@ -0,0 +1,30 @@
+#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_);
+    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;
+    Port motor;
+};
\ No newline at end of file