PID motor controll for the biorobotics project.

Dependencies:   FastPWM QEI

Dependents:   PID_example Motor_calibration Demo_mode Demo_mode ... more

Revision:
12:2c65bcbebf8a
Parent:
10:d50c4957a193
Child:
13:9be1857401f8
diff -r 34bd7f42c9db -r 2c65bcbebf8a motor.h
--- a/motor.h	Wed Oct 31 10:45:40 2018 +0000
+++ b/motor.h	Wed Oct 31 16:19:09 2018 +0000
@@ -36,6 +36,9 @@
     
     double target_angle;
     
+    // Maximum pwm fraction that this motor is allowed to output.
+    double max_pwm_fraction;
+    
     // For debugging purposes;
     Serial* pc;
     bool serial_debugging;
@@ -53,6 +56,10 @@
     // On top of the gear box in the motor.
     void set_extra_reduction_ratio(double ratio);
     
+    void set_max_pwm_fraction(double fraction) {
+        max_pwm_fraction = fraction;
+    };
+    
     // Starts the motor controller with the specified update period.
     void start(float period);
     // Stops the motor immediately.