omni wheel library
Dependents: quadOmni_yanagi NHK2017_octopus hayatoShooter
オムニ用のライブラリです。
Diff: omni.h
- Revision:
- 10:4f0b55344c73
- Parent:
- 4:926be1e5e9a1
diff -r ab46e745cfab -r 4f0b55344c73 omni.h --- a/omni.h Sun Aug 06 14:49:01 2017 +0000 +++ b/omni.h Wed Aug 23 07:26:26 2017 +0000 @@ -1,90 +1,80 @@ -/** - * @author keitaro takeuchi - * - * @section DESCRIPTION - * 3or4wheels omni libraryfor NHK2017. - */ - -#ifndef OMNI -#define OMNI - -/** - * Includes - */ +/** + * @file omni.h + * @author keitaro takeuchi + * + * @section DESCRIPTION + * 3or4wheels omni libraryfor NHK2017. + */ +#ifndef OMNI_H +#define OMNI_H + +/** + * Includes + */ #include "mbed.h" - -/** - * Defines - */ + +/** + * Defines + */ #define M_PI 3.141592653589793 - -/** - * omni wheel - */ + +/** + * omni wheel + */ class Omni { -public: - - /** - * Constructor. - * - * @param wheels 車輪数(3or4) - * @param initDegree 正面から車輪の角度 - */ - Omni(int wheels, double initDegree); - - /** - * 位置ベクトル(x, y), 回転量から出力を計算 - * - * @param parallelVector[] [x, y](-1 ~ 1) - * @param moment 回転量(-1 ~ 1) - * - * @return 1...success 0...failure - */ - bool computeXY(double parallelVector[], double moment); - - /** - * 角度, 大きさ(θ, volume), 回転量から出力を計算 - * - * @param parallelVector[] [θ(degree), volume] volume...(-1 ~ 1) - * @param moment 回転量(-1 ~ 1) - * @return 1...success 0...failure - */ - bool computePolar(double parallelVector[], double moment); - - /** - * 全ての出力を0にする - * - * @return 1...success 0...failure - */ - bool stop(); - - /** - * ホイール数を設定 - * - * @param wheel ホイール数 - */ - void setWheels(int wheel); - - /** - * 正面から車輪の角度を設定 - * - * @param degree 正面から車輪の角度 - */ - void setInitDegree(double degree); - - /** - * 出力値を取得 - * - * @param wheel wheel番目のホイールの出力を設定 - * - * @return 出力値 - */ - double getOutput(int wheel); +public : -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 /* OMNI */ +#endif//OMNI_H \ No newline at end of file