hadah

Dependencies:   PID QEI mbed

Fork of Riset-Odometry by Gustav Aditya Permana

Files at this revision

API Documentation at this revision

Comitter:
Najib_irvani
Date:
Mon Nov 07 13:39:32 2016 +0000
Parent:
0:b455cd43929c
Commit message:
jzsdfk

Changed in this revision

omniPos.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b455cd43929c -r 0a124b4468db omniPos.cpp
--- a/omniPos.cpp	Mon Nov 07 12:24:01 2016 +0000
+++ b/omniPos.cpp	Mon Nov 07 13:39:32 2016 +0000
@@ -32,8 +32,8 @@
 float getX(void)
 {
     float  jarakEncDpn, jarakEncBlk;
-    jarakEncDpn = encoderDepan.getRevolutions()*Kel + (encoderDepan.getPulses()%(2*PPR))*Kel/(2*PPR);
-    jarakEncBlk = encoderBelakang.getRevolutions()*Kel + (encoderBelakang.getPulses()%(2*PPR))*Kel/(2*PPR);
+    jarakEncDpn = encoderDepan.getRevolutions()*Kel/(2*PPR);
+    jarakEncBlk = encoderBelakang.getRevolutions()*Kel/(2*PPR);
     if (jarakEncDpn>=0  && jarakEncBlk<0)
     {
         return (abs(jarakEncDpn)+abs(jarakEncBlk))/2;
@@ -47,8 +47,8 @@
 float getY(void)
 {
     float  jarakEncKir, jarakEncKan;
-    jarakEncKir = encoderKiri.getRevolutions()*Kel + (encoderKiri.getPulses()%(2*PPR))*Kel/(2*PPR);
-    jarakEncKan = encoderKanan.getRevolutions()*Kel + (encoderKanan.getPulses()%(2*PPR))*Kel/(2*PPR);
+    jarakEncKir = encoderKiri.getRevolutions()*Kel/(2*PPR);
+    jarakEncKan = encoderKanan.getRevolutions()*Kel/(2*PPR);
     if (jarakEncKir>=0  && jarakEncKan<0)
     {
         return (abs(jarakEncKir)+abs(jarakEncKan))/2;
@@ -63,10 +63,10 @@
 {
     float jarakEncDpn, jarakEncBlk, jarakEncKir, jarakEncKan;
     float busurDpn, busurBlk, busurKir, busurKan;
-    jarakEncDpn = encoderDepan.getRevolutions()*Kel + (encoderDepan.getPulses()%(2*PPR))*Kel/(2*PPR);
-    jarakEncBlk = encoderBelakang.getRevolutions()*Kel + (encoderBelakang.getPulses()%(2*PPR))*Kel/(2*PPR);
-    jarakEncKir = encoderKiri.getRevolutions()*Kel + (encoderKiri.getPulses()%(2*PPR))*Kel/(2*PPR);
-    jarakEncKan = encoderKanan.getRevolutions()*Kel + (encoderKanan.getPulses()%(2*PPR))*Kel/(2*PPR);
+    jarakEncDpn = encoderDepan.getRevolutions()*Kel/(2*PPR);
+    jarakEncBlk = encoderBelakang.getRevolutions()*Kel/(2*PPR);
+    jarakEncKir = encoderKiri.getRevolutions()*Kel/(2*PPR);
+    jarakEncKan = encoderKanan.getRevolutions()*Kel/(2*PPR);
     
     busurDpn = (jarakEncDpn/K_robot)*360;
     busurBlk = (jarakEncBlk/K_robot)*360;