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: MODSERIAL biquadFilter mbed
Fork of Kinematics by
Diff: main.cpp
- Revision:
- 17:e5ca1f228fc5
- Parent:
- 12:8d3bc1fa2321
- Child:
- 18:95611fc90411
- Child:
- 22:31ec06a15ea5
diff -r 8d3bc1fa2321 -r e5ca1f228fc5 main.cpp
--- a/main.cpp Wed Oct 31 16:05:53 2018 +0000
+++ b/main.cpp Wed Oct 31 18:01:43 2018 +0000
@@ -14,41 +14,41 @@
//Joe dit zijn de inputsignalen (en tussenvariabelen)
//vorige theta
-double theta1 = PI*0.49; // huidige/nieuwe theta
-double theta4 = PI*0.49;
+float theta1 = PI*0.49; // huidige/nieuwe theta
+float theta4 = PI*0.49;
bool emg1;
bool emg2;
bool emg3;
-double thetaflip = 0;
-double omega1;
-double omega4;
-double prefx;
-double prefy;
-double deltat = 0.01;
+float thetaflip = 0;
+float omega1;
+float omega4;
+float prefx;
+float prefy;
+float deltat = 0.01;
//Joe dit zijn de constantes
-double ll = 200.0;
-double lu = 170.0;
-double lb = 10.0;
-double le = 79.0;
-double xbase = 340;
+float ll = 200.0;
+float lu = 170.0;
+float lb = 10.0;
+float le = 79.0;
+float xbase = 340;
//forward kinematics, Check mathematica! Omdat mbed in paniek raakt met meerdere wortels, hebben we de vergelijking opgedeeld in 3 stukken
//check void forward voor de berekeningen
//First define the position equation of x
-double xendsum;
-double xendsqrt1;
-double xendsqrt2;
-double xend;
-double jacobiana;
-double jacobianc;
+float xendsum;
+float xendsqrt1;
+float xendsqrt2;
+float xend;
+float jacobiana;
+float jacobianc;
//Now define the pos. eq. of y
-double yendsum;
-double yendsqrt1;
-double yendsqrt2;
-double yend;
-double jacobianb;
-double jacobiand;
+float yendsum;
+float yendsqrt1;
+float yendsqrt2;
+float yend;
+float jacobianb;
+float jacobiand;
//Hier definieren we de functies en tickers
@@ -58,7 +58,7 @@
//dit wordt aangeroepen in de tickerfunctie
-void inverse(double prex, double prey){
+void inverse(float prex, float prey){
/*
qn = qn-1 + (jacobian^-1)*dPref/dt *deltaT
ofwel
@@ -191,6 +191,7 @@
// de button ingedrukt wordt (als emg = boven treshold) is de prefx 1 (da's de rode 1)
prefy = 1*(!button2); //sw2,
inverse(prefx, prefy);
+ ledr!=ledr;
}
@@ -215,8 +216,8 @@
/*void demomode(){} //Komt nog...
als emg2 == voorbij treshold,
- double theta1 -> plus counts (emg*richting)
- double theta4 -> plus counts (emg*richting)
+ float theta1 -> plus counts (emg*richting)
+ float theta4 -> plus counts (emg*richting)
reken y door
void flip(){
@@ -239,10 +240,8 @@
theta4 = PI*0.49;
pc.baud(115200);
//default = theta1 = theta4 = pi/2,
- emgcheck.attach(kinematics, 0.01); // roep de ticker aan (
-
-
-
+ emgcheck.attach(kinematics, 0.0085); // roep de ticker aan (
+
pc.printf("%f", theta1);
while(true) {
