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: QEI biquadFilter mbed
Fork of Demo_TEST by
Revision 11:01372da5a144, committed 2018-10-31
- Comitter:
- TimLu
- Date:
- Wed Oct 31 11:50:31 2018 +0000
- Parent:
- 10:4034134fd7db
- Commit message:
- Poop;
Changed in this revision
| Servo.lib | Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4034134fd7db -r 01372da5a144 Servo.lib --- a/Servo.lib Wed Oct 31 08:18:51 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://os.mbed.com/users/simon/code/Servo/#36b69a7ced07
diff -r 4034134fd7db -r 01372da5a144 main.cpp
--- a/main.cpp Wed Oct 31 08:18:51 2018 +0000
+++ b/main.cpp Wed Oct 31 11:50:31 2018 +0000
@@ -1,7 +1,6 @@
#include "mbed.h"
#include "math.h"
#include "BiQuad.h"
-#include "Servo.h"
#include <string>
#include "QEI.h"
@@ -28,7 +27,7 @@
double gearratio = 3.857142857;
double radiuspulley = 0.015915; // Radius pulley [m]
- double K_v = 1.00; //velocity constant, max 6.667 ?
+ double K_v = 0.5; //velocity constant, max 6.667 ?
double L0 = 0.09; // starting length
@@ -39,7 +38,7 @@
hoekgraad2 = Encoder2.getPulses() * 0.0857142857; // Angle arm [degree]
// double hoekrad2 = hoekgraad2 * 0.0174532925;
// double hoekarm = hoekgraad2 / gearratio;
- translatie = hoekgraad /360.0 * 2.0 * pi * radiuspulley; // Translatie arm [m]
+ translatie = hoekgraad / 360.0 * 2.0 * pi * radiuspulley; // Translatie arm [m]
}
@@ -48,7 +47,7 @@
motor2direction = false; // Nu staan motoren toch op het begin allebei in positieve stand?
motor2direction = false;
-EncoderTicker.attach(&EncoderFunc, 0.005);
+EncoderTicker.attach(&EncoderFunc, 0.1);
pc.baud(115200);
pc.printf("hoekgraad=%f degrees\t translatie:%f meters /t hoekgraad2:%f degrees /n",hoekgraad, translatie, hoekgraad2);
@@ -125,11 +124,14 @@
motor2control.write(q_dot_angle);
wait(0.1); // %%%Berekening niet tegelijk, eventuele fout? %%%
- void setMotor1(float motorValue) {
- // Given motorValue<=1, writes the velocity to the pwm control.
- // MotorValues outside range are truncated to within range.
- motor1control.write(fabs(motorValue) > 1 ? 1 : fabs(motorValue));
+ //Printie op pc
+ pc.baud(115200);
+ pc.printf("q_dot_L = %f\r\n", q_dot_L );
+ pc.printf("q_dot_angle = %f\r\n", q_dot_angle );
+ pc.printf("J_inverse = \t %f , %f \r\n \t\t %f , %f \r\n", J_inv_1_1 , J_inv_1_2 , J_inv_2_1 , J_inv_2_2 );
+ pc.printf("hoekgraad_trans = %f, translatie = %f, hoekgraad2 = %f \r\n", hoekgraad , translatie, hoekgraad2);
+
} // End of while
