library lengan 3
Lengan3.h@0:42f8a5003e37, 2019-05-19 (annotated)
- Committer:
- harrymunli
- Date:
- Sun May 19 15:58:20 2019 +0000
- Revision:
- 0:42f8a5003e37
+library lengan3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
harrymunli | 0:42f8a5003e37 | 1 | #ifndef MBED_LENGAN3_H |
harrymunli | 0:42f8a5003e37 | 2 | #define MBED_LENGAN3_H |
harrymunli | 0:42f8a5003e37 | 3 | |
harrymunli | 0:42f8a5003e37 | 4 | #include "mbed.h" |
harrymunli | 0:42f8a5003e37 | 5 | #include "Servo.h" |
harrymunli | 0:42f8a5003e37 | 6 | |
harrymunli | 0:42f8a5003e37 | 7 | //Programmed and formulated by Andre |
harrymunli | 0:42f8a5003e37 | 8 | /* Nama servo |
harrymunli | 0:42f8a5003e37 | 9 | 4 |
harrymunli | 0:42f8a5003e37 | 10 | 3 |
harrymunli | 0:42f8a5003e37 | 11 | 1(L3) 2 |
harrymunli | 0:42f8a5003e37 | 12 | 0 |
harrymunli | 0:42f8a5003e37 | 13 | */ |
harrymunli | 0:42f8a5003e37 | 14 | |
harrymunli | 0:42f8a5003e37 | 15 | class Lengan3 { |
harrymunli | 0:42f8a5003e37 | 16 | protected : |
harrymunli | 0:42f8a5003e37 | 17 | Servo SL3_1; //lengan3-ser1 |
harrymunli | 0:42f8a5003e37 | 18 | Servo SL3_2; //lengan3-ser2 |
harrymunli | 0:42f8a5003e37 | 19 | Servo SL3_3; //lengan3-ser3 |
harrymunli | 0:42f8a5003e37 | 20 | Servo SL3_base; //lengan3-servo base |
harrymunli | 0:42f8a5003e37 | 21 | |
harrymunli | 0:42f8a5003e37 | 22 | public : |
harrymunli | 0:42f8a5003e37 | 23 | |
harrymunli | 0:42f8a5003e37 | 24 | //SL3_1 => lengan3-ser1 |
harrymunli | 0:42f8a5003e37 | 25 | Lengan3(PinName pin_SL3_1, PinName pin_SL3_2, PinName pin_SL3_3, PinName pin_SL3_base); |
harrymunli | 0:42f8a5003e37 | 26 | |
harrymunli | 0:42f8a5003e37 | 27 | //rumus mencari sudut phi |
harrymunli | 0:42f8a5003e37 | 28 | double phi(float x, float y); |
harrymunli | 0:42f8a5003e37 | 29 | |
harrymunli | 0:42f8a5003e37 | 30 | //rumus mencari x yg dipengaruhi phi |
harrymunli | 0:42f8a5003e37 | 31 | double x_phi(float x, float y); |
harrymunli | 0:42f8a5003e37 | 32 | |
harrymunli | 0:42f8a5003e37 | 33 | //rumus teta2+teta1 versi 1 |
harrymunli | 0:42f8a5003e37 | 34 | double rum1_tet(float sdt, float x, float y, float z, float r1, float r2); |
harrymunli | 0:42f8a5003e37 | 35 | |
harrymunli | 0:42f8a5003e37 | 36 | //rumus teta2+teta1 versi 2 |
harrymunli | 0:42f8a5003e37 | 37 | double rum2_tet(float sdt, float x, float y, float z, float r1, float r2); |
harrymunli | 0:42f8a5003e37 | 38 | |
harrymunli | 0:42f8a5003e37 | 39 | //Penggunaan rumus 1 dan 2 |
harrymunli | 0:42f8a5003e37 | 40 | // Apabila Nef(tujuan) berada di kuadran I |
harrymunli | 0:42f8a5003e37 | 41 | // atau x dan z positif maka rum1 dan rum2 berlaku |
harrymunli | 0:42f8a5003e37 | 42 | // |
harrymunli | 0:42f8a5003e37 | 43 | // rum1(sdt)=rum2(sdt)=O1+O2 |
harrymunli | 0:42f8a5003e37 | 44 | // (dengan O1 : teta1 dan O2 : teta2) |
harrymunli | 0:42f8a5003e37 | 45 | |
harrymunli | 0:42f8a5003e37 | 46 | // Apabila berada di kuadran IV |
harrymunli | 0:42f8a5003e37 | 47 | // atau x positif dan z negatif maka rum1 dan rum2 berlaku |
harrymunli | 0:42f8a5003e37 | 48 | // rum1(sdt)=rum2(sdt)=O1-O2 |
harrymunli | 0:42f8a5003e37 | 49 | |
harrymunli | 0:42f8a5003e37 | 50 | //rumus untuk menentukan sudut teta1 terbaik (harus mendekati 0) |
harrymunli | 0:42f8a5003e37 | 51 | //didapat dari substitusi dua rumus diatas |
harrymunli | 0:42f8a5003e37 | 52 | double diffeI(float sdt,float x, float y, float z, float r1, float r2); |
harrymunli | 0:42f8a5003e37 | 53 | |
harrymunli | 0:42f8a5003e37 | 54 | double diffeIV(float sdt,float x, float y, float z, float r1, float r2); |
harrymunli | 0:42f8a5003e37 | 55 | |
harrymunli | 0:42f8a5003e37 | 56 | //mainnya program andre |
harrymunli | 0:42f8a5003e37 | 57 | void invKinMain(float xt, float yt, float zt); |
harrymunli | 0:42f8a5003e37 | 58 | |
harrymunli | 0:42f8a5003e37 | 59 | }; |
harrymunli | 0:42f8a5003e37 | 60 | |
harrymunli | 0:42f8a5003e37 | 61 | #endif |