omni wheel library

Dependents:   quadOmni_yanagi NHK2017_octopus hayatoShooter

オムニ用のライブラリです。

Revision:
9:a30169882a15
Parent:
0:979565e955a5
--- a/omni.h	Mon Jul 03 14:23:36 2017 +0000
+++ b/omni.h	Wed Aug 23 07:24:34 2017 +0000
@@ -1,27 +1,80 @@
-#ifndef OMNI
-#define OMNI
+/**
+ * @file omni.h
+ * @author keitaro takeuchi
+ *
+ * @section DESCRIPTION
+ * 3or4wheels omni libraryfor NHK2017.
+ */
+#ifndef OMNI_H
+#define OMNI_H
 
+/**
+ * Includes
+ */
 #include "mbed.h"
 
+/**
+ * Defines
+ */
 #define M_PI 3.141592653589793
 
+/**
+ * omni wheel
+ */
 class Omni {
-public:
-    Omni(int wheels, double initDegree);
-
-    bool computeXY(double parallelVector[], double moment);
-    bool computePolar(double parallelVector[], double moment);
-    bool stop();
+public :
 
-    void setWheels(int wheel);
-    void setInitDegree(double degree);
-
-    double getOutput(int wheel);
-
-private:
+    /**
+     * Constructor.
+     *
+     * @param wheels 車輪数(3or4)
+     */
+    Omni(int wheels);
+    
+    /**
+     * ホイールの付いている角度を設定
+     *
+     * @param rad radian
+     * @param wheelNumber 番目のホイール
+     */
+    bool setWheelRadian(float rad1, float rad2, float rad3);
+    bool setWheelRadian(float rad1, float rad2, float rad3, float rad4);
+    bool setWheelRadian(int wheelNumber, float rad);
+    
+    /**
+     * 位置ベクトル(x, y), 回転量から出力を計算
+     *
+     * @param X(-1 ~ 1)
+     * @param Y(-1 ~ 1)
+     * @param moment 回転量(-1 ~ 1)
+     *
+     * @return 1...success 0...failure
+     */
+    bool computeXY(float X, float Y, float moment);
+    
+    /**
+     * 半径, 角度radian(r, Θ), 回転量から出力を計算
+     *
+     * @param r 半径(0 ~ 1)
+     * @param rad radian(-PI ~ PI)
+     * @param moment 回転量(-1 ~ 1)
+     * @return 1...success 0...failure
+     */
+    bool computeCircular(float r, float rad, float moment);
+    
+    /**
+     * 出力値を取得
+     *
+     * @param wheelNumber wheel番目のホイールの出力を設定
+     *
+     * @return 出力値
+     */
+    float getOutput(int wheelNumber);
+private :
+protected :
     int wheels;
-    double initDegree;
-    double wheel[4];
+    float wheel[4];
+    float radian[4];
 };
 
-#endif
+#endif//OMNI_H
\ No newline at end of file