omni wheel library

Dependents:   quadOmni_yanagi NHK2017_octopus hayatoShooter

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

omni.h

Committer:
UCHITAKE
Date:
2017-07-04
Revision:
4:926be1e5e9a1
Parent:
3:413f27170090
Child:
10:4f0b55344c73

File content as of revision 4:926be1e5e9a1:

/**
 * @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:

    /**
     * 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);

private:
    int wheels;
    double initDegree;
    double wheel[4];
};

#endif /* OMNI */