変な加速

Dependencies:   T_motor

Files at this revision

API Documentation at this revision

Comitter:
fujikenac
Date:
Wed Oct 25 09:29:53 2017 +0000
Parent:
0:29872002539b
Commit message:
add direct_control function

Changed in this revision

P_motor.cpp Show annotated file Show diff for this revision Revisions of this file
P_motor.h Show annotated file Show diff for this revision Revisions of this file
diff -r 29872002539b -r d0b60b54e3bd P_motor.cpp
--- a/P_motor.cpp	Fri Oct 20 09:56:12 2017 +0000
+++ b/P_motor.cpp	Wed Oct 25 09:29:53 2017 +0000
@@ -26,7 +26,7 @@
 void P_motor::run()
 {
     motor = output_m;
-    pc.printf("%+3f\n\r", output_m);
+    //pc.printf("%+3f\n\r", output_m);
 }
 
 void P_motor::compute()
@@ -46,6 +46,7 @@
         {
             //output[1] = -target / 2;
             free();
+            //output_reset(target / -2.0f);
         }
         else
         {
@@ -64,6 +65,12 @@
     }
 }
 
+void P_motor::direct_controll(double target_)
+{
+    motor = target_;
+    output_reset();
+}
+
 void P_motor::free()
 {
     motor.free();
diff -r 29872002539b -r d0b60b54e3bd P_motor.h
--- a/P_motor.h	Fri Oct 20 09:56:12 2017 +0000
+++ b/P_motor.h	Wed Oct 25 09:29:53 2017 +0000
@@ -15,7 +15,6 @@
     double time_old;
     double RC, LC;
     void compute();
-    void calc();
     void timer_reset();
     void output_reset(double value = 0);
     enum status
@@ -28,6 +27,7 @@
   public:
     P_motor(I2C *i2c_, char addr_);
     P_motor& operator=(double target_);
+    void direct_controll(double target_);
     void run();
     void free();
     void stop();