Biorobotics 7 / Mbed 2 deprecated Motor_calibration

Dependencies:   BioroboticsMotorControl mbed BioroboticsEMGFilter MODSERIAL

Files at this revision

API Documentation at this revision

Comitter:
MAHCSnijders
Date:
Wed Oct 31 09:12:19 2018 +0000
Child:
1:9c75e4cca419
Commit message:
Motor Calibration without break at final angles (home state)

Changed in this revision

BioroboticsMotorControl.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BioroboticsMotorControl.lib	Wed Oct 31 09:12:19 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/teams/Biorobotics-7/code/BioroboticsMotorControl/#d83c79716ea1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 31 09:12:19 2018 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+
+Motor motor1(D6, D7, D13, D12);             // Defining motor pins (PWM, direction, encoder)
+Motor motor2(D5, D4, D10, D11);             // Defining motor pins (PWM, direction, encoder)
+
+const double Kp = 10.0;
+const double Ki = 0.1;
+const double Kd = 0.5;
+
+Ticker motor_cali;
+
+void Motor_Calibration()
+{
+    float motor_angle1 = motor1.get_current_angle;
+    motor_angle1--;
+    motor1.set_target_angle(motor_angle1);   
+    
+    float motor_angle2 = motor2.get_current_angle;
+    motor_angle2--;
+    motor2.set_target_angle(motor_angle2);
+}
+
+int main()
+{
+    motor1.set_pid_k_values(Kp, Ki, Kd);    // Attach PID-controller
+    motor2.set_pid_k_values(Kp, Ki, Kd);
+    motor1.start(pid_period)                // Attach PID time
+    motor2.start(pid_period);
+    motor.attach(Motor_Calibration,0.5);    // Ticker for motor calibration fucntion
+    while (true) {}                         // Empty while loop to keep function from stopping
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 31 09:12:19 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file