State machine

Dependencies:   mbed Adafruit_GFX BioroboticsMotorControl MODSERIAL BioroboticsEMGFilter

Files at this revision

API Documentation at this revision

Comitter:
MAHCSnijders
Date:
Mon Nov 05 16:03:39 2018 +0000
Parent:
50:5d2176b93a65
Commit message:
Fixed comments

Changed in this revision

BioroboticsEMGFilter.lib Show annotated file Show diff for this revision Revisions of this file
BioroboticsMotorControl.lib Show annotated file Show diff for this revision Revisions of this file
constants.h Show annotated file Show diff for this revision Revisions of this file
inverse_kinematics.h Show annotated file Show diff for this revision Revisions of this file
--- a/BioroboticsEMGFilter.lib	Mon Nov 05 10:14:31 2018 +0000
+++ b/BioroboticsEMGFilter.lib	Mon Nov 05 16:03:39 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/Biorobotics-7/code/BioroboticsEMGFilter/#6f94822d22cb
+https://os.mbed.com/teams/Biorobotics-7/code/BioroboticsEMGFilter/#d5a7bc2cc111
--- a/BioroboticsMotorControl.lib	Mon Nov 05 10:14:31 2018 +0000
+++ b/BioroboticsMotorControl.lib	Mon Nov 05 16:03:39 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/Biorobotics-7/code/BioroboticsMotorControl/#9be1857401f8
+https://os.mbed.com/teams/Biorobotics-7/code/BioroboticsMotorControl/#e5fc69651b1d
--- a/constants.h	Mon Nov 05 10:14:31 2018 +0000
+++ b/constants.h	Mon Nov 05 16:03:39 2018 +0000
@@ -32,7 +32,7 @@
 const float L6 = 1.0;                       // Length beam between frame 0 and motor 1 [meter]
 
 // For inverse kinematics, maximum values for angles.
-const float max_r_angle = 2.96706; // If delta is larger than 175 degrees r is larger than this
+const float max_r_length = 0.2399; // If delta is too large the device will get stuck
 // Maximum and minimum angles of the main and secondary arm.
 const float main_arm_max_angle = 2.79253;
 const float main_arm_min_angle = main_motor_calibration_angle - 0.05;
--- a/inverse_kinematics.h	Mon Nov 05 10:14:31 2018 +0000
+++ b/inverse_kinematics.h	Mon Nov 05 16:03:39 2018 +0000
@@ -32,9 +32,9 @@
     float q2 = PI - alfa;                                                   // Angle between L1 and L2
     
     // Delta < 175 graden SAFETY LIMITATION
-    if (r > max_r_angle)                                        // If delta is larger than 175 degrees then r is this
+    if (r > max_r_length)                                        // If delta is larger than 175 degrees then r is this
     {
-        r = max_r_angle;
+        r = max_r_length;
     }
     
     // Calculation of motor_angle2
@@ -43,7 +43,7 @@
     dest_sec_angle = zeta - beta;
     
 
-    // Determining angle delta for safety
+    // Determining angle delta for safety (not necessary for calculation, for debugging purposes)
     float J1x_0 = L0 + L6 + L1*cos(dest_sec_angle);                       // x-coordinate of joint 1 in frame 0
     float J1y_0 = L1*sin(dest_sec_angle);                                 // y-coordinate of joint 1 in frame 0   
     
@@ -52,7 +52,7 @@
 
     
     // Implementing stops for safety
-    // 45 < Motor_angle1 < 70 graden
+    // 45 < Motor_angle1 < 160 graden
     if (dest_main_angle < main_arm_min_angle)                             // If motor_angle is smaller than 45 degrees
     {
         dest_main_angle = main_arm_min_angle;