Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
towr::PhaseDurations Class Reference

A variable set composed of the phase durations of an endeffector. More...

#include <phase_durations.h>

Inheritance diagram for towr::PhaseDurations:
Inheritance graph
[legend]

Public Types

using EndeffectorID = uint
 
using Ptr = std::shared_ptr< PhaseDurations >
 
using VecDurations = std::vector< double >
 
- Public Types inherited from ifopt::Component
typedef Eigen::SparseMatrix< double, Eigen::RowMajor > Jacobian
 
typedef std::shared_ptr< ComponentPtr
 
typedef std::vector< BoundsVecBound
 
typedef Eigen::VectorXd VectorXd
 

Public Member Functions

void AddObserver (PhaseDurationsObserver *const spline)
 Adds observer that is updated every time new variables are set. More...
 
VecBound GetBounds () const override
 
Jacobian GetJacobianOfPos (int phase, const VectorXd &dx_dT, const VectorXd &xd) const
 How a change in the phase durations affect the position of a spline. More...
 
VecDurations GetPhaseDurations () const
 
VectorXd GetValues () const override
 
bool IsContactPhase (double t) const
 Whether the endeffector is in contact with the environment. More...
 
 PhaseDurations (EndeffectorID ee, const VecDurations &initial_durations, bool is_first_phase_in_contact, double min_phase_duration, double max_phase_duration)
 Constructs a variable set for a specific endeffector. More...
 
void SetVariables (const VectorXd &x) override
 Sets the phase durations from pure Eigen optimization variables. More...
 
virtual ~PhaseDurations ()=default
 
- Public Member Functions inherited from ifopt::VariableSet
Jacobian GetJacobian () const final
 
 VariableSet (int n_var, const std::string &name)
 
virtual ~VariableSet ()=default
 
- Public Member Functions inherited from ifopt::Component
 Component (int num_rows, const std::string &name)
 
std::string GetName () const
 
int GetRows () const
 
virtual void Print (double tolerance, int &index_start) const
 
void SetRows (int num_rows)
 
virtual ~Component ()=default
 

Private Member Functions

void UpdateObservers () const
 

Private Attributes

VecDurations durations_
 
bool initial_contact_state_
 true if first phase in contact More...
 
std::vector< PhaseDurationsObserver * > observers_
 
ifopt::Bounds phase_duration_bounds_
 
double t_total_
 

Additional Inherited Members

- Static Public Attributes inherited from ifopt::Component
static const int kSpecifyLater
 

Detailed Description

A variable set composed of the phase durations of an endeffector.

This class holds the current variables determining the alternating swing- and stance durations of one foot. These durations are then used in the Spline together with NodeVariables to construct foot motions and forces.

See this explanation: https://youtu.be/KhWuLvb934g?t=788

Definition at line 50 of file phase_durations.h.

Member Typedef Documentation

◆ EndeffectorID

Definition at line 54 of file phase_durations.h.

◆ Ptr

using towr::PhaseDurations::Ptr = std::shared_ptr<PhaseDurations>

Definition at line 52 of file phase_durations.h.

◆ VecDurations

using towr::PhaseDurations::VecDurations = std::vector<double>

Definition at line 53 of file phase_durations.h.

Constructor & Destructor Documentation

◆ PhaseDurations()

towr::PhaseDurations::PhaseDurations ( EndeffectorID  ee,
const VecDurations initial_durations,
bool  is_first_phase_in_contact,
double  min_phase_duration,
double  max_phase_duration 
)

Constructs a variable set for a specific endeffector.

Parameters
eeThe endeffector ID which these durations apply to.
initial_durationsInitial values for the optimization variables.
min_phase_durationThe minimum allowable time for one phase.
max_phase_durationThe maximum allowable time for one phase.

Definition at line 41 of file phase_durations.cc.

◆ ~PhaseDurations()

virtual towr::PhaseDurations::~PhaseDurations ( )
virtualdefault

Member Function Documentation

◆ AddObserver()

void towr::PhaseDurations::AddObserver ( PhaseDurationsObserver *const  spline)

Adds observer that is updated every time new variables are set.

Parameters
splineA pointer to a Hermite spline using the durations.

Definition at line 56 of file phase_durations.cc.

◆ GetBounds()

PhaseDurations::VecBound towr::PhaseDurations::GetBounds ( ) const
overridevirtual
Returns
The maximum and minimum time each phase is allowed to take.

Implements ifopt::Component.

Definition at line 103 of file phase_durations.cc.

◆ GetJacobianOfPos()

PhaseDurations::Jacobian towr::PhaseDurations::GetJacobianOfPos ( int  phase,
const VectorXd dx_dT,
const VectorXd xd 
) const

How a change in the phase durations affect the position of a spline.

Parameters
phaseThe current phase the spline is in at time t.
dx_dTThe derivative of the spline position w.r.t the phase durations T.
xdThe velocity of the spline at the current time t.
Returns
A pxn dimensional Jacobian where: p: number of dimensions of the spline (e.g. x,y,z) n: number of phase durations in this class that are optimized over.

This method is related to constructing a cubic-Hermite spline with these phase durations. Leaving the node values unchanged, the shape of the spline can also be changed by expanding or compressing the individual polynomials through the duration. This method quantifies the sensitivity of the spline position on these durations.

Definition at line 127 of file phase_durations.cc.

◆ GetPhaseDurations()

PhaseDurations::VecDurations towr::PhaseDurations::GetPhaseDurations ( ) const
Returns
The durations (stance, swing, ...) for each phase of this foot.

Definition at line 114 of file phase_durations.cc.

◆ GetValues()

Eigen::VectorXd towr::PhaseDurations::GetValues ( ) const
overridevirtual
Returns
The optimization variables (phase durations [s]).

Implements ifopt::Component.

Definition at line 69 of file phase_durations.cc.

◆ IsContactPhase()

bool towr::PhaseDurations::IsContactPhase ( double  t) const

Whether the endeffector is in contact with the environment.

Parameters
tglobal time along the trajectory.

Definition at line 120 of file phase_durations.cc.

◆ SetVariables()

void towr::PhaseDurations::SetVariables ( const VectorXd x)
overridevirtual

Sets the phase durations from pure Eigen optimization variables.

Implements ifopt::Component.

Definition at line 80 of file phase_durations.cc.

◆ UpdateObservers()

void towr::PhaseDurations::UpdateObservers ( ) const
private

Definition at line 62 of file phase_durations.cc.

Member Data Documentation

◆ durations_

VecDurations towr::PhaseDurations::durations_
private

Definition at line 121 of file phase_durations.h.

◆ initial_contact_state_

bool towr::PhaseDurations::initial_contact_state_
private

true if first phase in contact

Definition at line 124 of file phase_durations.h.

◆ observers_

std::vector<PhaseDurationsObserver*> towr::PhaseDurations::observers_
private

Definition at line 127 of file phase_durations.h.

◆ phase_duration_bounds_

ifopt::Bounds towr::PhaseDurations::phase_duration_bounds_
private

Definition at line 125 of file phase_durations.h.

◆ t_total_

double towr::PhaseDurations::t_total_
private

Definition at line 123 of file phase_durations.h.


The documentation for this class was generated from the following files:


towr
Author(s): Alexander W. Winkler
autogenerated on Mon Feb 28 2022 23:54:22