25 int index = start_ind + 1;
26 for (; index < (int)
FS.size(); index++)
36 if (
FS[index].type == type)
60 int index = start_ind - 1;
61 for (; index >= 0; index--)
71 if (
FS[index].type == type)
91 const int support_number,
92 double *left_foot_pos,
93 double *right_foot_pos)
95 int left_ind, right_ind;
104 right_ind = left_ind;
108 Matrix4d::Map(left_foot_pos) =
FS[left_ind].posture->matrix();
109 Matrix4d::Map(right_foot_pos) =
FS[right_ind].posture->matrix();
123 const int support_number,
125 double *left_foot_pos,
126 double *right_foot_pos)
128 double *swing_foot_pos, *ref_foot_pos;
129 int next_swing_ind, prev_swing_ind;
135 ref_foot_pos = left_foot_pos;
136 swing_foot_pos = right_foot_pos;
143 ref_foot_pos = right_foot_pos;
144 swing_foot_pos = left_foot_pos;
150 Matrix4d::Map(ref_foot_pos) = current_step.
posture->matrix();
153 double dx =
FS[next_swing_ind].x() -
FS[prev_swing_ind].x();
154 double dy =
FS[next_swing_ind].y() -
FS[prev_swing_ind].y();
155 double l = sqrt(dx*dx + dy*dy);
158 double x[3] = {0.0, l/2, l};
159 double b_coef = - (x[2]*x[2] )/(x[2] );
160 double a =
step_height / (x[1]*x[1] + b_coef*(x[1] ));
161 double b = a * b_coef;
165 double dl = theta * l;
167 Matrix4d::Map(swing_foot_pos) = (
168 (*
FS[prev_swing_ind].posture)
169 * Translation<double, 3>(theta * dx, theta * dy, a*dl*dl + b*dl)
170 * AngleAxisd(
FS[next_swing_ind].angle -
FS[prev_swing_ind].angle, Vector3d::UnitZ())
185 const int support_number,
187 double *left_foot_pos,
188 double *right_foot_pos)
190 double *swing_foot_pos, *ref_foot_pos;
191 int next_swing_ind, prev_swing_ind;
192 int inclination_sign = 0;
198 inclination_sign = -1;
200 ref_foot_pos = left_foot_pos;
201 swing_foot_pos = right_foot_pos;
208 inclination_sign = 1;
210 ref_foot_pos = right_foot_pos;
211 swing_foot_pos = left_foot_pos;
217 Matrix4d::Map(ref_foot_pos) = current_step.
posture->matrix();
221 Vector4d weighted_binomial_coef;
223 weighted_binomial_coef(0) = 1 * (1-theta)*(1-theta)*(1-theta);
224 weighted_binomial_coef(1) =
bezier_weight_1 * 3*(1-theta)*(1-theta)*theta;
226 weighted_binomial_coef(3) = 1 * theta*theta*theta;
229 Matrix<double, 3, 4> control_points;
230 control_points.col(0) =
FS[prev_swing_ind].posture->translation();
231 control_points.col(3) =
FS[next_swing_ind].posture->translation();
246 control_points.col(1).x() = 0.0;
248 control_points.col(1).z() =
step_height*weighted_binomial_coef.sum()
250 control_points.col(2).x() = 0.0;
252 control_points.col(2).z() = control_points.col(1).z();
255 control_points.col(1) = (*
FS[prev_swing_ind].posture) * control_points.col(1);
256 control_points.col(2) = (*
FS[next_swing_ind].posture) * control_points.col(2);
260 Transform<double, 3> swing_posture =
261 Translation<double,3>(
262 control_points * weighted_binomial_coef / weighted_binomial_coef.sum())
264 Quaterniond (AngleAxisd (
FS[prev_swing_ind].angle,Vector3d::UnitZ())).slerp (
266 Quaterniond (AngleAxisd (
FS[next_swing_ind].angle,Vector3d::UnitZ())));
268 Matrix4d::Map(swing_foot_pos) = swing_posture.matrix();
double step_height
The maximum height, that can be reached by a swing foot.
int getPrevSS(const int, const fs_type type=FS_TYPE_AUTO)
Returns index of the previous SS.
void getDSFeetPositions(const int, double *, double *)
Determine position and orientation of feet in DS.
void getSSFeetPositions(const int, const double, double *, double *)
Determine position and orientation of feet (parabolic trajectory)
double bezier_inclination_2
void getSSFeetPositionsBezier(const int, const double, double *, double *)
Determine position and orientation of feet (using cubic Bezier curves)
int getNextSS(const int, const fs_type type=FS_TYPE_AUTO)
Returns index of the next SS.
std::vector< footstep > FS
A vector of footsteps.
double bezier_inclination_1