Generators

Gait generators are used to create the contact phases needed for a gait.

GaitGenerator

namespace gambol
class GaitGenerator
#include <GaitGenerator.h>

Generates endeffector phase durations for predefined gait styles.

These gaits (e.g. quadruped trotting, biped walking) are used to initialize the towr optimization problem.

Subclassed by gambol::GaitGeneratorBiped, gambol::GaitGeneratorBipedFeet, gambol::GaitGeneratorMonoped, gambol::GaitGeneratorQuadruped, gambol::GaitGeneratorSnake

Public Types

enum Combos

Predefined combinations of different strides.

Values:

enumerator C0
enumerator C1
enumerator C2
enumerator C3
enumerator C4
enumerator COMBO_COUNT
enum Gaits

Predefined strides, each with a different gait diagram.

Values:

enumerator Stand
enumerator Flight
enumerator Walk1
enumerator Walk1B
enumerator Walk1E
enumerator Walk2
enumerator Walk2E
enumerator Walk3
enumerator Run2
enumerator Run2E
enumerator Run1
enumerator Run1E
enumerator Run3
enumerator Run3E
enumerator Hop1
enumerator Hop1E
enumerator Hop2
enumerator Hop3
enumerator Hop3E
enumerator Hop5
enumerator Hop5E
enumerator Balance
enumerator GAIT_COUNT
using Ptr = std::shared_ptr<GaitGenerator>
using VecTimes = std::vector<double>
using FootDurations = std::vector<VecTimes>
using ContactState = std::vector<bool>
using GaitInfo = std::pair<VecTimes, std::vector<ContactState>>
using EE = uint

Public Functions

GaitGenerator() = default
virtual ~GaitGenerator() = default
VecTimes GetPhaseDurations(double T, EE ee) const
Parameters
  • ee – endeffector for which the phase durations are desired.

  • T – total time for all phases, durations are scaled by that.

Returns

the swing and stance durations for the set gait.

std::vector<VecTimes> GetPhaseDurations(double T) const

Get phase durations for all end-effectors

bool IsInContactAtStart(EE ee) const
Parameters

ee – The endeffector/foot/hand.

Returns

true if the foot is initially in contact with the environment.

std::vector<bool> IsInContactAtStart() const

Get contac_at_start for all end-effectors

int GetSteps(EE ee = 0) const
Parameters

ee – The end-effector

Returns

Number of steps for a specific end-effector

virtual void SetCombo(Combos combo) = 0

Sets a specific sequence of gaits.

The derived class decides what each combo maps to. This function then fills the times_ and contacts_ variables accordingly.

void SetGaits(const std::vector<Gaits> &gaits)

Sets the times_ and contacts_ variables according to the gaits.

Parameters

gaits – The sequence of steps which defines gait. For example use {Stand,Walk1,Walk1,Stand} to declare walking gait with two steps.

Public Static Functions

static Ptr MakeGaitGenerator(int leg_count)

Protected Functions

GaitInfo RemoveTransition(const GaitInfo &g) const

Removes the last phase that would transition to a new stride. This is usually necessary for a gait change.

Protected Attributes

std::vector<double> times_

Phase times for the complete robot during which no contact state changes.

std::vector<ContactState> contacts_

The contact state for the complete robot. The size of this vector must be equal to the above times_.

Private Functions

FootDurations GetPhaseDurations() const
virtual GaitInfo GetGait(Gaits gait) const = 0
VecTimes GetNormalizedPhaseDurations(EE ee) const