Tk A / MIYAZAKI

Fork of Encoder by Tk A

Files at this revision

API Documentation at this revision

Comitter:
sakanakuuun
Date:
Tue Aug 16 11:46:51 2016 +0000
Parent:
12:c88621d7285f
Commit message:
add getX(r, l)

Changed in this revision

Locate.cpp Show annotated file Show diff for this revision Revisions of this file
Locate.h Show annotated file Show diff for this revision Revisions of this file
--- a/Locate.cpp	Tue Aug 16 11:34:10 2016 +0000
+++ b/Locate.cpp	Tue Aug 16 11:46:51 2016 +0000
@@ -37,11 +37,23 @@
     return x * LOCATE_STEP / 2;   
 }
 
+short Locate::getX(int r, int l)
+{
+    update(r, l);
+    return x * LOCATE_STEP / 2;   
+}
+
 short Locate::getY()
 {
     return y * LOCATE_STEP / 2;   
 }
 
+short Locate::getY(int r, int l)
+{
+    update(r, l);
+    return y * LOCATE_STEP / 2;   
+}
+
 float Locate::getTheta()
 {
     return theta;
--- a/Locate.h	Tue Aug 16 11:34:10 2016 +0000
+++ b/Locate.h	Tue Aug 16 11:46:51 2016 +0000
@@ -30,9 +30,11 @@
 public:    
     Locate (int fx, int fy);        //fx,fyは初期位置
     void  setup(int r, int l);      //エンコーダの初期のズレ(dr,dl)を出す、最初に一回だけ行う
-    void  update (int r, int l);    //位置情報を更新する
+    void  update (int r, int l);    //位置情報を更新する。r,lはエンコーダから
     short getX();                   //xをmm換算して整数値として返す
+    short getX(int r, int l);       //上のupdate()も一緒にやってくれる版
     short getY();                   //yをmm換算して整数値として返す
+    short getY(int r, int l);       //上のupdate()も一緒にやってくれる版
     float getTheta();               //thetaを返す
 };