Kinematica robot M9 Gr 13. Geeft de x en y waarden op hidscope weer in 2 scopes. De waarden zijn berekend met het aantal pulses van de encoders van beide motoren.
Dependencies: HIDScope QEI mbed
Revision 2:7993edc4dba6, committed 2015-10-23
- Comitter:
- Thornlady
- Date:
- Fri Oct 23 08:15:35 2015 +0000
- Parent:
- 1:3af988298ce8
- Commit message:
- & weggehaald in int main, beschrijving toegevoegd van de doubles;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3af988298ce8 -r 7993edc4dba6 main.cpp --- a/main.cpp Fri Oct 16 08:50:19 2015 +0000 +++ b/main.cpp Fri Oct 23 08:15:35 2015 +0000 @@ -7,17 +7,17 @@ QEI Encoder2(D14,D15,NC,32); // Je gebruikt hierbij x2 encoding // Aantal pulses/deg -const double P = 4200/360; -const double L1 = 220.4; -const double L2 = 130; -const double R = 2.166; //ratio van de tandwielen op de arm +const double P = 4200/360; //pulses/degree +const double L1 = 220.4; //lengte arm 1 +const double L2 = 130; //lengte arm 2 +const double R = 2.166; //ratio van de tandwielen op de arm -double C1; -double C2; -double Q1; -double Q2; -double X; +double C1; //aantal pulses motor 1 +double C2; //aantal pulses motor 2 +double Q1; //hoek motor 1 +double Q2; //hoek motor 2 +double X; double Y; // HIDScope definieren @@ -31,8 +31,8 @@ C2 = Encoder2.getPulses(); //Aantal pulsen gemeten motor 2 Q1 = C1/P; // Hoek van motor 1 Q2 = R*C2/P; // Hoek van motor 2, met ratio van de tandwielen bovenop - X = cos (Q1) * L1 + cos (Q1+Q2) * L2; //X waarde van einde arm 2 RATIO VAN DE TANDWIELEN NOG NIET ERBIJ - Y = sin (Q1) * L1 + sin (Q1+Q2) * L2; //Y waarde van einde arm 2 RATIO VAN DE TANDWIELEN NOG NIET ERBIJ!!! + X = cos (Q1) * L1 + cos (Q1+Q2) * L2; //X waarde van einde arm 2 + Y = sin (Q1) * L1 + sin (Q1+Q2) * L2; //Y waarde van einde arm 2 scope.set (0, X); @@ -42,7 +42,7 @@ int main () { - Kinematicatimer.attach_us(&Kinematica, 1e4); + Kinematicatimer.attach_us(Kinematica, 1e4); while(true) {} }