-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFootSwingTrajectory.h
66 lines (53 loc) · 1.15 KB
/
FootSwingTrajectory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*!
* @file FootSwingTrajectory.h
* @brief Utility to generate foot swing trajectories.
*
* Currently uses Bezier curves like Cheetah 3 does
*/
#ifndef CHEETAH_SOFTWARE_FOOTSWINGTRAJECTORY_H
#define CHEETAH_SOFTWARE_FOOTSWINGTRAJECTORY_H
#include "../common/cppTypes.h"
//计算贝塞尔曲线,别看它写的花里胡哨的,其实还是很简单的公式
//我只是为了模仿mit的整体结构,才用了它
template<typename T>
class FootSwingTrajectory {
public:
//初始化,全设置成0
FootSwingTrajectory() {
_p0.setZero();//初始点
_pf.setZero();//终点
_pt.setZero();//最高点
_p.setZero();
_v.setZero();
_a.setZero();
}
//设置足端轨迹的起点
void setInitialPosition(Vec3<T> p0) {
_p0 = p0;
}
//设置足端轨迹的终点
void setFinalPosition(Vec3<T> pf) {
_pf = pf;
}
//设置足端轨迹的最高点
void setHeight(Vec3<T> pt) {
_pt = pt;
}
//计算轨迹
void computeSwingTrajectory(T phase, T swingTime);
//获得足端位置
Vec3<T> getPosition() {
return _p;
}
//获得足端速度
Vec3<T> getVelocity() {
return _v;
}
//获得足端加速度
Vec3<T> getAcceleration() {
return _a;
}
private:
Vec3<T> _p0, _pf, _pt, _p, _v, _a;
};
#endif //CHEETAH_SOFTWARE_FOOTSWINGTRAJECTORY_H