Cheetah Software  1.0
FootSwingTrajectory.cpp
Go to the documentation of this file.
2 #include "../../include/Controllers/FootSwingTrajectory.h"
3 
10 template <typename T>
12  _p = Interpolate::cubicBezier<Vec3<T>>(_p0, _pf, phase);
13  _v = Interpolate::cubicBezierFirstDerivative<Vec3<T>>(_p0, _pf, phase) / swingTime;
14  _a = Interpolate::cubicBezierSecondDerivative<Vec3<T>>(_p0, _pf, phase) / (swingTime * swingTime);
15 
16  T zp, zv, za;
17 
18  if(phase < T(0.5)) {
19  zp = Interpolate::cubicBezier<T>(_p0[2], _p0[2] + _height, phase * 2);
20  zv = Interpolate::cubicBezierFirstDerivative<T>(_p0[2], _p0[2] + _height, phase * 2) * 2 / swingTime;
21  za = Interpolate::cubicBezierSecondDerivative<T>(_p0[2], _p0[2] + _height, phase * 2) * 4 / (swingTime * swingTime);
22  } else {
23  zp = Interpolate::cubicBezier<T>(_p0[2] + _height, _pf[2], phase * 2 - 1);
24  zv = Interpolate::cubicBezierFirstDerivative<T>(_p0[2] + _height, _pf[2], phase * 2 - 1) * 2 / swingTime;
25  za = Interpolate::cubicBezierSecondDerivative<T>(_p0[2] + _height, _pf[2], phase * 2 - 1) * 4 / (swingTime * swingTime);
26  }
27 
28  _p[2] = zp;
29  _v[2] = zv;
30  _a[2] = za;
31 }
32 
33 template class FootSwingTrajectory<double>;
34 template class FootSwingTrajectory<float>;
Utility functions to interpolate between two values.
void computeSwingTrajectoryBezier(T phase, T swingTime)