Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BioroboticsMotorControl mbed BioroboticsEMGFilter MODSERIAL
Revision 0:61f4586742be, committed 2018-10-31
- 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
--- /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