9 #define rad2deg(rad) (rad * 180 / M_PI) 12 #define deg2rad(deg) (deg * M_PI / 180) 17 const double default_top_ratio)
22 double pth = 2 *
M_PI * ratio, norm_u = u.norm();
23 if ( !
eps_eq(norm_u, 0.0,1e-3*0.01) )
26 hrp::Vector3 cycloid_point( ((0.5 > ratio) ? ( 2 * default_top_ratio * norm_u ) : ( 2 * (1 - default_top_ratio) * norm_u )) * ( pth - sin(pth) ) / (2 *
M_PI) -
27 ((0.5 > ratio) ? 0.0 : (norm_u * (1 - 2 * default_top_ratio)) ),
29 ( 0.5 * height * ( 1 - cos(pth) )) );
35 ret = dvm * cycloid_point + start + uz;
42 std::vector<coordinates> tmp_mid_coords;
43 double ratio = (1.0 - 1.0 / cs.size());
44 for (
size_t i = 1;
i < cs.size();
i++) {
47 tmp_mid_coords.push_back(tmp);
56 return ((l_r==
LLEG)?std::string(
"lleg"):
57 (l_r==
RARM)?std::string(
"rarm"):
58 (l_r==
LARM)?std::string(
"larm"):
66 }
else if (tht ==
HEEL) {
75 const std::vector<step_node>& _support_leg_steps,
76 const std::vector<step_node>& _swing_leg_steps)
79 std::vector<hrp::Vector3> dzl;
82 std::vector<hrp::Vector3> foot_x_axises;
83 double sum_of_weight = 0.0;
84 for (std::vector<step_node>::const_iterator it = _support_leg_steps.begin(); it != _support_leg_steps.end(); it++) {
88 for (std::vector<step_node>::const_iterator it = _swing_leg_steps.begin(); it != _swing_leg_steps.end(); it++) {
91 foot_x_axises.push_back(
hrp::Vector3(it->worldcoords.rot * hrp::Vector3::UnitX()) );
94 rzmp = std::accumulate(dzl.begin(), dzl.end(), tmp_zero) / sum_of_weight;
96 std::vector<leg_type> swing_leg_types;
97 for (
size_t i = 0;
i < fns.size();
i++) {
98 swing_leg_types.push_back(fns.at(
i).l_r);
111 std::vector<hrp::Vector3> dzl;
112 std::vector<hrp::Vector3> foot_x_axises;
113 double sum_of_weight = 0.0;
115 for (std::vector<step_node>::const_iterator it = _support_leg_steps.begin(); it != _support_leg_steps.end(); it++) {
118 foot_x_axises.push_back(
hrp::Vector3(it->worldcoords.rot * hrp::Vector3::UnitX()) );
120 rzmp = std::accumulate(dzl.begin(), dzl.end(), tmp_zero) / sum_of_weight;
123 std::vector<leg_type> swing_leg_types;
124 for (
size_t i = 0;
i< fns.size();
i++) {
125 swing_leg_types.push_back(fns.at(
i).l_r);
133 void refzmp_generator::calc_current_refzmp (
hrp::Vector3& ret, std::vector<hrp::Vector3>& swing_foot_zmp_offsets,
const double default_double_support_ratio_before,
const double default_double_support_ratio_after,
const double default_double_support_static_ratio_before,
const double default_double_support_static_ratio_after)
136 size_t double_support_count_half_before = default_double_support_ratio_before *
one_step_count;
137 size_t double_support_count_half_after = default_double_support_ratio_after *
one_step_count;
138 size_t double_support_static_count_half_before = default_double_support_static_ratio_before *
one_step_count;
139 size_t double_support_static_count_half_after = default_double_support_static_ratio_after *
one_step_count;
143 double zmp_diff = 0.0;
149 double first_zmp_offset_x, second_zmp_offset_x;
159 swing_foot_zmp_offsets.front()(0) = (1-ratio)*swing_foot_zmp_offsets.front()(0) + ratio*first_zmp_offset_x;
162 swing_foot_zmp_offsets.front()(0) = ratio*swing_foot_zmp_offsets.front()(0) + (1-ratio)*second_zmp_offset_x;
164 swing_foot_zmp_offsets.front()(0) = first_zmp_offset_x;
166 swing_foot_zmp_offsets.front()(0) = second_zmp_offset_x;
169 swing_foot_zmp_offsets.front()(0) = ratio * second_zmp_offset_x + (1-ratio) * first_zmp_offset_x;
172 if ((
is_second_phase() && ( cnt < double_support_count_half_before )) ||
182 }
else if ( cnt < double_support_static_count_half_before ) {
186 ret = (1 - ratio) * current_support_zmp + ratio * prev_support_zmp;
187 }
else if ( cnt > one_step_count - double_support_static_count_half_after ) {
191 ret = (1 - ratio) * prev_support_zmp + ratio * current_support_zmp;
192 }
else if ( cnt < double_support_count_half_before ) {
195 double ratio = ((
is_second_phase()?1.0:0.5) / (double_support_count_half_before-double_support_static_count_half_before)) * (double_support_count_half_before-cnt);
196 ret = (1 - ratio) * current_support_zmp + ratio * prev_support_zmp;
197 }
else if ( cnt > one_step_count - double_support_count_half_after ) {
200 double ratio = ((
is_second_last_phase()?1.0:0.5) / (double_support_count_half_after-double_support_static_count_half_after)) * (cnt - 1 - (one_step_count - double_support_count_half_after));
201 ret = (1 - ratio) * prev_support_zmp + ratio * current_support_zmp;
227 int support_len_before =
one_step_count * _default_double_support_ratio_before;
228 int support_len_after =
one_step_count * _default_double_support_ratio_after;
231 if (current_swing_count == support_len_before) {
232 for (std::vector<step_node>::iterator it = swing_leg_src_steps.begin(); it != swing_leg_src_steps.end(); it++) {
233 swing_foot_rot_interpolator[it->l_r]->clear();
235 swing_foot_rot_interpolator[it->l_r]->set(tmp);
237 int swing_len =
one_step_count - support_len_before - support_len_after;
238 for (
size_t ii = 0; ii < swing_leg_dst_steps.size(); ii++) {
239 leg_type lt = swing_leg_dst_steps[ii].l_r;
240 swing_foot_rot_interpolator[lt]->setGoal(
hrp::rpyFromRot(swing_leg_src_steps[ii].worldcoords.rot.transpose() * swing_leg_dst_steps[ii].worldcoords.rot).
data(),
242 swing_foot_rot_interpolator[lt]->sync();
244 }
else if ( (current_swing_count > support_len_before) && (current_swing_count < (
one_step_count-support_len_after) ) ) {
245 int tmp_len = (lcg_count - support_len_after);
246 for (
size_t ii = 0; ii < swing_leg_dst_steps.size(); ii++) {
247 leg_type lt = swing_leg_dst_steps[ii].l_r;
248 swing_foot_rot_interpolator[lt]->setGoal(
hrp::rpyFromRot(swing_leg_src_steps[ii].worldcoords.rot.transpose() * swing_leg_dst_steps[ii].worldcoords.rot).
data(),
250 swing_foot_rot_interpolator[lt]->sync();
253 for (
size_t ii = 0; ii < swing_leg_dst_steps.size(); ii++) {
255 if ( !swing_foot_rot_interpolator[swing_leg_dst_steps[ii].l_r]->isEmpty() ) {
256 swing_foot_rot_interpolator[swing_leg_dst_steps[ii].l_r]->get(tmpv.data(),
true);
258 if ( (current_swing_count < support_len_before) ) {
259 tmpv = hrp::Vector3::Zero();
260 }
else if (current_swing_count >= (
one_step_count-support_len_after)) {
261 tmpv =
hrp::rpyFromRot(swing_leg_src_steps[ii].worldcoords.rot.transpose() * swing_leg_dst_steps[ii].worldcoords.rot);
264 tmp_swing_foot_rot.insert(std::pair<leg_type, hrp::Vector3>(swing_leg_dst_steps[ii].l_r, tmpv));
269 void leg_coords_generator::calc_current_swing_leg_steps (std::vector<step_node>& rets,
const double step_height,
const double _current_toe_angle,
const double _current_heel_angle,
const double _default_double_support_ratio_before,
const double _default_double_support_ratio_after)
272 std::sort(swing_leg_src_steps.begin(), swing_leg_src_steps.end(),
274 std::sort(swing_leg_dst_steps.begin(), swing_leg_dst_steps.end(),
276 std::map<leg_type, hrp::Vector3> tmp_swing_foot_rot;
277 calc_current_swing_foot_rot(tmp_swing_foot_rot, _default_double_support_ratio_before, _default_double_support_ratio_after);
278 size_t swing_trajectory_generator_idx = 0;
279 for (std::vector<step_node>::iterator it1 = swing_leg_src_steps.begin(), it2 = swing_leg_dst_steps.begin();
280 it1 != swing_leg_src_steps.end() && it2 != swing_leg_dst_steps.end();
284 switch (default_orbit_type) {
286 ret.
pos = swing_ratio*it1->worldcoords.pos + (1-swing_ratio)*it2->worldcoords.pos;
289 cycloid_midcoords(ret, it1->worldcoords, it2->worldcoords, step_height);
292 rectangle_midcoords(ret, it1->worldcoords, it2->worldcoords, step_height, swing_trajectory_generator_idx);
295 stair_midcoords(ret, it1->worldcoords, it2->worldcoords, step_height);
298 cycloid_delay_midcoords(ret, it1->worldcoords, it2->worldcoords, step_height, swing_trajectory_generator_idx);
301 cycloid_delay_kick_midcoords(ret, it1->worldcoords, it2->worldcoords, step_height);
304 cross_delay_midcoords(ret, it1->worldcoords, it2->worldcoords, step_height, it1->l_r);
308 swing_trajectory_generator_idx++;
309 if (std::fabs(step_height) > 1e-3*10) {
310 if (swing_leg_src_steps.size() == 1)
311 modif_foot_coords_for_toe_heel_phase(ret, _current_toe_angle, _current_heel_angle);
313 rets.push_back(
step_node(it1->l_r, ret, 0, 0, 0, 0));
319 int support_len_before =
one_step_count * default_double_support_ratio_before;
320 int support_len_after =
one_step_count * default_double_support_ratio_after;
322 int swing_len =
one_step_count - support_len_before - support_len_after;
323 int current_swing_len = lcg_count - support_len_before;
324 double tmp_current_swing_time;
326 if ( current_swing_count < support_len_before ) {
328 tmp_current_swing_time = current_swing_len *
dt - swing_len *
dt;
329 is_swing_phase =
false;
330 }
else if ( current_swing_count >= support_len_before+swing_len ) {
332 tmp_current_swing_time = current_swing_len *
dt + (support_len_before + support_len_after + next_one_step_count) *
dt;
333 is_swing_phase =
false;
335 tmp_current_swing_time = current_swing_len *
dt;
336 swing_ratio =
static_cast<double>(current_swing_count-support_len_before)/swing_len;
338 if (current_step_height > 0.0) is_swing_phase =
true;
339 else is_swing_phase =
false;
341 for (std::vector<leg_type>::const_iterator it = support_leg_types.begin(); it != support_leg_types.end(); it++) {
342 current_swing_time.at(*it) = (lcg_count + default_double_support_ratio_before * next_one_step_count) *
dt;
344 for (std::vector<leg_type>::const_iterator it = swing_leg_types.begin(); it != swing_leg_types.end(); it++) {
345 if (current_step_height > 0.0) {
346 current_swing_time.at(*it) = tmp_current_swing_time;
348 current_swing_time.at(*it) = (lcg_count + default_double_support_ratio_before * next_one_step_count) *
dt;
359 toe_heel_interpolator->clear();
360 toe_heel_interpolator->set(&start);
363 toe_heel_interpolator->sync();
365 if (!toe_heel_interpolator->isEmpty()) {
366 toe_heel_interpolator->get(&tmp_ip_ratio,
true);
368 toe_heel_interpolator->get(&tmp_ip_ratio,
false);
377 double dif_angle = 0.0;
379 double first_goal_angle, second_goal_angle, first_pos_offset_x, second_pos_offset_x;
386 first_goal_angle = _current_toe_angle;
387 second_goal_angle = -1 * _current_heel_angle;
388 first_pos_offset_x = toe_pos_offset_x;
389 second_pos_offset_x = heel_pos_offset_x;
392 dif_angle = calc_interpolated_toe_heel_angle(
SOLE0,
SOLE2TOE, 0.0, first_goal_angle);
393 ee_local_pivot_pos(0) = first_pos_offset_x;
395 dif_angle = calc_interpolated_toe_heel_angle(
SOLE2HEEL,
HEEL2SOLE, second_goal_angle, 0.0);
396 ee_local_pivot_pos(0) = second_pos_offset_x;
400 dif_angle = calc_interpolated_toe_heel_angle(
SOLE2TOE,
SOLE2HEEL, first_goal_angle, second_goal_angle);
401 double tmpd = (second_goal_angle-first_goal_angle);
402 if (std::fabs(tmpd) > 1e-5) {
403 ee_local_pivot_pos(0) = (second_pos_offset_x - first_pos_offset_x) * (dif_angle - first_goal_angle) / tmpd + first_pos_offset_x;
405 ee_local_pivot_pos(0) = first_pos_offset_x;
409 dif_angle = calc_interpolated_toe_heel_angle(
SOLE2TOE,
TOE2SOLE, first_goal_angle, 0.0);
410 ee_local_pivot_pos(0) = first_pos_offset_x;
412 dif_angle = calc_interpolated_toe_heel_angle(
SOLE1,
SOLE2HEEL, 0.0, second_goal_angle);
413 ee_local_pivot_pos(0) = second_pos_offset_x;
417 foot_dif_rot_angle = (dif_angle > 0.0 ?
deg2rad(dif_angle) : 0.0);
418 if (use_toe_joint && dif_angle > 0.0) dif_angle = 0.0;
419 toe_heel_dif_angle = dif_angle;
420 Eigen::AngleAxis<double> tmpr(
deg2rad(dif_angle), hrp::Vector3::UnitY());
422 new_coords.
pos = org_coords.
pos + org_coords.
rot * ee_local_pivot_pos - new_coords.
rot * ee_local_pivot_pos;
423 org_coords = new_coords;
427 const coordinates& goal,
const double height)
const 433 const coordinates& goal,
const double height,
const size_t swing_trajectory_generator_idx)
445 const coordinates& goal,
const double height,
const size_t swing_trajectory_generator_idx)
460 crdtg.set_swing_leg(lr);
466 bool matching_flag =
true;
467 if (fns_1.size() == fns_2.size()) {
468 for (std::vector<step_node>::const_iterator it1 = fns_1.begin(); it1 != fns_1.end(); it1++) {
469 std::vector<step_node>::const_iterator it2 = std::find_if(fns_2.begin(), fns_2.end(), (&boost::lambda::_1->* &
step_node::l_r == it1->l_r));
470 if (it2 == fns_2.end()) {
471 matching_flag =
false;
476 matching_flag =
false;
478 return matching_flag;
483 std::vector<coordinates> swg_src_coords, swg_dst_coords,sup_coords;
484 for (std::vector<step_node>::const_iterator it = swing_leg_src_steps.begin(); it != swing_leg_src_steps.end(); it++) {
485 if (it->l_r ==
RLEG or it->l_r ==
LLEG) swg_src_coords.push_back(it->worldcoords);
487 for (std::vector<step_node>::const_iterator it = swing_leg_dst_steps.begin(); it != swing_leg_dst_steps.end(); it++) {
488 if (it->l_r ==
RLEG or it->l_r ==
LLEG) swg_dst_coords.push_back(it->worldcoords);
490 for (std::vector<step_node>::const_iterator it = support_leg_steps.begin(); it != support_leg_steps.end(); it++) {
491 if (it->l_r ==
RLEG or it->l_r ==
LLEG) sup_coords.push_back(it->worldcoords);
493 coordinates tmp_swg_src_mid, tmp_swg_dst_mid, tmp_swg_mid, tmp_sup_mid;
494 const double rot_eps = 1e-5;
495 if (swg_src_coords.size() > 0)
multi_mid_coords(tmp_swg_src_mid, swg_src_coords, rot_eps);
496 if (swg_dst_coords.size() > 0)
multi_mid_coords(tmp_swg_dst_mid, swg_dst_coords, rot_eps);
497 if (sup_coords.size() > 0)
multi_mid_coords(tmp_sup_mid, sup_coords, rot_eps);
499 foot_midcoords_interpolator->clear();
500 double tmp[foot_midcoords_interpolator->dimension()];
501 for (
size_t ii = 0; ii < 3; ii++) {
502 tmp[ii] = tmp_swg_src_mid.
pos(ii);
505 foot_midcoords_interpolator->set(tmp);
509 for (
size_t ii = 0; ii < 3; ii++) {
510 tmp[ii] = tmp_swg_dst_mid.
pos(ii);
511 tmp[ii+3] = tmpr(ii);
514 foot_midcoords_interpolator->sync();
516 double tmp[foot_midcoords_interpolator->dimension()];
519 for (
size_t ii = 0; ii < 3; ii++) {
520 tmp[ii] = tmp_swg_dst_mid.
pos(ii);
521 tmp[ii+3] = tmpr(ii);
523 foot_midcoords_interpolator->setGoal(tmp,
dt*lcg_count,
true);
524 foot_midcoords_interpolator->sync();
526 if (!foot_midcoords_interpolator->isEmpty()) {
527 double tmp[foot_midcoords_interpolator->dimension()];
528 foot_midcoords_interpolator->get(tmp,
true);
530 for (
size_t ii = 0; ii < 3; ii++) {
531 tmp_swg_mid.
pos(ii) = tmp[ii];
532 tmpr(ii) = tmp[ii+3];
536 tmp_swg_mid = tmp_swg_dst_mid;
538 mid_coords(swing_support_midcoords, static_cast<double>(sup_coords.size()) / (swg_src_coords.size() + sup_coords.size()), tmp_swg_mid, tmp_sup_mid, rot_eps);
544 calc_swing_support_params_from_footstep_nodes_list(fnsl);
547 calc_swing_support_mid_coords ();
549 calc_ratio_from_double_support_ratio(default_double_support_ratio_before, default_double_support_ratio_after);
550 swing_leg_steps.clear();
551 calc_current_swing_leg_steps(swing_leg_steps, current_step_height, current_toe_angle, current_heel_angle, default_double_support_ratio_before, default_double_support_ratio_after);
552 if ( 1 <= lcg_count ) {
556 if (footstep_index < fnsl.size() - 1) {
559 if (footstep_index < fnsl.size() - 1) {
560 current_step_height = fnsl[footstep_index].front().step_height;
561 current_toe_angle = fnsl[footstep_index].front().toe_angle;
562 current_heel_angle = fnsl[footstep_index].front().heel_angle;
564 current_step_height = current_toe_angle = current_heel_angle = 0.0;
566 if (footstep_index < fnsl.size()) {
567 one_step_count =
static_cast<size_t>(fnsl[footstep_index].front().step_time/
dt);
570 if (footstep_index + 1 < fnsl.size()) {
571 next_one_step_count =
static_cast<size_t>(fnsl[footstep_index+1].front().step_time/
dt);
574 switch (default_orbit_type) {
576 for (
size_t i = 0;
i < rdtg.size();
i++)
577 rdtg[
i].
reset(
one_step_count, default_double_support_ratio_before, default_double_support_ratio_after);
580 sdtg.reset(
one_step_count, default_double_support_ratio_before, default_double_support_ratio_after);
583 for (
size_t i = 0;
i < cdtg.size();
i++)
584 cdtg[
i].
reset(
one_step_count, default_double_support_ratio_before, default_double_support_ratio_after);
587 cdktg.reset(
one_step_count, default_double_support_ratio_before, default_double_support_ratio_after);
590 crdtg.reset(
one_step_count, default_double_support_ratio_before, default_double_support_ratio_after);
600 const std::vector<step_node>& initial_support_leg_steps,
601 const std::vector<step_node>& initial_swing_leg_dst_steps,
605 size_t one_step_len = footstep_nodes_list.front().front().step_time /
dt;
607 for (std::vector<step_node>::iterator it_fns = footstep_nodes_list.front().begin(); it_fns != footstep_nodes_list.front().end(); it_fns++) {
608 for (std::vector<step_node>::const_iterator it_init = initial_swing_leg_dst_steps.begin(); it_init != initial_swing_leg_dst_steps.end(); it_init++) {
609 if (it_fns->l_r == it_init->l_r) {
611 it_fns->worldcoords = it_init->worldcoords;
617 std::vector<coordinates> cv;
618 for (
size_t i = 0;
i < initial_support_leg_steps.size();
i++) {
619 cv.push_back(initial_support_leg_steps[
i].worldcoords);
621 for (
size_t i = 0;
i < initial_swing_leg_dst_steps.size();
i++) {
622 cv.push_back(initial_swing_leg_dst_steps[
i].worldcoords);
626 rg.reset(one_step_len);
627 rg.push_refzmp_from_footstep_nodes_for_dual(footstep_nodes_list.front(), initial_support_leg_steps, initial_swing_leg_dst_steps);
628 if ( preview_controller_ptr != NULL ) {
629 delete preview_controller_ptr;
630 preview_controller_ptr = NULL;
634 lcg.reset(one_step_len, footstep_nodes_list.at(1).front().step_time/
dt, initial_swing_leg_dst_steps, initial_swing_leg_dst_steps, initial_support_leg_steps, default_double_support_ratio_swing_before, default_double_support_ratio_swing_after);
636 lcg.set_swing_support_steps_list(footstep_nodes_list);
637 for (
size_t i = 1;
i < footstep_nodes_list.size()-1;
i++) {
638 std::vector<step_node> tmp_swing_leg_src_steps;
639 lcg.calc_swing_leg_src_steps(tmp_swing_leg_src_steps, footstep_nodes_list,
i);
640 toe_heel_types tht(thtc.check_toe_heel_type_from_swing_support_coords(tmp_swing_leg_src_steps.front().worldcoords, lcg.get_support_leg_steps_idx(
i).front().worldcoords, lcg.get_toe_pos_offset_x(), lcg.get_heel_pos_offset_x()),
641 thtc.check_toe_heel_type_from_swing_support_coords(lcg.get_swing_leg_dst_steps_idx(
i).front().worldcoords, lcg.get_support_leg_steps_idx(
i).front().worldcoords, lcg.get_toe_pos_offset_x(), lcg.get_heel_pos_offset_x()));
642 rg.push_refzmp_from_footstep_nodes_for_single(footstep_nodes_list.at(
i), lcg.get_support_leg_steps_idx(
i), tht);
644 rg.push_refzmp_from_footstep_nodes_for_dual(footstep_nodes_list.back(),
645 lcg.get_support_leg_steps_idx(footstep_nodes_list.size()-1),
646 lcg.get_swing_leg_dst_steps_idx(footstep_nodes_list.size()-1));
647 emergency_flg = IDLING;
654 if (emergency_flg == EMERGENCY_STOP && lcg.get_footstep_index() > 0) {
655 leg_type cur_leg = footstep_nodes_list[lcg.get_footstep_index()].front().l_r;
656 leg_type first_step = overwritable_footstep_index_offset % 2 == 0 ? cur_leg : (cur_leg ==
RLEG ?
LLEG :
RLEG);
658 overwrite_footstep_nodes_list.push_back(boost::assign::list_of(
step_node(first_step, footstep_nodes_list[get_overwritable_index() - 2].
front().worldcoords, 0, default_step_time, 0, 0)));
659 overwrite_footstep_nodes_list.push_back(boost::assign::list_of(
step_node(first_step==
RLEG?
LLEG:
RLEG, footstep_nodes_list[get_overwritable_index() - 1].
front().worldcoords, 0, default_step_time, 0, 0)));
660 overwrite_footstep_nodes_list.push_back(boost::assign::list_of(
step_node(first_step, footstep_nodes_list[get_overwritable_index() - 2].
front().worldcoords, 0, default_step_time, 0, 0)));
662 overwrite_refzmp_queue(overwrite_footstep_nodes_list);
663 overwrite_footstep_nodes_list.clear();
664 emergency_flg = STOPPING;
665 }
else if ( lcg.get_lcg_count() == get_overwrite_check_timing() ) {
666 if (velocity_mode_flg != VEL_IDLING && lcg.get_footstep_index() > 0) {
667 std::vector< std::vector<step_node> > cv;
668 calc_next_coords_velocity_mode(cv, get_overwritable_index(),
669 (overwritable_footstep_index_offset == 0 ? 4 : 3)
671 if (velocity_mode_flg == VEL_ENDING) velocity_mode_flg = VEL_IDLING;
672 std::vector<leg_type> first_overwrite_leg;
673 for (
size_t i = 0;
i < footstep_nodes_list[get_overwritable_index()].size();
i++) {
674 first_overwrite_leg.push_back(footstep_nodes_list[get_overwritable_index()].at(
i).l_r);
676 for (
size_t i = 0;
i < cv.size();
i++) {
677 std::vector<step_node> tmp_fsn;
678 for (
size_t j = 0;
j < cv.at(
i).size();
j++) {
679 cv.at(
i).at(
j).worldcoords.pos += modified_d_footstep;
680 tmp_fsn.push_back(
step_node(cv.at(
i).at(
j).l_r, cv.at(
i).at(
j).worldcoords,
681 lcg.get_default_step_height(), default_step_time, lcg.get_toe_angle(), lcg.get_heel_angle()));
683 overwrite_footstep_nodes_list.push_back(tmp_fsn);
685 overwrite_refzmp_queue(overwrite_footstep_nodes_list);
686 overwrite_footstep_nodes_list.clear();
687 }
else if ( !overwrite_footstep_nodes_list.empty() &&
688 (lcg.get_footstep_index() < footstep_nodes_list.size()-1) &&
689 get_overwritable_index() == overwrite_footstep_index ) {
690 overwrite_refzmp_queue(overwrite_footstep_nodes_list);
691 overwrite_footstep_nodes_list.clear();
695 if (use_stride_limitation && lcg.get_footstep_index() > 0 && lcg.get_footstep_index() < footstep_nodes_list.size()-overwritable_footstep_index_offset-2 &&
696 (overwritable_footstep_index_offset == 0 || lcg.get_lcg_count() == get_overwrite_check_timing())) {
697 if (lcg.get_footstep_index() == footstep_nodes_list.size()-overwritable_footstep_index_offset-3) {
698 hrp::Vector3 orig_footstep_pos = footstep_nodes_list[get_overwritable_index()].front().worldcoords.pos;
699 limit_stride(footstep_nodes_list[get_overwritable_index()].
front(), footstep_nodes_list[get_overwritable_index()-1].
front(), overwritable_stride_limitation);
700 for (
size_t i = get_overwritable_index() + 1;
i < footstep_nodes_list.size();
i++) {
701 footstep_nodes_list[
i].front().worldcoords.pos -= orig_footstep_pos - footstep_nodes_list[get_overwritable_index()].front().worldcoords.pos;
704 limit_stride(footstep_nodes_list[get_overwritable_index()].
front(), footstep_nodes_list[get_overwritable_index()-1].
front(), overwritable_stride_limitation);
706 overwrite_footstep_nodes_list.insert(overwrite_footstep_nodes_list.end(), footstep_nodes_list.begin()+get_overwritable_index(), footstep_nodes_list.end());
707 overwrite_refzmp_queue(overwrite_footstep_nodes_list);
708 overwrite_footstep_nodes_list.clear();
711 if(modify_footsteps) modify_footsteps_for_recovery();
715 std::vector<hrp::Vector3> sfzos;
716 bool refzmp_exist_p = rg.get_current_refzmp(rzmp, sfzos, default_double_support_ratio_before, default_double_support_ratio_after, default_double_support_static_ratio_before, default_double_support_static_ratio_after);
717 if (!refzmp_exist_p) {
719 rzmp = prev_que_rzmp;
720 sfzos = prev_que_sfzos;
722 prev_que_rzmp = rzmp;
723 prev_que_sfzos = sfzos;
725 solved = preview_controller_ptr->update(refzmp, cog, swing_foot_zmp_offsets, rzmp, sfzos, (refzmp_exist_p || finalize_count < preview_controller_ptr->get_delay()-default_step_time/
dt));
741 lcg.update_leg_steps(footstep_nodes_list, default_double_support_ratio_swing_before, default_double_support_ratio_swing_after, thtc);
742 }
else if (finalize_count>0) {
743 lcg.clear_interpolators();
754 double stride_r = std::pow(cur_fs.
worldcoords.
pos(0), 2.0) + std::pow(cur_fs.
worldcoords.
pos(1) + footstep_param.leg_default_translate_pos[cur_leg ==
LLEG ?
RLEG :
LLEG](1) - footstep_param.leg_default_translate_pos[cur_leg](1), 2.0);
756 double stride_r_limit = std::pow(
std::max(limit[cur_fs.
worldcoords.
pos(0) >= 0 ? 0 : 3], limit[1] - limit[4]), 2.0);
757 if (stride_r > stride_r_limit && (cur_leg ==
LLEG ? 1 : -1) * cur_fs.
worldcoords.
pos(1) > footstep_param.leg_default_translate_pos[
LLEG](1) - footstep_param.leg_default_translate_pos[
RLEG](1)) {
759 cur_fs.
worldcoords.
pos(1) = footstep_param.leg_default_translate_pos[cur_leg](1) - footstep_param.leg_default_translate_pos[cur_leg ==
LLEG ?
RLEG :
LLEG](1) +
760 sqrt(stride_r_limit / stride_r) * (cur_fs.
worldcoords.
pos(1) + footstep_param.leg_default_translate_pos[cur_leg ==
LLEG ?
RLEG :
LLEG](1) - footstep_param.leg_default_translate_pos[cur_leg](1));
766 std::vector<double> cur_leg_vertices_y;
767 cur_leg_vertices_y.reserve(4);
772 if (cur_leg ==
LLEG) {
773 if (*std::min_element(cur_leg_vertices_y.begin(), cur_leg_vertices_y.end()) < limit[4]) cur_fs.
worldcoords.
pos(1) += limit[4] - *std::min_element(cur_leg_vertices_y.begin(), cur_leg_vertices_y.end());
775 if (*std::max_element(cur_leg_vertices_y.begin(), cur_leg_vertices_y.end()) > -1 * limit[4]) cur_fs.
worldcoords.
pos(1) += -1 * limit[4] - *std::max_element(cur_leg_vertices_y.begin(), cur_leg_vertices_y.end());
783 if (isfinite(diff_cp(0)) && isfinite(diff_cp(1))) {
786 for (
size_t i = 0;
i < 2;
i++) {
787 if (std::fabs(diff_cp(
i)) > cp_check_margin[
i]) {
788 is_emergency_walking[i] =
true;
789 tmp_diff_cp(i) = diff_cp(i) - cp_check_margin[i] * diff_cp(i)/std::fabs(diff_cp(i));
791 is_emergency_walking[i] =
false;
794 if (lcg.get_footstep_index() > 0 && lcg.get_footstep_index() < footstep_nodes_list.size()-2) {
796 static double preview_f_sum;
797 if (lcg.get_lcg_count() ==
static_cast<size_t>(footstep_nodes_list[lcg.get_footstep_index()][0].step_time/
dt * 1.0) - 1) {
798 preview_f_sum = preview_controller_ptr->get_preview_f(preview_controller_ptr->get_delay());
799 for (
size_t i = preview_controller_ptr->get_delay()-1;
i >= lcg.get_lcg_count()+1;
i--) {
800 preview_f_sum += preview_controller_ptr->get_preview_f(
i);
802 modified_d_footstep = hrp::Vector3::Zero();
804 if (lcg.get_lcg_count() <= preview_controller_ptr->get_delay()) {
805 preview_f_sum += preview_controller_ptr->get_preview_f(lcg.get_lcg_count());
808 double preview_db = 1/6.0 *
dt *
dt *
dt + 1/2.0 *
dt *
dt * 1/std::sqrt(gravitational_acceleration / (cog(2) - refzmp(2)));
809 hrp::Vector3 d_footstep = -1/preview_f_sum * 1/preview_db * footstep_modification_gain * tmp_diff_cp;
812 if (lcg.get_lcg_count() <=
static_cast<size_t>(footstep_nodes_list[lcg.get_footstep_index()][0].step_time/
dt * 1.0) - 1 &&
813 lcg.get_lcg_count() >=
static_cast<size_t>(footstep_nodes_list[lcg.get_footstep_index()][0].step_time/
dt * (default_double_support_ratio_after + margin_time_ratio)) - 1 &&
814 !(lcg.get_lcg_count() <=
static_cast<size_t>(footstep_nodes_list[lcg.get_footstep_index()][0].step_time/
dt * 0.5) - 1 && act_contact_states[0] && act_contact_states[1])) {
816 hrp::Vector3 orig_footstep_pos = footstep_nodes_list[get_overwritable_index()].front().worldcoords.pos;
817 for (
size_t i = 0;
i < 2;
i++) {
818 if (is_emergency_walking[
i]) footstep_nodes_list[get_overwritable_index()].front().worldcoords.pos(i) += d_footstep(i);
820 limit_stride(footstep_nodes_list[get_overwritable_index()].
front(), footstep_nodes_list[get_overwritable_index()-1].
front(), overwritable_stride_limitation);
821 d_footstep = footstep_nodes_list[get_overwritable_index()].front().worldcoords.pos - orig_footstep_pos;
822 for (
size_t i = lcg.get_footstep_index()+1;
i < footstep_nodes_list.size();
i++) {
823 footstep_nodes_list[
i].front().worldcoords.pos += d_footstep;
825 if (is_emergency_walking[0] || is_emergency_walking[1]) {
826 overwrite_footstep_nodes_list.insert(overwrite_footstep_nodes_list.end(), footstep_nodes_list.begin()+lcg.get_footstep_index(), footstep_nodes_list.end());
828 overwrite_refzmp_queue(overwrite_footstep_nodes_list);
829 overwrite_footstep_nodes_list.clear();
830 modified_d_footstep += d_footstep;
834 modified_d_footstep = hrp::Vector3::Zero();
844 const std::vector<coordinates>& initial_support_legs_coords,
coordinates start_ref_coords,
845 const std::vector<leg_type>& initial_support_legs,
846 std::vector< std::vector<step_node> >& new_footstep_nodes_list,
847 const bool is_initialize)
850 size_t overwritable_fs_index = 0;
851 if (!is_initialize) {
852 if (lcg.get_footstep_index() <= get_overwrite_check_timing()) {
853 overwritable_fs_index = get_overwritable_index()+1;
855 overwritable_fs_index = get_overwritable_index();
859 if (overwritable_fs_index > footstep_nodes_list.size()-1)
return false;
860 go_pos_param_2_footstep_nodes_list_core (goal_x, goal_y, goal_theta,
861 initial_support_legs_coords, start_ref_coords, initial_support_legs,
862 new_footstep_nodes_list, is_initialize, overwritable_fs_index);
865 clear_footstep_nodes_list();
866 footstep_nodes_list = new_footstep_nodes_list;
868 set_overwrite_foot_steps_list(new_footstep_nodes_list);
869 set_overwrite_foot_step_index(overwritable_fs_index);
871 print_footstep_nodes_list();
876 const std::vector<coordinates>& initial_support_legs_coords,
coordinates start_ref_coords,
877 const std::vector<leg_type>& initial_support_legs,
878 std::vector< std::vector<step_node> >& new_footstep_nodes_list,
879 const bool is_initialize,
const size_t overwritable_fs_index)
const 884 goal_ref_coords = start_ref_coords;
886 goal_ref_coords = initial_foot_mid_coords;
887 step_node tmpfs = footstep_nodes_list[overwritable_fs_index-1].front();
889 start_ref_coords.
pos += start_ref_coords.
rot *
hrp::Vector3(-1*footstep_param.leg_default_translate_pos[tmpfs.
l_r]);
893 std::cerr <<
"start ref coords" << std::endl;
894 std::cerr <<
" pos =" << std::endl;
895 std::cerr << start_ref_coords.
pos.format(Eigen::IOFormat(Eigen::StreamPrecision, 0,
", ",
", ",
"",
"",
" [",
"]")) << std::endl;
896 std::cerr <<
" rot =" << std::endl;
897 std::cerr << start_ref_coords.
rot.format(Eigen::IOFormat(Eigen::StreamPrecision, 0,
", ",
"\n",
" [",
"]")) << std::endl;
898 std::cerr <<
"goal ref midcoords" << std::endl;
899 std::cerr <<
" pos =" << std::endl;
900 std::cerr << goal_ref_coords.
pos.format(Eigen::IOFormat(Eigen::StreamPrecision, 0,
", ",
", ",
"",
"",
" [",
"]")) << std::endl;
901 std::cerr <<
" rot =" << std::endl;
902 std::cerr << goal_ref_coords.
rot.format(Eigen::IOFormat(Eigen::StreamPrecision, 0,
", ",
"\n",
" [",
"]")) << std::endl;
907 std::vector<step_node> initial_footstep_nodes;
908 for (
size_t i = 0;
i < initial_support_legs.size();
i++) {
909 initial_footstep_nodes.push_back(
step_node(initial_support_legs.at(
i), initial_support_legs_coords.at(
i), 0, default_step_time, 0, 0));
911 new_footstep_nodes_list.push_back(initial_footstep_nodes);
913 new_footstep_nodes_list.push_back(footstep_nodes_list[overwritable_fs_index]);
918 start_ref_coords.
difference(dp, dr, goal_ref_coords);
919 dp = start_ref_coords.
rot.transpose() * dp;
920 dr = start_ref_coords.
rot.transpose() * dr;
921 while ( !(
eps_eq(std::sqrt(dp(0)*dp(0)+dp(1)*dp(1)), 0.0, 1e-3*0.1) &&
eps_eq(dr(2), 0.0,
deg2rad(0.5))) ) {
923 cur_vel_param.
set(dp(0)/default_step_time, dp(1)/default_step_time,
rad2deg(dr(2))/default_step_time);
924 append_footstep_list_velocity_mode(new_footstep_nodes_list, cur_vel_param);
925 start_ref_coords = new_footstep_nodes_list.back().front().worldcoords;
926 start_ref_coords.
pos += start_ref_coords.
rot *
hrp::Vector3(footstep_param.leg_default_translate_pos[new_footstep_nodes_list.back().front().l_r] * -1.0);
927 start_ref_coords.
difference(dp, dr, goal_ref_coords);
928 dp = start_ref_coords.
rot.transpose() * dp;
929 dr = start_ref_coords.
rot.transpose() * dr;
931 for (
size_t i = 0;
i < optional_go_pos_finalize_footstep_num;
i++) {
932 append_go_pos_step_nodes(start_ref_coords, calc_counter_leg_types_from_footstep_nodes(new_footstep_nodes_list.back(), all_limbs), new_footstep_nodes_list);
937 append_go_pos_step_nodes(start_ref_coords, calc_counter_leg_types_from_footstep_nodes(new_footstep_nodes_list.back(), all_limbs), new_footstep_nodes_list);
939 coordinates final_step_coords1 = new_footstep_nodes_list[new_footstep_nodes_list.size()-2].front().worldcoords;
941 final_step_coords2.
pos += final_step_coords2.
rot *
hrp::Vector3(footstep_param.leg_default_translate_pos[new_footstep_nodes_list[new_footstep_nodes_list.size()-2].front().l_r]);
942 final_step_coords1.
difference(dp, dr, final_step_coords2);
944 append_go_pos_step_nodes(start_ref_coords, calc_counter_leg_types_from_footstep_nodes(new_footstep_nodes_list.back(), all_limbs), new_footstep_nodes_list);
948 append_finalize_footstep(new_footstep_nodes_list);
954 const std::string& tmp_swing_leg,
958 step_node sn0((_swing_leg ==
RLEG) ?
LLEG :
RLEG, _support_leg_coords, lcg.get_default_step_height(), default_step_time, lcg.get_toe_angle(), lcg.get_heel_angle());
959 footstep_nodes_list.push_back(boost::assign::list_of(sn0));
960 step_node sn1(_swing_leg, _support_leg_coords, lcg.get_default_step_height(), default_step_time, lcg.get_toe_angle(), lcg.get_heel_angle());
961 hrp::Vector3 trs(2.0 * footstep_param.leg_default_translate_pos[_swing_leg] +
hrp::Vector3(goal_x, goal_y, goal_z));
962 sn1.worldcoords.pos += sn1.worldcoords.rot * trs;
964 footstep_nodes_list.push_back(boost::assign::list_of(sn1));
965 footstep_nodes_list.push_back(boost::assign::list_of(sn0));
969 const double vel_x,
const double vel_y,
const double vel_theta,
970 const std::vector<leg_type>& current_legs)
972 velocity_mode_flg = VEL_DOING;
974 clear_footstep_nodes_list();
975 set_velocity_param (vel_x, vel_y, vel_theta);
976 append_go_pos_step_nodes(_ref_coords, current_legs);
977 append_footstep_list_velocity_mode();
978 append_footstep_list_velocity_mode();
979 append_footstep_list_velocity_mode();
984 if (velocity_mode_flg == VEL_DOING) velocity_mode_flg = VEL_ENDING;
989 ref_coords = sup_fns.front().worldcoords;
990 hrp::Vector3 tmpv(footstep_param.leg_default_translate_pos[sup_fns.front().l_r] * -1.0);
991 ref_coords.
pos += ref_coords.
rot * tmpv;
992 double dx = cur_vel_param.
velocity_x + offset_vel_param.velocity_x, dy = cur_vel_param.
velocity_y + offset_vel_param.velocity_y;
993 dth = cur_vel_param.
velocity_theta + offset_vel_param.velocity_theta;
996 if (default_stride_limitation_type ==
SQUARE) {
997 dth =
std::max(-1 * footstep_param.stride_outside_theta / default_step_time,
std::min(footstep_param.stride_outside_theta / default_step_time, dth));
998 }
else if (default_stride_limitation_type ==
CIRCLE) {
999 dth =
std::max(-1 * stride_limitation_for_circle_type[2] / default_step_time,
std::min(stride_limitation_for_circle_type[2] / default_step_time, dth));
1001 if (default_stride_limitation_type ==
SQUARE) {
1002 dx =
std::max(-1 * footstep_param.stride_bwd_x / default_step_time,
std::min(footstep_param.stride_fwd_x / default_step_time, dx ));
1003 dy =
std::max(-1 * footstep_param.stride_outside_y / default_step_time,
std::min(footstep_param.stride_outside_y / default_step_time, dy ));
1005 if (use_inside_step_limitation) {
1009 dy =
std::min(footstep_param.stride_inside_y / default_step_time, dy);
1014 dy =
std::max(-1 * footstep_param.stride_inside_y / default_step_time, dy);
1020 dth =
std::min(footstep_param.stride_inside_theta / default_step_time, dth);
1025 dth =
std::max(-1 * footstep_param.stride_inside_theta / default_step_time, dth);
1031 trans =
hrp::Vector3(dx * default_step_time, dy * default_step_time, 0);
1032 dth =
deg2rad(dth * default_step_time);
1037 append_footstep_list_velocity_mode(footstep_nodes_list, vel_param);
1045 calc_ref_coords_trans_vector_velocity_mode(ref_coords, trans, dth, _footstep_nodes_list.back(), cur_vel_param);
1047 ref_coords.
pos += ref_coords.
rot * trans;
1049 append_go_pos_step_nodes(ref_coords, calc_counter_leg_types_from_footstep_nodes(_footstep_nodes_list.back(), all_limbs), _footstep_nodes_list);
1050 if (default_stride_limitation_type ==
CIRCLE) limit_stride(_footstep_nodes_list[_footstep_nodes_list.size()-1].front(), _footstep_nodes_list[_footstep_nodes_list.size()-2].front(), stride_limitation_for_circle_type);
1058 calc_ref_coords_trans_vector_velocity_mode(ref_coords, trans, dth, footstep_nodes_list[idx-1], vel_param);
1060 std::vector<leg_type> cur_sup_legs, next_sup_legs;
1061 for (
size_t i = 0;
i < footstep_nodes_list[idx-1].size();
i++) cur_sup_legs.push_back(footstep_nodes_list[idx-1].at(
i).l_r);
1062 next_sup_legs = calc_counter_leg_types_from_footstep_nodes(footstep_nodes_list[idx-1], all_limbs);
1064 for (
size_t i = 0;
i < future_step_num;
i++) {
1065 std::vector<step_node>
ret;
1066 std::vector<leg_type> forcused_sup_legs;
1068 case 0: forcused_sup_legs = next_sup_legs;
break;
1069 case 1: forcused_sup_legs = cur_sup_legs;
break;
1071 if ( velocity_mode_flg != VEL_ENDING ) {
1072 ref_coords.
pos += ref_coords.
rot * trans;
1075 for (
size_t j = 0;
j < forcused_sup_legs.size();
j++) {
1076 ret.push_back(
step_node(forcused_sup_legs.at(
j), ref_coords, 0, 0, 0, 0));
1077 ret[
j].worldcoords.pos += ret[
j].worldcoords.rot * footstep_param.leg_default_translate_pos[forcused_sup_legs.at(
j)];
1078 if (default_stride_limitation_type ==
CIRCLE) limit_stride(ret[
j], (
i == 0 ? footstep_nodes_list[idx-1].at(j) : ret_list[
i -1].at(j)), stride_limitation_for_circle_type);
1080 ret_list.push_back(ret);
1086 size_t idx = get_overwritable_index();
1087 footstep_nodes_list.erase(footstep_nodes_list.begin()+idx, footstep_nodes_list.end());
1090 footstep_nodes_list.insert(footstep_nodes_list.end(), fnsl.begin(), fnsl.end());
1093 lcg.set_swing_support_steps_list(footstep_nodes_list);
1097 rg.remove_refzmp_cur_list_over_length(idx);
1099 rg.set_indices(idx);
1100 if (overwritable_footstep_index_offset == 0) {
1101 rg.set_refzmp_count(lcg.get_lcg_count());
1103 rg.set_refzmp_count(static_cast<size_t>(fnsl[0][0].step_time/
dt));
1106 for (
size_t i = 0;
i < fnsl.size();
i++) {
1107 if (emergency_flg == EMERGENCY_STOP)
1108 rg.push_refzmp_from_footstep_nodes_for_dual(footstep_nodes_list[idx+
i],
1109 lcg.get_swing_leg_dst_steps_idx(footstep_nodes_list.size()-1),
1110 lcg.get_support_leg_steps_idx(footstep_nodes_list.size()-1));
1112 if (
i==fnsl.size()-1) {
1113 rg.push_refzmp_from_footstep_nodes_for_dual(footstep_nodes_list[fnsl.size()-1],
1114 lcg.get_swing_leg_dst_steps_idx(footstep_nodes_list.size()-1),
1115 lcg.get_support_leg_steps_idx(footstep_nodes_list.size()-1));
1117 std::vector<step_node> tmp_swing_leg_src_steps;
1118 lcg.calc_swing_leg_src_steps(tmp_swing_leg_src_steps, footstep_nodes_list, idx+
i);
1119 toe_heel_types tht(thtc.check_toe_heel_type_from_swing_support_coords(tmp_swing_leg_src_steps.front().worldcoords, lcg.get_support_leg_steps_idx(idx+
i).front().worldcoords, lcg.get_toe_pos_offset_x(), lcg.get_heel_pos_offset_x()),
1120 thtc.check_toe_heel_type_from_swing_support_coords(lcg.get_swing_leg_dst_steps_idx(idx+
i).front().worldcoords, lcg.get_support_leg_steps_idx(idx+
i).front().worldcoords, lcg.get_toe_pos_offset_x(), lcg.get_heel_pos_offset_x()));
1121 rg.push_refzmp_from_footstep_nodes_for_single(footstep_nodes_list[idx+
i], lcg.get_support_leg_steps_idx(idx+
i), tht);
1126 size_t queue_size = preview_controller_ptr->get_preview_queue_size();
1127 size_t overwrite_idx;
1128 if (overwritable_footstep_index_offset == 0) {
1131 overwrite_idx = lcg.get_lcg_count();
1135 bool refzmp_exist_p;
1136 std::vector<hrp::Vector3> sfzos;
1137 for (
size_t i = overwrite_idx;
i < queue_size - 1;
i++) {
1138 refzmp_exist_p = rg.get_current_refzmp(rzmp, sfzos, default_double_support_ratio_before, default_double_support_ratio_after, default_double_support_static_ratio_before, default_double_support_static_ratio_after);
1139 preview_controller_ptr->set_preview_queue(rzmp, sfzos,
i+1);
1140 if (refzmp_exist_p) {
1141 prev_que_rzmp = rzmp;
1142 prev_que_sfzos = sfzos;
1148 refzmp_exist_p = rg.get_current_refzmp(rzmp, sfzos, default_double_support_ratio_before, default_double_support_ratio_after, default_double_support_static_ratio_before, default_double_support_static_ratio_after);
1149 if (!refzmp_exist_p) {
1151 rzmp = prev_que_rzmp;
1152 sfzos = prev_que_sfzos;
1154 prev_que_rzmp = rzmp;
1155 prev_que_sfzos = sfzos;
1157 solved = preview_controller_ptr->update(refzmp, cog, swing_foot_zmp_offsets, rzmp, sfzos, (refzmp_exist_p || finalize_count < preview_controller_ptr->get_delay()-default_step_time/
dt));
1162 std::vector<std::string> fns_names, cntr_legs_names;
1163 for (std::vector<step_node>::const_iterator it = fns.begin(); it != fns.end(); it++) {
1164 fns_names.push_back(leg_type_map.find(it->l_r)->second);
1166 std::sort(_all_limbs.begin(), _all_limbs.end());
1167 std::sort(fns_names.begin(), fns_names.end());
1168 std::set_difference(_all_limbs.begin(), _all_limbs.end(),
1169 fns_names.begin(), fns_names.end(),
1170 std::back_inserter(cntr_legs_names));
1171 std::vector<leg_type>
ret;
1172 for (std::vector<std::string>::const_iterator it = cntr_legs_names.begin(); it != cntr_legs_names.end(); it++) {
1173 std::map<leg_type, std::string>::const_iterator dst = std::find_if(leg_type_map.begin(), leg_type_map.end(), (&boost::lambda::_1->* &std::map<leg_type, std::string>::value_type::second == *it));
1174 ret.push_back(dst->first);
void modif_foot_coords_for_toe_heel_phase(coordinates &org_coords, const double _current_toe_angle, const double _current_heel_angle)
bool go_pos_param_2_footstep_nodes_list(const double goal_x, const double goal_y, const double goal_theta, const std::vector< coordinates > &initial_support_legs_coords, coordinates start_ref_coords, const std::vector< leg_type > &initial_support_legs, const bool is_initialize=true)
void calc_current_swing_leg_steps(std::vector< step_node > &rets, const double step_height, const double _current_toe_angle, const double _current_heel_angle, const double _default_double_support_ratio_before, const double _default_double_support_ratio_after)
SequenceElement & front(CorbaSequence &seq)
void rectangle_midcoords(coordinates &ret, const coordinates &start, const coordinates &goal, const double height, const size_t swing_trajectory_generator_idx)
const std::vector< leg_type > calc_counter_leg_types_from_footstep_nodes(const std::vector< step_node > &fns, std::vector< std::string > _all_limbs) const
double calc_phase_ratio(const size_t current_count, const toe_heel_phase start_phase, const toe_heel_phase goal_phase) const
const bool is_second_phase() const
void multi_mid_coords(coordinates &ret, const std::vector< coordinates > &cs, const double eps)
void overwrite_refzmp_queue(const std::vector< std::vector< step_node > > &fnsl)
void cross_delay_midcoords(coordinates &ret, const coordinates &start, const coordinates &goal, const double height, leg_type lr)
bool is_between_phases(const size_t current_count, const toe_heel_phase phase0, const toe_heel_phase phase1) const
bool is_same_footstep_nodes(const std::vector< step_node > &fns_1, const std::vector< step_node > &fns_2) const
void set_one_step_count(const size_t _count)
const bool is_second_last_phase() const
void calc_ref_coords_trans_vector_velocity_mode(coordinates &ref_coords, hrp::Vector3 &trans, double &dth, const std::vector< step_node > &sup_fns, const velocity_mode_parameter &cur_vel_param) const
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
std::string leg_type_to_leg_type_string(const leg_type l_r)
void reset(const size_t _refzmp_count)
std::vector< size_t > step_count_list
void modify_footsteps_for_recovery()
void cycloid_midcoords(coordinates &ret, const coordinates &start, const coordinates &goal, const double height) const
png_infop png_bytep * trans
bool is_no_SOLE1_phase() const
void calc_next_coords_velocity_mode(std::vector< std::vector< step_node > > &ret_list, const size_t idx, const size_t future_step_num=3)
void initialize_gait_parameter(const hrp::Vector3 &cog, const std::vector< step_node > &initial_support_leg_steps, const std::vector< step_node > &initial_swing_leg_dst_steps, const double delay=1.6)
void finalize_velocity_mode()
Matrix33 rotFromRpy(const Vector3 &rpy)
void stair_midcoords(coordinates &ret, const coordinates &start, const coordinates &goal, const double height)
void append_footstep_list_velocity_mode()
std::vector< toe_heel_types > toe_heel_types_list
const bool is_start_double_support_phase() const
void cycloid_delay_midcoords(coordinates &ret, const coordinates &start, const coordinates &goal, const double height, const size_t swing_trajectory_generator_idx)
bool is_phase_starting(const size_t current_count, const toe_heel_phase _phase) const
void rotm3times(hrp::Matrix33 &m12, const hrp::Matrix33 &m1, const hrp::Matrix33 &m2)
double calc_phase_period(const toe_heel_phase start_phase, const toe_heel_phase goal_phase, const double _dt) const
void calc_swing_support_mid_coords()
def j(str, encoding="cp932")
std::vector< hrp::Vector3 > refzmp_cur_list
double calc_interpolated_toe_heel_angle(const toe_heel_phase start_phase, const toe_heel_phase goal_phase, const double start, const double goal)
const bool is_end_double_support_phase() const
std::vector< std::vector< hrp::Vector3 > > foot_x_axises_list
void initialize_velocity_mode(const coordinates &_ref_coords, const double vel_x, const double vel_y, const double vel_theta, const std::vector< leg_type > ¤t_legs)
HRP_UTIL_EXPORT Vector3 rpyFromRot(const Matrix33 &m)
std::vector< hrp::Vector3 > default_zmp_offsets
Vector3 cross(const Vector3 &v1, const Vector3 &v2)
bool use_toe_heel_transition
bool eps_eq(const double a, const double b, const double eps=0.001)
void cycloid_delay_kick_midcoords(coordinates &ret, const coordinates &start, const coordinates &goal, const double height)
void go_single_step_param_2_footstep_nodes_list(const double goal_x, const double goal_y, const double goal_z, const double goal_theta, const std::string &tmp_swing_leg, const coordinates &_support_leg_coords)
void cycloid_midpoint(hrp::Vector3 &ret, const double ratio, const hrp::Vector3 &start, const hrp::Vector3 &goal, const double height, const double default_top_ratio)
void push_refzmp_from_footstep_nodes_for_single(const std::vector< step_node > &fns, const std::vector< step_node > &_support_leg_steps, const toe_heel_types &tht)
void calc_ratio_from_double_support_ratio(const double default_double_support_ratio_before, const double default_double_support_ratio_after)
void limit_stride(step_node &cur_fs, const step_node &prev_fs, const double(&limit)[5]) const
void calc_current_refzmp(hrp::Vector3 &ret, std::vector< hrp::Vector3 > &swing_foot_zmp_offsets, const double default_double_support_ratio_before, const double default_double_support_ratio_after, const double default_double_support_static_ratio_before, const double default_double_support_static_ratio_after)
bool use_toe_heel_auto_set
void difference(hrp::Vector3 &dif_pos, hrp::Vector3 &dif_rot, const coordinates &c) const
double set_value_according_to_toe_heel_type(const toe_heel_type tht, const double toe_value, const double heel_value, const double default_value)
void calc_current_swing_foot_rot(std::map< leg_type, hrp::Vector3 > &tmp_swing_foot_rot, const double _default_double_support_ratio_before, const double _default_double_support_ratio_after)
void go_pos_param_2_footstep_nodes_list_core(const double goal_x, const double goal_y, const double goal_theta, const std::vector< coordinates > &initial_support_legs_coords, coordinates start_ref_coords, const std::vector< leg_type > &initial_support_legs, std::vector< std::vector< step_node > > &new_footstep_nodes_list, const bool is_initialize, const size_t overwritable_fs_index) const
toe_heel_phase_counter thp
void rotate(const double theta, const hrp::Vector3 &axis, const std::string &wrt=":local")
void update_leg_steps(const std::vector< std::vector< step_node > > &fnsl, const double default_double_support_ratio_before, const double default_double_support_ratio_after, const toe_heel_type_checker &thtc)
toe_heel_type check_toe_heel_type_from_swing_support_coords(const coordinates &swing_coords, const coordinates &support_coords, const double toe_pos_offset_x, const double heel_pos_offset_x) const
void push_refzmp_from_footstep_nodes_for_dual(const std::vector< step_node > &fns, const std::vector< step_node > &_support_leg_steps, const std::vector< step_node > &_swing_leg_steps)
std::map< leg_type, double > zmp_weight_map
std::vector< std::vector< leg_type > > swing_leg_types_list
void mid_coords(coordinates &mid_coords, const double p, const coordinates &c1, const coordinates &c2, const double eps)
void set(const double _vx, const double _vy, const double _vth)