omni wheel library
Dependents: quadOmni_yanagi NHK2017_octopus hayatoShooter
オムニ用のライブラリです。
Diff: omni.h
- Revision:
- 1:add7d2b18162
- Parent:
- 0:979565e955a5
- Child:
- 2:9670cf9549aa
diff -r 979565e955a5 -r add7d2b18162 omni.h --- a/omni.h Mon Jul 03 14:23:36 2017 +0000 +++ b/omni.h Tue Jul 04 17:32:09 2017 +0900 @@ -1,21 +1,82 @@ -#ifndef OMNI +/** + * @author keitaro takeuchi + * + * @section DESCRIPTION + * 3or4wheels omni libraryfor NHK2017. + */ + +#ifndef OMNI #define OMNI - + +/** + * Includes + */ #include "mbed.h" - + +/** + * Defines + */ #define M_PI 3.141592653589793 - + +/** + * omni wheel + */ class Omni { -public: +public: + + /** + * Constructor. + * + * @param wheels 車輪数(3or4) + * @param initDegree 正面から車輪の角度 + */ Omni(int wheels, double initDegree); - - bool computeXY(double parallelVector[], double moment); - bool computePolar(double parallelVector[], double moment); + + /** + * 位置ベクトル(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(); - - void setWheels(int wheel); + + /** + * ホイール数を設定 + * + * @param wheel ホイール数 + */ + void setWheels(int wheel); + + /** + * 正面から車輪の角度を設定 + * + * @param degree 正面から車輪の角度 + */ void setInitDegree(double degree); - + + /** + * 出力値を取得 + * @param wheel wheel番目のホイールの出力を設定 + * @return 出力値 + */ double getOutput(int wheel); private: @@ -24,4 +85,4 @@ double wheel[4]; }; -#endif +#endif /* OMNI */