Vanmorgen aan gewerkt

Dependencies:   FastPWM HIDScope MODSERIAL QEI biquadFilter mbed

Fork of Project_BioRobotics by Jordi Luong

Files at this revision

API Documentation at this revision

Comitter:
SybrandBumaCDA
Date:
Wed Nov 01 11:12:48 2017 +0000
Parent:
12:12b72bd60fd1
Commit message:
1-11-2017 werkt ongeveer;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Nov 01 06:46:29 2017 +0000
+++ b/main.cpp	Wed Nov 01 11:12:48 2017 +0000
@@ -40,7 +40,7 @@
 const double motorRatio = 131.25;                                               // Ratio of the gearbox in the motors []
 const double radPerPulse = 2*pi/(32*motorRatio);                                // Amount of radians the motor rotates per encoder pulse [rad/pulse]
 double xVelocity = 0, yVelocity = 0;                                            // X and Y velocities of the end effector at the start
-double velocity = 0.07;                                                          // X and Y velocity of the end effector when desired
+double velocity = 0.05;                                                          // X and Y velocity of the end effector when desired
 
 // MOTOR 1
 volatile double position1;                                                               // Position of motor 1 [rad]
@@ -48,9 +48,9 @@
 double motor1Max = 0;                                                 // Maximum rotation of motor 1 [rad]
 double motor1Min = 2*pi*-40/360;                                                           // Minimum rotation of motor 1 [rad]
 // Controller gains
-const double motor1_KP = 7;                                                     // Position gain []
-const double motor1_KI = 9;                                                     // Integral gain []
-const double motor1_KD = 1;                                                   // Derivative gain []
+const double motor1_KP = 13;                                                     // Position gain []
+const double motor1_KI = 7;                                                     // Integral gain []
+const double motor1_KD = 0.3;                                                   // Derivative gain []
 double motor1_err_int = 0, motor1_prev_err = 0;
 // Derivative filter coefficients
 const double motor1_f_a1 = 0.25, motor1_f_a2 = 0.8;                              // Derivative filter coefficients []
@@ -61,12 +61,14 @@
 // MOTOR 2
 volatile double position2;                                                               // Position of motor 2 [rad]
 volatile double reference2 = 0;                                                          // Desired rotation of motor 2 [rad]
-double motor2Max = 2*pi*30/360;                                                 // Maximum rotation of motor 2 [rad]
-double motor2Min = 2*pi*-30/360;                                                // Minimum rotation of motor 2 [rad]
+double motor2Max = 2*pi*25/360;                                                 // Maximum rotation of motor 2 [rad]
+double motor2Min = 2*pi*-28/360;                                                // Minimum rotation of motor 2 [rad]
 // Controller gains
-const double motor2_KP = potmeter1*10;                                                     // Position gain []
-const double motor2_KI = potmeter2*20;                                                     // Integral gain []
-const double motor2_KD = 1;                                                   // Derivative gain []
+//const double motor2_KP = potmeter1*10;                                                     // Position gain []
+//const double motor2_KI = potmeter2*20;                                                     // Integral gain []
+const double motor2_KP = 13;                                                     // Position gain []
+const double motor2_KI = 5;                                                     // Integral gain []
+const double motor2_KD = 0.1;                                                   // Derivative gain []
 double motor2_err_int = 0, motor2_prev_err = 0;
 // Derivative filter coefficients
 const double motor2_f_a1 = 0.25, motor2_f_a2 = 0.8;                              // Derivative filter coefficients []