47 case 1:
return std::make_shared<MonopedGaitGenerator>();
break;
48 case 2:
return std::make_shared<BipedGaitGenerator>();
break;
49 case 4:
return std::make_shared<QuadrupedGaitGenerator>();
break;
50 default: assert(
false);
break;
58 std::vector<double> durations;
60 durations.push_back(d*t_total);
69 double total_time = std::accumulate(v.begin(), v.end(), 0.0);
70 std::transform(v.begin(), v.end(), v.begin(),
71 [total_time](
double t_phase){
return t_phase/total_time;});
83 for (
int phase=0; phase<
contacts_.size()-1; ++phase) {
87 for (
int ee=0; ee<curr.size(); ++ee) {
88 d_accumulated.at(ee) +=
times_.at(phase);
91 bool contacts_will_change = curr.at(ee) != next.at(ee);
92 if (contacts_will_change) {
93 foot_durations.at(ee).push_back(d_accumulated.at(ee));
94 d_accumulated.at(ee) = 0.0;
100 for (
int ee=0; ee<
contacts_.back().size(); ++ee)
101 foot_durations.at(ee).push_back(d_accumulated.at(ee) +
times_.back());
104 return foot_durations;
119 for (
Gaits g : gaits) {
122 std::vector<double> t = info.first;
123 std::vector<ContactState> c = info.second;
124 assert(t.size() == c.size());
138 new_gait.first.pop_back();
139 new_gait.first.back() += g.first.back();
141 new_gait.second.pop_back();
bool IsInContactAtStart(EE ee) const
std::vector< double > times_
Phase times for the complete robot during which no contact state changes.
VecTimes GetNormalizedPhaseDurations(EE ee) const
Gaits
Predefined strides, each with a different gait diagram.
std::pair< VecTimes, std::vector< ContactState > > GaitInfo
std::vector< ContactState > contacts_
void SetGaits(const std::vector< Gaits > &gaits)
Sets the times_ and contacts_ variables according to the gaits.
std::vector< double > VecTimes
FootDurations GetPhaseDurations() const
GaitInfo RemoveTransition(const GaitInfo &g) const
std::shared_ptr< GaitGenerator > Ptr
std::vector< bool > ContactState
static Ptr MakeGaitGenerator(int leg_count)
std::vector< VecTimes > FootDurations
virtual GaitInfo GetGait(Gaits gait) const =0