Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef TOWR_MODELS_GAIT_GENERATOR_H_
00031 #define TOWR_MODELS_GAIT_GENERATOR_H_
00032
00033 #include <memory>
00034 #include <string>
00035 #include <utility>
00036 #include <vector>
00037
00038 namespace towr {
00039
00046 class GaitGenerator {
00047 public:
00048 using Ptr = std::shared_ptr<GaitGenerator>;
00049 using VecTimes = std::vector<double>;
00050 using FootDurations = std::vector<VecTimes>;
00051 using ContactState = std::vector<bool>;
00052 using GaitInfo = std::pair<VecTimes,std::vector<ContactState>>;
00053 using EE = uint;
00054
00058 enum Combos { C0, C1, C2, C3, C4, COMBO_COUNT};
00059
00063 enum Gaits {Stand=0, Flight,
00064 Walk1, Walk2, Walk2E,
00065 Run2, Run2E, Run1, Run1E, Run3, Run3E,
00066 Hop1, Hop1E, Hop2, Hop3, Hop3E, Hop5, Hop5E,
00067 GAIT_COUNT};
00068
00069 static Ptr MakeGaitGenerator(int leg_count);
00070
00071 GaitGenerator () = default;
00072 virtual ~GaitGenerator () = default;
00073
00079 VecTimes GetPhaseDurations(double T, EE ee) const;
00080
00085 bool IsInContactAtStart(EE ee) const;
00086
00093 virtual void SetCombo(Combos combo) = 0;
00094
00099 void SetGaits(const std::vector<Gaits>& gaits);
00100
00101 protected:
00103 std::vector<double> times_;
00104
00109 std::vector<ContactState> contacts_;
00110
00115 GaitInfo RemoveTransition(const GaitInfo& g) const;
00116
00117 private:
00118 FootDurations GetPhaseDurations() const;
00119 virtual GaitInfo GetGait(Gaits gait) const = 0;
00120 VecTimes GetNormalizedPhaseDurations(EE ee) const;
00121 };
00122
00123 }
00124
00125 #endif