狗腿的摆线可以使用 https://zhuanlan.zhihu.com/p/69869440
8自由度机械狗没有y方向的移动 x方向移动,分成摆动相和支撑相
小跑步态规划实现
//周期 占空比 增加速度
#define faai 0.5
#define Ts 1
#define speed 0.1
#define ori_speed 0.025
//步态规划
void trot_plan(double t,double xs,double xf,double h,
double r1,double r2,double r3,double r4,double x_pos[4],double y_pos[4]){
if(t<=Ts*faai){
sigma = (2*PI*t)/(faai*Ts);
zep = h*(1-cos(sigma))/2;
xep_b = (xf-xs)*((sigma-sin(sigma))/(2*PI))+xs;
xep_z = (xs-xf)*((sigma-sin(sigma))/(2*PI))+xf;
//y坐标值
y_pos[0] = ges_y_1-zep;
y_pos[1] = ges_y_2;
y_pos[2] = ges_y_3;
y_pos[3] = ges_y_4-zep;
//x坐标值
x_pos[0] = xep_b*r1;
x_pos[1] = xep_z*r2;
x_pos[2] = xep_z*r3;
x_pos[3] = xep_b*r4;
}else if((t>Ts*faai)&&(t<=Ts)){
sigma = (2*PI*(t-Ts*faai))/(faai*Ts);
zep = h*(1-cos(sigma))/2;
xep_b = (xf-xs)*((sigma-sin(sigma))/(2*PI))+xs;
xep_z = (xs-xf)*((sigma-sin(sigma))/(2*PI))+xf;
//y坐标值
y_pos[0] = ges_y_1;
y_pos[1] = ges_y_2-zep;
y_pos[2] = ges_y_3-zep;
y_pos[3] = ges_y_4;
//x坐标值
x_pos[0] = xep_z*r1;
x_pos[1] = xep_b*r2;
x_pos[2] = xep_b*r3;
x_pos[3] = xep_z*r4;
}
}