Working, Clean

Dependencies:   AnglePosition2 Encoder FastPWM MovementClean PIDController Servo SignalNumberClean biquadFilter mbed

Fork of ShowIt by Dustin Berendsen

Files at this revision

API Documentation at this revision

Comitter:
peterknoben
Date:
Tue Nov 07 09:31:19 2017 +0000
Parent:
14:a8a69fee3fad
Commit message:
Final Version

Changed in this revision

SignalNumber.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r a8a69fee3fad -r a73b5abd0696 SignalNumber.lib
--- a/SignalNumber.lib	Thu Nov 02 15:11:19 2017 +0000
+++ b/SignalNumber.lib	Tue Nov 07 09:31:19 2017 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/peterknoben/code/SignalNumberClean/#893503895342
+https://os.mbed.com/users/peterknoben/code/SignalNumberClean/#9098c6b1897b
diff -r a8a69fee3fad -r a73b5abd0696 main.cpp
--- a/main.cpp	Thu Nov 02 15:11:19 2017 +0000
+++ b/main.cpp	Tue Nov 07 09:31:19 2017 +0000
@@ -196,10 +196,10 @@
 float position_math_l =0, position_math_r=0;
 
 void motor1_control(){
-    float reference_alpha = Angle.getbeta(max_rangex, max_rangey, x_offset, y_offset, beta_offset, L1, L2, position_math_l, position_math_r);
-    float position_alpha = RAD_PER_PULSE * encoder1.getPosition();
-    float error_alpha = reference_alpha-position_alpha;
-    float magnitude1 = PID.get(error_alpha, MOTOR1_KP, MOTOR1_KI, MOTOR1_KD, CONTROLLER_TS, M1_N, M1_v1, M1_v2) / motor1_gain;
+    float reference_beta = Angle.getbeta(max_rangex, max_rangey, x_offset, y_offset, beta_offset, L1, L2, position_math_l, position_math_r);
+    float position_beta = RAD_PER_PULSE * encoder1.getPosition();
+    float error_beta = reference_beta-position_beta;
+    float magnitude1 = PID.get(error_beta, MOTOR1_KP, MOTOR1_KI, MOTOR1_KD, CONTROLLER_TS, M1_N, M1_v1, M1_v2) / motor1_gain;
     //Determine Motor Magnitude
     if (fabs(magnitude1)>1) {
         motor1 = 1;
@@ -231,10 +231,10 @@
 const float M2_N = 0.5;
 
 void motor2_control(){
-    float reference_beta = Angle.getalpha(max_rangex, max_rangey, x_offset, y_offset, alpha_offset, L1, L2, position_math_l, position_math_r);
-    float position_beta = RAD_PER_PULSE * -encoder2.getPosition();
-    float error_beta = reference_beta-position_beta;
-    float magnitude2 = PID.get(error_beta, MOTOR2_KP, MOTOR2_KI, MOTOR2_KD, CONTROLLER_TS, M2_N, M1_v1, M1_v2) / motor2_gain;
+    float reference_alpha = Angle.getalpha(max_rangex, max_rangey, x_offset, y_offset, alpha_offset, L1, L2, position_math_l, position_math_r);
+    float position_alpha = RAD_PER_PULSE * -encoder2.getPosition();
+    float error_alpha = reference_alpha-position_alpha;
+    float magnitude2 = PID.get(error_alpha, MOTOR2_KP, MOTOR2_KI, MOTOR2_KD, CONTROLLER_TS, M2_N, M1_v1, M1_v2) / motor2_gain;
     //Determine Motor Magnitude
     if (fabs(magnitude2)>1) {
         motor2 = 1;