Biorobotics / Robot-Software

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed Servo

Revision:
19:e1e18746d98d
Parent:
18:ea605c49afee
Child:
20:31876566d70f
--- a/main.cpp	Fri Oct 26 10:54:16 2018 +0000
+++ b/main.cpp	Fri Oct 26 11:04:30 2018 +0000
@@ -32,7 +32,7 @@
 //Global variables/objects
 States current_state;
 Ticker loop_ticker; //The Ticker object that will ensure perfect timing of our looping code
-float e, u1, u2, emg_signal_raw_0, processed_emg_0, emg_signal_raw_1, processed_emg_1, robot_end_point, reference_end_point, motor_angle, motor_counts, q_ref; //will be set by the motor_controller function
+float e, u1, u2, emg_signal_raw_0, processed_emg_0, emg_signal_raw_1, processed_emg_1, robot_end_point, reference_end_point, motor_angle_1, motor_angle_2, motor_counts, q_ref; //will be set by the motor_controller function
 int counts_per_rotation = 32;
 bool state_changed = false;
 double samplingfreq = 1000;
@@ -45,8 +45,9 @@
 
 void measure_all() 
 {
-    motor_angle = motor_counts*2.0f*3.1415926535f/counts_per_rotation; //do this here, and not in the encoder interrupt, to reduce computational load
-    robot_end_point = forwardkinematics_function(motor_angle);  //motor_angle is global, this function ne
+    motor_angle_1 = motor_counts_1*2.0f*3.1415926535f/counts_per_rotation; //do this here, and not in the encoder interrupt, to reduce computational load
+    motor_angle_2 = motor_counts_2*2.0f*3.1415926535f/counts_per_rotation;
+    robot_end_point = forwardkinematics_function(motor_angle_1,motor_angle_2);  //motor_angle is global, this function ne
     emg_signal_raw_0 = emg0.read(); //sample analog voltages (all sampling theory applies, you might get aliasing etc.)
     emg_signal_raw_1 = emg1.read();
     processed_emg_0 = processing_chain_emg(0);  // some function ‘float my_emg_processing_chain()’ that returns a float. The raw emg is global