test

Dependencies:   mbed ros_lib_kinetic nhk19mr2_can_info splitData SerialHalfDuplex_HM

Walk/Walk.h

Committer:
shimizuta
Date:
2019-02-16
Revision:
21:61971fc18b90
Parent:
19:1adc7302cfd9
Child:
22:787a764271dd

File content as of revision 21:61971fc18b90:

#ifndef INCLUDED_WALK_H
#define INCLUDED_WALK_H
#include "OneLeg.h"
//足の軌道を設定するクラス。軌道は様々であることを考慮してコンストラクタでの代入は控えたい
class Orbit
{
    float stridetime_s_;
    float risetime_s_;
    float stride_m_;
    float height_m_;                                   //足の上げ幅
    float ellipse_center_y_m_;                         //楕円軌道の中心高さ
    float ellipse_center_x_m_;                         //楕円軌道の中心x座標
    float ground_m_;                                   //地面の高さ
    OneLeg StrideLine_(OneLeg leg, float phasetime_s); //時間をもとに位置を取得したインスタンスを直接返して代入させる
    OneLeg RiseEllipse_(OneLeg leg, float phasetime_s);
    OneLeg OrbitEllipse_(OneLeg leg, float phasetime_s); //Stride, Riseを組み合わせて周期を作る
    OneLeg RiseEllipse2_(OneLeg leg, float phasetime_s);

  public:
    Orbit(){};
    //このクラスのメイン privateへのアクセス関数
    OneLeg GetOrbit(OneLeg leg, float phasetime_s);
    void SetStraightParam(float stridetime_s, float risetime_s,
                          float stride_m, float height_m, float ground_m,
                          float ellipse_center_x_m, float ellipse_center_y_m);
    void SetStandParam(float ground_m);
    float GetOneWalkTime(); //足一周の時間
};

//4足の足の動かし方を保存するクラス
class Walk
{
    float phasetime_s_;
    float offsettime_s_[4];

  public:
    //4脚の軌道, 位相を代入して歩行方法を確定する
    //コンストラクタではメンバの代入のみ行っている
    Walk(Orbit orbit[4], float offsettime_s[4], float cycletime_s);
    float cycletime_s_; //計算周期
    Orbit orbit_[4];
    //参照渡しされたonelegそれぞれにorbit_::GetOrbit関数を代入
    //GetOrbit関数にて軌道, 時間をもとに位置を決める
    //直接参照しているのはこの関数だけ
    void Cal4LegsPosi(OneLeg (&leg)[4]);
};
#endif