21 #include <coil/stringutil.h> 23 #define eps_eq(a,b,epsilon) (std::fabs((a)-(b)) < (epsilon)) 25 #define rad2deg(rad) (rad * 180 / M_PI) 28 #define deg2rad(deg) (deg * M_PI / 180) 38 double calcDiff (T& value)
const {
return 0; };
40 ValueDifferenceChecker (
double _diff_thre) : diff_thre (_diff_thre), max_value_diff(0), is_small_diff(true), is_initialized(false)
47 if (!is_initialized) {
49 is_initialized =
true;
52 double diff = calcDiff(value);
53 if (diff > max_value_diff) max_value_diff = diff;
54 is_small_diff = (diff < diff_thre) && is_small_diff;
64 return (value - prev_value).norm();
70 for (
size_t i = 0;
i < value.size();
i++) {
71 tmp += (value[
i] - prev_value[
i]).
norm();
83 ValueErrorChecker (
double _thre) : error_thre (_thre), max_value_error(0), is_small_error(true)
90 for (
size_t i = 0;
i < neglect_index.size();
i++) errorv(neglect_index[
i]) = 0.0;
91 double error = errorv.norm();
92 if (error > max_value_error) max_value_error = error;
93 is_small_error = (error < error_thre) && is_small_error;
125 std::vector<double>
step_time_list, min_toe_heel_dif_angle_list, max_toe_heel_dif_angle_list, min_zmp_offset_x_list, max_zmp_offset_x_list;
155 void plot_and_save (FILE* gp,
const std::string graph_fname,
const std::string plot_str)
157 fprintf(gp,
"%s\n unset multiplot\n", plot_str.c_str());
158 fprintf(gp,
"set terminal postscript eps color\nset output '/tmp/%s.eps'\n", graph_fname.c_str());
159 fprintf(gp,
"%s\n unset multiplot\n", plot_str.c_str());
174 fprintf(fp_cogzmp,
"%f ", i * dt);
175 for (
size_t ii = 0; ii < 3; ii++) {
176 fprintf(fp_cogzmp,
"%f ", gg->
get_refzmp()(ii));
179 for (
size_t ii = 0; ii < 3; ii++) {
180 fprintf(fp_cogzmp,
"%f ", czmp(ii));
182 for (
size_t ii = 0; ii < 3; ii++) {
191 fprintf(fp_cogzmp,
"%f ", cogpos);
193 fprintf(fp_cogzmp,
"\n");
196 #define VEC1(s) std::vector<std::string> (1, s) 199 fprintf(fp_fpos,
"%f ", i * dt);
201 for (
size_t ii = 0; ii < 3; ii++) {
202 fprintf(fp_fpos,
"%f ", rfoot_pos(ii));
203 min_rfoot_pos(ii) =
std::min(min_rfoot_pos(ii), rfoot_pos(ii));
204 max_rfoot_pos(ii) =
std::max(max_rfoot_pos(ii), rfoot_pos(ii));
207 for (
size_t ii = 0; ii < 3; ii++) {
208 fprintf(fp_fpos,
"%f ", lfoot_pos(ii));
209 min_lfoot_pos(ii) =
std::min(min_lfoot_pos(ii), lfoot_pos(ii));
210 max_lfoot_pos(ii) =
std::max(max_lfoot_pos(ii), lfoot_pos(ii));
212 fprintf(fp_fpos,
"\n");
216 fprintf(fp_frot,
"%f ", i * dt);
219 for (
size_t ii = 0; ii < 3; ii++) {
220 fprintf(fp_frot,
"%f ",
rad2deg(rfoot_rpy(ii)));
224 for (
size_t ii = 0; ii < 3; ii++) {
225 fprintf(fp_frot,
"%f ",
rad2deg(lfoot_rpy(ii)));
227 fprintf(fp_frot,
"\n");
231 fprintf(fp_zoff,
"%f ", i * dt);
233 for (
size_t ii = 0; ii < 3; ii++) {
234 fprintf(fp_zoff,
"%f ", rfoot_zmp_offset(ii));
237 for (
size_t ii = 0; ii < 3; ii++) {
238 fprintf(fp_zoff,
"%f ", lfoot_zmp_offset(ii));
240 fprintf(fp_zoff,
"\n");
244 else tmpzoff = lfoot_zmp_offset(0);
245 min_zmp_offset_x =
std::min(min_zmp_offset_x, tmpzoff);
246 max_zmp_offset_x =
std::max(max_zmp_offset_x, tmpzoff);
251 fprintf(fp_fposvel,
"%f ", i * dt);
252 if ( i == 0 ) prev_rfoot_pos = rfoot_pos;
253 hrp::Vector3 rfootpos_vel = (rfoot_pos - prev_rfoot_pos)/dt;
254 for (
size_t ii = 0; ii < 3; ii++) {
255 fprintf(fp_fposvel,
"%f ", rfootpos_vel(ii));
257 prev_rfoot_pos = rfoot_pos;
258 if ( i == 0 ) prev_lfoot_pos = lfoot_pos;
259 hrp::Vector3 lfootpos_vel = (lfoot_pos - prev_lfoot_pos)/dt;
260 for (
size_t ii = 0; ii < 3; ii++) {
261 fprintf(fp_fposvel,
"%f ", lfootpos_vel(ii));
263 prev_lfoot_pos = lfoot_pos;
264 fprintf(fp_fposvel,
"\n");
268 fprintf(fp_frotvel,
"%f ", i * dt);
269 if ( i == 0 ) prev_rfoot_rpy = rfoot_rpy;
270 hrp::Vector3 rfootrot_vel = (rfoot_rpy - prev_rfoot_rpy)/dt;
271 for (
size_t ii = 0; ii < 3; ii++) {
272 fprintf(fp_frotvel,
"%f ", rfootrot_vel(ii));
274 prev_rfoot_rpy = rfoot_rpy;
275 if ( i == 0 ) prev_lfoot_rpy = lfoot_rpy;
276 hrp::Vector3 lfootrot_vel = (lfoot_rpy - prev_lfoot_rpy)/dt;
277 for (
size_t ii = 0; ii < 3; ii++) {
278 fprintf(fp_frotvel,
"%f ", lfootrot_vel(ii));
280 prev_lfoot_rpy = lfoot_rpy;
281 fprintf(fp_frotvel,
"\n");
285 fprintf(fp_thpos,
"%f ", i * dt);
288 for (
size_t ii = 0; ii < 3; ii++) {
289 fprintf(fp_thpos,
"%f ", tmppos(ii));
290 min_rfoot_pos(ii) =
std::min(min_rfoot_pos(ii), tmppos(ii));
291 max_rfoot_pos(ii) =
std::max(max_rfoot_pos(ii), tmppos(ii));
294 for (
size_t ii = 0; ii < 3; ii++) {
295 fprintf(fp_thpos,
"%f ", tmppos(ii));
296 min_lfoot_pos(ii) =
std::min(min_lfoot_pos(ii), tmppos(ii));
297 max_lfoot_pos(ii) =
std::max(max_lfoot_pos(ii), tmppos(ii));
300 for (
size_t ii = 0; ii < 3; ii++) {
301 fprintf(fp_thpos,
"%f ", tmppos(ii));
302 min_rfoot_pos(ii) =
std::min(min_rfoot_pos(ii), tmppos(ii));
303 max_rfoot_pos(ii) =
std::max(max_rfoot_pos(ii), tmppos(ii));
306 for (
size_t ii = 0; ii < 3; ii++) {
307 fprintf(fp_thpos,
"%f ", tmppos(ii));
308 min_lfoot_pos(ii) =
std::min(min_lfoot_pos(ii), tmppos(ii));
309 max_lfoot_pos(ii) =
std::max(max_lfoot_pos(ii), tmppos(ii));
311 fprintf(fp_thpos,
"\n");
315 fprintf(fp_sstime,
"%f ", i * dt);
316 fprintf(fp_sstime,
"%f %f ",
321 bool rleg_contact_states = std::find_if(tmp_current_support_states.begin(), tmp_current_support_states.end(), boost::lambda::_1 ==
RLEG) != tmp_current_support_states.end();
322 bool lleg_contact_states = std::find_if(tmp_current_support_states.begin(), tmp_current_support_states.end(), boost::lambda::_1 ==
LLEG) != tmp_current_support_states.end();
323 fprintf(fp_sstime,
"%d %d %f",
324 (rleg_contact_states ? 1 : 0), (lleg_contact_states ? 1 : 0),
326 fprintf(fp_sstime,
"\n");
330 fprintf(fp_ssmc,
"%f ", i * dt);
333 for (
size_t ii = 0; ii < 3; ii++) {
334 fprintf(fp_ssmc,
"%f ", tmp_ssmc.
pos(ii));
337 for (
size_t ii = 0; ii < 3; ii++) {
338 fprintf(fp_ssmc,
"%f ",
rad2deg(tmp_ssmcr(ii)));
340 fprintf(fp_ssmc,
"\n");
344 fprintf(fp_ssmcvel,
"%f ", i * dt);
345 if ( i == 0 ) prev_ssmc = tmp_ssmc;
347 for (
size_t ii = 0; ii < 3; ii++) {
348 fprintf(fp_ssmcvel,
"%f ", tmp_ssmcpos_vel(ii));
351 hrp::Vector3 tmp_ssmcrot_vel = (tmp_ssmcr - prev_ssmcr)/dt;
352 for (
size_t ii = 0; ii < 3; ii++) {
353 fprintf(fp_ssmcvel,
"%f ", tmp_ssmcrot_vel(ii));
355 fprintf(fp_ssmcvel,
"\n");
357 prev_ssmc = tmp_ssmc;
360 double tmp_toe_heel_dif_angle = gg->get_toe_heel_dif_angle();
361 min_toe_heel_dif_angle =
std::min(min_toe_heel_dif_angle, tmp_toe_heel_dif_angle);
362 max_toe_heel_dif_angle =
std::max(max_toe_heel_dif_angle, tmp_toe_heel_dif_angle);
366 step_time_list.push_back(gg->get_one_step_count()*dt);
367 min_toe_heel_dif_angle_list.push_back(min_toe_heel_dif_angle);
368 max_toe_heel_dif_angle_list.push_back(max_toe_heel_dif_angle);
369 min_toe_heel_dif_angle = 1e10;
370 max_toe_heel_dif_angle = -1e10;
371 if ( !
eps_eq(min_zmp_offset_x, gg->get_default_zmp_offsets()[0](0), 1e-5) ) min_zmp_offset_x_list.push_back(min_zmp_offset_x);
372 else min_zmp_offset_x_list.push_back(0.0);
373 if ( !
eps_eq(max_zmp_offset_x, gg->get_default_zmp_offsets()[0](0), 1e-5) ) max_zmp_offset_x_list.push_back(max_zmp_offset_x);
374 else max_zmp_offset_x_list.push_back(0.0);
375 min_zmp_offset_x = 1e10;
376 max_zmp_offset_x = -1e10;
392 std::vector<hrp::Vector3> tmpvec = boost::assign::list_of(rfoot_pos)(lfoot_pos);
394 tmpvec = boost::assign::list_of(rfoot_rpy)(lfoot_rpy).convert_to_container < std::vector<hrp::Vector3> > ();
396 tmpvec = boost::assign::list_of(rfootpos_vel)(lfootpos_vel).convert_to_container < std::vector<hrp::Vector3> > ();
398 tmpvec = boost::assign::list_of(rfootrot_vel)(lfootrot_vel).convert_to_container < std::vector<hrp::Vector3> > ();
406 tmpvec = boost::assign::list_of(rfoot_zmp_offset)(lfoot_zmp_offset).convert_to_container < std::vector<hrp::Vector3> > ();
410 is_contact_states_swing_support_time_validity = is_contact_states_swing_support_time_validity &&
411 ((prev_contact_states[0] == rleg_contact_states) ? !
eps_eq(prev_swing_support_time[0],dt,1e-5) :
eps_eq(prev_swing_support_time[0],dt,1e-5)) &&
412 ((prev_contact_states[1] == lleg_contact_states) ? !
eps_eq(prev_swing_support_time[1],dt,1e-5) :
eps_eq(prev_swing_support_time[1],dt,1e-5));
414 prev_contact_states[0] = rleg_contact_states;
415 prev_contact_states[1] = lleg_contact_states;
427 for (
size_t ii = 0; ii < gpsize;ii++) {
428 gps[ii] =
popen(
"gnuplot",
"w");
431 std::ostringstream oss(
"");
432 std::string gtitle(
"COG_and_ZMP");
433 size_t tmp_start = 2;
434 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
435 std::string titles[3] = {
"X",
"Y",
"Z"};
436 for (
size_t ii = 0; ii < 3; ii++) {
437 oss <<
"set xlabel 'Time [s]'" << std::endl;
438 oss <<
"set ylabel '" << titles[ii] <<
"[m]'" << std::endl;
440 <<
"'" << fname_cogzmp <<
"' using 1:" << (tmp_start+ii) <<
" with lines title 'REFZMP'," 441 <<
"'" << fname_cogzmp <<
"' using 1:" << (tmp_start+3+ii) <<
" with lines title 'CARTZMP'," 442 <<
"'" << fname_cogzmp <<
"' using 1:" << (tmp_start+6+ii) <<
" with lines title 'COG'" 445 plot_and_save(gps[0], gtitle, oss.str());
448 std::ostringstream oss(
"");
449 std::string gtitle(
"Swing_support_pos");
450 size_t tmp_start = 2;
451 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
452 std::string titles[3] = {
"X",
"Y",
"Z"};
453 for (
size_t ii = 0; ii < 3; ii++) {
454 oss <<
"set xlabel 'Time [s]'" << std::endl;
455 oss <<
"set ylabel '" << titles[ii] <<
"[m]'" << std::endl;
457 <<
"'" << fname_fpos <<
"' using 1:" << (tmp_start+ii) <<
" with lines title 'rleg'," 458 <<
"'" << fname_fpos <<
"' using 1:" << (tmp_start+3+ii) <<
" with lines title 'lleg'" 461 plot_and_save(gps[1], gtitle, oss.str());
464 std::ostringstream oss(
"");
465 std::string gtitle(
"Swing_support_rot");
466 size_t tmp_start = 2;
467 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
468 std::string titles[3] = {
"Roll",
"Pitch",
"Yaw"};
469 for (
size_t ii = 0; ii < 3; ii++) {
470 oss <<
"set xlabel 'Time [s]'" << std::endl;
471 oss <<
"set ylabel '" << titles[ii] <<
"[deg]'" << std::endl;
473 <<
"'" << fname_frot <<
"' using 1:" << (tmp_start+ii) <<
" with lines title 'rleg'," 474 <<
"'" << fname_frot <<
"' using 1:" << (tmp_start+3+ii) <<
" with lines title 'lleg'" 477 plot_and_save(gps[2], gtitle, oss.str());
480 std::ostringstream oss(
"");
481 std::string gtitle(
"Swing_support_zmp_offset");
482 size_t tmp_start = 2;
483 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
484 std::string titles[3] = {
"X",
"Y",
"Z"};
485 for (
size_t ii = 0; ii < 3; ii++) {
486 oss <<
"set xlabel 'Time [s]'" << std::endl;
487 oss <<
"set ylabel '" << titles[ii] <<
"[m]'" << std::endl;
489 <<
"'" << fname_zoff <<
"' using 1:" << (tmp_start+ii) <<
" with lines title 'rleg'," 490 <<
"'" << fname_zoff <<
"' using 1:" << (tmp_start+3+ii) <<
" with lines title 'lleg'" 493 plot_and_save(gps[3], gtitle, oss.str());
496 std::ostringstream oss(
"");
497 std::string gtitle(
"Swing_support_pos_vel");
498 size_t tmp_start = 2;
499 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
500 std::string titles[3] = {
"X",
"Y",
"Z"};
501 for (
size_t ii = 0; ii < 3; ii++) {
502 oss <<
"set xlabel 'Time [s]'" << std::endl;
503 oss <<
"set ylabel '" << titles[ii] <<
"[m/s]'" << std::endl;
505 <<
"'" << fname_fposvel <<
"' using 1:" << (tmp_start+ii) <<
" with lines title 'rleg'," 506 <<
"'" << fname_fposvel <<
"' using 1:" << (tmp_start+3+ii) <<
" with lines title 'lleg'" 509 plot_and_save(gps[4], gtitle, oss.str());
512 std::ostringstream oss(
"");
513 std::string gtitle(
"Swing_support_rot_vel");
514 size_t tmp_start = 2;
515 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
516 std::string titles[3] = {
"Roll",
"Pitch",
"Yaw"};
517 for (
size_t ii = 0; ii < 3; ii++) {
518 oss <<
"set xlabel 'Time [s]'" << std::endl;
519 oss <<
"set ylabel '" << titles[ii] <<
"[deg/s]'" << std::endl;
521 <<
"'" << fname_frotvel <<
"' using 1:" << (tmp_start+ii) <<
" with lines title 'rleg'," 522 <<
"'" << fname_frotvel <<
"' using 1:" << (tmp_start+3+ii) <<
" with lines title 'lleg'" 525 plot_and_save(gps[5], gtitle, oss.str());
528 std::ostringstream oss(
"");
529 std::string gtitle(
"Swing_support_pos_trajectory");
530 double min_v[3], max_v[3], range[3];
531 size_t tmp_thpos_start = 2;
532 for (
size_t ii = 0; ii < 3; ii++) {
533 min_v[ii] =
std::min(min_rfoot_pos(ii), min_lfoot_pos(ii));
534 max_v[ii] =
std::max(max_rfoot_pos(ii), max_lfoot_pos(ii));
535 if (min_v[ii] == 0.0 && max_v[ii] == 0.0) {
539 range[ii] = max_v[ii] - min_v[ii];
540 double mid = (max_v[ii]+min_v[ii])/2.0;
541 min_v[ii] = mid + range[ii] * 1.05 * -0.5;
542 max_v[ii] = mid + range[ii] * 1.05 * 0.5;
544 oss <<
"set multiplot layout 2, 1 title '" << gtitle <<
"'" << std::endl;
546 oss <<
"set size ratio " << range[2]/range[0] << std::endl;
547 oss <<
"set xlabel 'X [m]'" << std::endl;
548 oss <<
"set ylabel 'Z [m]'" << std::endl;
550 <<
"[" << min_v[0]<<
":" << max_v[0] <<
"]" 551 <<
"[" << min_v[2] <<
":" << max_v[2] <<
"]" 552 <<
"'" << fname_fpos <<
"' using " << (2) <<
":" << (2+2) <<
" with lines title 'rleg ee'," 553 <<
"'" << fname_fpos <<
"' using " << (2+3) <<
":" << (2+3+2) <<
" with lines title 'lleg ee'," 554 <<
"'" << fname_thpos <<
"' using " << (tmp_thpos_start) <<
":" << (tmp_thpos_start+2) <<
" with lines title 'rleg toe'," 555 <<
"'" << fname_thpos <<
"' using " << (tmp_thpos_start+3) <<
":" << (tmp_thpos_start+3+2) <<
" with lines title 'lleg toe'," 556 <<
"'" << fname_thpos <<
"' using " << (tmp_thpos_start+3+3) <<
":" << (tmp_thpos_start+3+3+2) <<
" with lines title 'rleg heel'," 557 <<
"'" << fname_thpos <<
"' using " << (tmp_thpos_start+3+3+3) <<
":" << (tmp_thpos_start+3+3+3+2) <<
" with lines title 'lleg heel'" 560 oss <<
"set size ratio " << range[2]/range[1] << std::endl;
561 oss <<
"set xlabel 'Y [m]'" << std::endl;
562 oss <<
"set ylabel 'Z [m]'" << std::endl;
564 <<
"[" << min_v[1]<<
":" << max_v[1] <<
"]" 565 <<
"[" << min_v[2] <<
":" << max_v[2] <<
"]" 566 <<
"'" << fname_fpos <<
"' using " << (2+1) <<
":" << (2+2) <<
" with lines title 'rleg ee'," 567 <<
"'" << fname_fpos <<
"' using " << (2+3+1) <<
":" << (2+3+2) <<
" with lines title 'lleg ee'," 568 <<
"'" << fname_thpos <<
"' using " << (tmp_thpos_start+1) <<
":" << (tmp_thpos_start+2) <<
" with lines title 'rleg toe'," 569 <<
"'" << fname_thpos <<
"' using " << (tmp_thpos_start+3+1) <<
":" << (tmp_thpos_start+3+2) <<
" with lines title 'lleg toe'," 570 <<
"'" << fname_thpos <<
"' using " << (tmp_thpos_start+3+3+1) <<
":" << (tmp_thpos_start+3+3+2) <<
" with lines title 'rleg heel'," 571 <<
"'" << fname_thpos <<
"' using " << (tmp_thpos_start+3+3+3+1) <<
":" << (tmp_thpos_start+3+3+3+2) <<
" with lines title 'lleg heel'" 573 plot_and_save(gps[6], gtitle, oss.str());
576 std::ostringstream oss(
"");
577 std::string gtitle(
"Swing_support_remain_time");
578 oss <<
"set multiplot layout 1, 1 title '" << gtitle <<
"'" << std::endl;
579 oss <<
"set title 'Remain Time'" << std::endl;
580 oss <<
"set xlabel 'Time [s]'" << std::endl;
581 oss <<
"set ylabel 'Time [s]'" << std::endl;
583 <<
"'" << fname_sstime <<
"' using 1:" << 2 <<
" with lines title 'rleg remain time'," 584 <<
"'" << fname_sstime <<
"' using 1:" << 3 <<
" with lines title 'lleg remain time'," 585 <<
"'" << fname_sstime <<
"' using 1:" << 4 <<
" with lines title 'rleg contact states'," 586 <<
"'" << fname_sstime <<
"' using 1:" << 5 <<
" with lines title 'lleg contact states'," 587 <<
"'" << fname_sstime <<
"' using 1:" << 6 <<
" with lines title 'toe_heel_ratio*0.8+0.1'" 589 plot_and_save(gps[7], gtitle, oss.str());
592 std::ostringstream oss(
"");
593 std::string gtitle(
"Swing_support_mid_coords_pos");
594 size_t tmp_start = 2;
595 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
596 std::string titles[3] = {
"X",
"Y",
"Z"};
597 for (
size_t ii = 0; ii < 3; ii++) {
598 oss <<
"set xlabel 'Time [s]'" << std::endl;
599 oss <<
"set ylabel 'Pos " << titles[ii] <<
"[m]'" << std::endl;
601 <<
"'" << fname_ssmc <<
"' using 1:" << (tmp_start+ii) <<
" with lines title ''" 604 plot_and_save(gps[8], gtitle, oss.str());
607 std::ostringstream oss(
"");
608 std::string gtitle(
"Swing_support_mid_coords_rot");
609 size_t tmp_start = 2;
610 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
611 std::string titles[3] = {
"Roll",
"Pitch",
"Yaw"};
612 for (
size_t ii = 0; ii < 3; ii++) {
613 oss <<
"set xlabel 'Time [s]'" << std::endl;
614 oss <<
"set ylabel 'Rot " << titles[ii] <<
"[deg]'" << std::endl;
616 <<
"'" << fname_ssmc <<
"' using 1:" << (tmp_start+ii+3) <<
" with lines title ''" 619 plot_and_save(gps[9], gtitle, oss.str());
622 std::ostringstream oss(
"");
623 std::string gtitle(
"Swing_support_mid_coords_pos_vel");
624 size_t tmp_start = 2;
625 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
626 std::string titles[3] = {
"X",
"Y",
"Z"};
627 for (
size_t ii = 0; ii < 3; ii++) {
628 oss <<
"set xlabel 'Time [s]'" << std::endl;
629 oss <<
"set ylabel 'PosVel " << titles[ii] <<
"[m/s]'" << std::endl;
631 <<
"'" << fname_ssmcvel <<
"' using 1:" << (tmp_start+ii) <<
" with lines title ''" 634 plot_and_save(gps[10], gtitle, oss.str());
637 std::ostringstream oss(
"");
638 std::string gtitle(
"Swing_support_mid_coords_rot_vel");
639 size_t tmp_start = 2;
640 oss <<
"set multiplot layout 3, 1 title '" << gtitle <<
"'" << std::endl;
641 std::string titles[3] = {
"Roll",
"Pitch",
"Yaw"};
642 for (
size_t ii = 0; ii < 3; ii++) {
643 oss <<
"set xlabel 'Time [s]'" << std::endl;
644 oss <<
"set ylabel 'RotVel " << titles[ii] <<
"[deg/s]'" << std::endl;
646 <<
"'" << fname_ssmcvel <<
"' using 1:" << (tmp_start+ii+3) <<
" with lines title ''" 649 plot_and_save(gps[11], gtitle, oss.str());
652 if (use_graph_append) {
655 ret = system(
"bash -c 'for f in /tmp/*.eps; do convert -density 250x250 $f ${f//eps}jpg; done'");
656 ret = system(
"(cd /tmp; convert +append Swing_support_mid_coords_pos.jpg Swing_support_mid_coords_pos_vel.jpg Swing_support_mid_coords_rot.jpg Swing_support_mid_coords_rot_vel.jpg img1.jpg)");
657 ret = system(
"(cd /tmp/; convert +append Swing_support_pos.jpg Swing_support_pos_vel.jpg Swing_support_rot.jpg Swing_support_rot_vel.jpg img2.jpg)");
658 ret = system(
"(cd /tmp/; convert +append Swing_support_zmp_offset.jpg Swing_support_remain_time.jpg COG_and_ZMP.jpg Swing_support_pos_trajectory.jpg img3.jpg)");
659 std::string tmpstr = test_doc_string.substr(0, test_doc_string.find(
":"));
660 for(
size_t c = tmpstr.find_first_of(
" ");
c != std::string::npos;
c =
c = tmpstr.find_first_of(
" ")){
663 ret = system(std::string(
"(cd /tmp/; convert -append img1.jpg img2.jpg img3.jpg testGaitGeneratorResults_"+tmpstr+
".jpg; rm -f /tmp/img[123].jpg /tmp/COG_and_ZMP.jpg /tmp/Swing_support*.jpg)").c_str());
668 for (
size_t ii = 0; ii < gpsize; ii++) {
669 fprintf(gps[ii],
"exit\n");
674 std::string tmpstr = test_doc_string.substr(0, test_doc_string.find(
":"));
675 for(
size_t c = tmpstr.find_first_of(
" ");
c != std::string::npos;
c =
c = tmpstr.find_first_of(
" ")){
678 std::cerr <<
"Checking of " << tmpstr <<
" : all results = " << (check_all_results()?
"true":
"false") << std::endl;
679 std::cerr <<
" ZMP error : " << (zmp_error_checker.
isSmallError()?
"true":
"false") <<
", max_error : " << zmp_error_checker.
getMaxValue()*1e3 <<
"[mm], thre : " << zmp_error_checker.
getErrorThre()*1e3 <<
"[mm]" << std::endl;
680 std::cerr <<
" COGZMP error : " << (cogzmp_error_checker.
isSmallError()?
"true":
"false") <<
", max_error : " << cogzmp_error_checker.
getMaxValue()*1e3 <<
"[mm], thre : " << cogzmp_error_checker.
getErrorThre()*1e3 <<
"[mm]" << std::endl;
681 std::cerr <<
" RefZMP diff : " << (refzmp_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " << refzmp_diff_checker.
getMaxValue()*1e3 <<
"[mm], thre : " << refzmp_diff_checker.
getDiffThre()*1e3 <<
"[mm]" << std::endl;
682 std::cerr <<
" CartZMP diff : " << (cartzmp_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " << cartzmp_diff_checker.
getMaxValue()*1e3 <<
"[mm], thre : " << cartzmp_diff_checker.
getDiffThre()*1e3 <<
"[mm]" << std::endl;
683 std::cerr <<
" COG diff : " << (cog_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " << cog_diff_checker.
getMaxValue()*1e3 <<
"[mm], thre : " << cog_diff_checker.
getDiffThre()*1e3 <<
"[mm]" <<std::endl;
684 std::cerr <<
" FootPos diff : " << (footpos_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " << footpos_diff_checker.
getMaxValue()*1e3 <<
"[mm], thre : " << footpos_diff_checker.
getDiffThre()*1e3 <<
"[mm]" <<std::endl;
685 std::cerr <<
" FootRot diff : " << (footrot_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " <<
rad2deg(footrot_diff_checker.
getMaxValue()) <<
"[deg], thre : " <<
rad2deg(footrot_diff_checker.
getDiffThre()) <<
"[deg]" <<std::endl;
686 std::cerr <<
" FootPosVel diff : " << (footposvel_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " << footposvel_diff_checker.
getMaxValue()*1e3 <<
"[mm/s], thre : " << footposvel_diff_checker.
getDiffThre()*1e3 <<
"[mm/s]" <<std::endl;
687 std::cerr <<
" FootRotVel diff : " << (footrotvel_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " <<
rad2deg(footrotvel_diff_checker.
getMaxValue()) <<
"[deg/s], thre : " <<
rad2deg(footrotvel_diff_checker.
getDiffThre()) <<
"[deg/s]" <<std::endl;
688 std::cerr <<
" SwingSupportFootMidPos diff : " << (ssmcpos_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " << ssmcpos_diff_checker.
getMaxValue()*1e3 <<
"[mm], thre : " << ssmcpos_diff_checker.
getDiffThre()*1e3 <<
"[mm]" <<std::endl;
689 std::cerr <<
" SwingSupportFootMidRot diff : " << (ssmcrot_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " <<
rad2deg(ssmcrot_diff_checker.
getMaxValue()) <<
"[deg], thre : " <<
rad2deg(ssmcrot_diff_checker.
getDiffThre()) <<
"[deg]" <<std::endl;
690 std::cerr <<
" SwingSupportFootMidPosVel diff : " << (ssmcposvel_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " << ssmcposvel_diff_checker.
getMaxValue()*1e3 <<
"[mm/s], thre : " << ssmcposvel_diff_checker.
getDiffThre()*1e3 <<
"[mm/s]" <<std::endl;
691 std::cerr <<
" SwingSupportFootMidRotVel diff : " << (ssmcrotvel_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " <<
rad2deg(ssmcrotvel_diff_checker.
getMaxValue()) <<
"[deg/s], thre : " <<
rad2deg(ssmcrotvel_diff_checker.
getDiffThre()) <<
"[deg/s]" <<std::endl;
692 std::cerr <<
" ZMPOffset diff : " << (zmpoffset_diff_checker.
isSmallDiff()?
"true":
"false") <<
", max_diff : " << zmpoffset_diff_checker.
getMaxValue()*1e3 <<
"[mm/s], thre : " << zmpoffset_diff_checker.
getDiffThre()*1e3 <<
"[mm/s]" <<std::endl;
693 std::cerr <<
" Contact states & swing support time validity : " << (is_contact_states_swing_support_time_validity?
"true":
"false") << std::endl;
694 std::cerr <<
" Step time validity : " << (is_step_time_valid?
"true":
"false") << std::endl;
695 std::cerr <<
" ToeHeel angle validity : " << (is_toe_heel_dif_angle_valid?
"true":
"false") << std::endl;
696 std::cerr <<
" ToeHeel+ZMPoffset validity : " << (is_toe_heel_zmp_offset_x_valid?
"true":
"false") << std::endl;
702 std::vector<size_t> neglect_index = boost::assign::list_of(2);
709 std::vector<size_t> neglect_index = boost::assign::list_of(2);
712 std::vector< std::vector<step_node> > fsl;
713 gg->get_footstep_nodes_list(fsl);
714 is_step_time_valid = step_time_list.size() == fsl.size();
715 if (is_step_time_valid) {
716 for (
size_t i = 0;
i < step_time_list.size();
i++) {
717 is_step_time_valid =
eps_eq(step_time_list[
i], fsl[i][0].step_time, 1e-5) && is_step_time_valid;
721 is_toe_heel_dif_angle_valid = (min_toe_heel_dif_angle_list.size() == fsl.size()) && (max_toe_heel_dif_angle_list.size() == fsl.size());
722 if (is_toe_heel_dif_angle_valid) {
727 for (
size_t i = 1;
i < min_toe_heel_dif_angle_list.size();
i++) {
730 is_toe_heel_dif_angle_valid =
eps_eq(min_toe_heel_dif_angle_list[
i], (-fsl[i][0].heel_angle), 1e-5)
731 &&
eps_eq(max_toe_heel_dif_angle_list[i], fsl[i][0].toe_angle, 1e-5)
732 && is_toe_heel_dif_angle_valid;
738 is_toe_heel_zmp_offset_x_valid = (min_zmp_offset_x_list.size() == fsl.size()) && (max_zmp_offset_x_list.size() == fsl.size());
740 for (
size_t i = 0;
i < min_zmp_offset_x_list.size();
i++) {
742 bool heel_valid =
true;
743 if ( !
eps_eq(min_toe_heel_dif_angle_list[
i], 0.0, 1e-5) ) {
748 bool toe_valid =
true;
749 if ( !
eps_eq(max_toe_heel_dif_angle_list[i], 0.0, 1e-5) ) {
755 is_toe_heel_zmp_offset_x_valid = heel_valid && toe_valid && is_toe_heel_zmp_offset_x_valid;
767 gg->
initialize_gait_parameter(cog, boost::assign::list_of(initial_support_leg_step), boost::assign::list_of(initial_swing_leg_dst_step));
771 check_start_values();
774 proc_one_walking_motion(i);
778 plot_and_print_errorcheck ();
783 std::vector<std::string> tmp_string_vector = boost::assign::list_of(
"rleg");
787 gen_and_plot_walk_pattern(initial_support_leg_step, initial_swing_leg_dst_step);
791 gen_and_plot_walk_pattern(initial_support_leg_step, initial_swing_leg_dst_step);
797 testGaitGenerator(
double _dt) : dt(_dt), use_gnuplot(true), use_graph_append(false), is_contact_states_swing_support_time_validity(true),
798 refzmp_diff_checker(20.0*1e-3), cartzmp_diff_checker(20.0*1e-3), cog_diff_checker(10.0*1e-3),
799 ssmcpos_diff_checker(10.0*1e-3), ssmcrot_diff_checker(
deg2rad(0.1)),
800 ssmcposvel_diff_checker(10.0*1e-3), ssmcrotvel_diff_checker(
deg2rad(1)),
801 footpos_diff_checker(10.0*1e-3), footrot_diff_checker(
deg2rad(1)),
802 footposvel_diff_checker(40*1e-3), footrotvel_diff_checker(
deg2rad(15)),
803 zmpoffset_diff_checker(20.0*1e-3),
804 zmp_error_checker(50*1e-3), cogzmp_error_checker(1.5*1e-3),
805 min_rfoot_pos(1e10,1e10,1e10), min_lfoot_pos(1e10,1e10,1e10), max_rfoot_pos(-1e10,-1e10,-1e10), max_lfoot_pos(-1e10,-1e10,-1e10),
806 min_toe_heel_dif_angle(1e10), max_toe_heel_dif_angle(-1e10), min_zmp_offset_x(1e10), max_zmp_offset_x(-1e10),
807 prev_contact_states(2, true),
808 prev_swing_support_time(2, 1e2),
809 fname_cogzmp(
"/tmp/plot-cogzmp.dat"), fp_cogzmp(fopen(fname_cogzmp.c_str(),
"w")),
810 fname_fpos(
"/tmp/plot-fpos.dat"), fp_fpos(fopen(fname_fpos.c_str(),
"w")),
811 fname_frot(
"/tmp/plot-frot.dat"), fp_frot(fopen(fname_frot.c_str(),
"w")),
812 fname_zoff(
"/tmp/plot-zoff.dat"), fp_zoff(fopen(fname_zoff.c_str(),
"w")),
813 fname_fposvel(
"/tmp/plot-fposvel.dat"), fp_fposvel(fopen(fname_fposvel.c_str(),
"w")),
814 fname_frotvel(
"/tmp/plot-frotvel.dat"), fp_frotvel(fopen(fname_frotvel.c_str(),
"w")),
815 fname_thpos(
"/tmp/plot-thpos.dat"), fp_thpos(fopen(fname_thpos.c_str(),
"w")),
816 fname_sstime(
"/tmp/plot-sstime.dat"), fp_sstime(fopen(fname_sstime.c_str(),
"w")),
817 fname_ssmc(
"/tmp/plot-ssmc.dat"), fp_ssmc(fopen(fname_ssmc.c_str(),
"w")),
818 fname_ssmcvel(
"/tmp/plot-ssmcvel.dat"), fp_ssmcvel(fopen(fname_ssmcvel.c_str(),
"w"))
841 test_doc_string =
"test0 : Set foot steps";
844 std::vector< std::vector<step_node> > fnsl;
851 gen_and_plot_walk_pattern();
856 test_doc_string =
"test1 : Go pos x,y,th combination";
863 gen_and_plot_walk_pattern();
868 test_doc_string =
"test2 : Go pos x";
875 gen_and_plot_walk_pattern();
880 test_doc_string =
"test3 : Go pos y";
887 gen_and_plot_walk_pattern();
892 test_doc_string =
"test4 : Go pos th";
899 gen_and_plot_walk_pattern();
904 test_doc_string =
"test5 : Set foot steps with Z change";
908 std::vector< std::vector<step_node> > fnsl;
916 gen_and_plot_walk_pattern();
921 test_doc_string =
"test6 : Go single step";
924 std::vector< std::vector<step_node> > fnsl;
929 gen_and_plot_walk_pattern();
934 test_doc_string =
"test7 : Toe heel walk";
937 std::vector<hrp::Vector3> dzo;
955 gen_and_plot_walk_pattern();
960 test_doc_string =
"test8 : Toe heel walk on slope";
963 std::vector<hrp::Vector3> dzo;
976 hrp::Matrix33 initial_foot_mid_rot = Eigen::AngleAxis<double>(
M_PI/2, hrp::Vector3::UnitZ()).toRotationMatrix();
979 mid_coords(start_ref_coords, 0.5,
coordinates(initial_foot_mid_rot*leg_pos[1], initial_foot_mid_rot),
coordinates(initial_foot_mid_rot*leg_pos[0], initial_foot_mid_rot));
982 std::vector<std::string> tmp_string_vector = boost::assign::list_of(
"rleg");
986 gen_and_plot_walk_pattern(initial_support_leg_step, initial_swing_leg_dst_step);
990 gen_and_plot_walk_pattern(initial_support_leg_step, initial_swing_leg_dst_step);
996 test_doc_string =
"test9 : Stair walk";
1002 std::vector< std::vector<step_node> > fnsl;
1012 gen_and_plot_walk_pattern();
1017 test_doc_string =
"test10 : Stair walk + toe heel contact";
1032 double ratio[7] = {0.02, 0.28, 0.2, 0.0, 0.2, 0.25, 0.05};
1035 std::vector< std::vector<step_node> > fnsl;
1045 gen_and_plot_walk_pattern();
1050 test_doc_string =
"test11 : Foot rot change";
1054 std::vector< std::vector<step_node> > fnsl;
1061 gen_and_plot_walk_pattern();
1066 test_doc_string =
"test12 : Change step param in set foot steps";
1069 std::vector< std::vector<step_node> > fnsl;
1078 gen_and_plot_walk_pattern();
1083 test_doc_string =
"test13 : Arbitrary leg switching";
1086 std::vector< std::vector<step_node> > fnsl;
1094 gen_and_plot_walk_pattern();
1099 test_doc_string =
"test14 : kick walk";
1107 gen_and_plot_walk_pattern();
1112 test_doc_string =
"test15 : Stair walk down";
1118 std::vector< std::vector<step_node> > fnsl;
1128 gen_and_plot_walk_pattern();
1133 test_doc_string =
"test16 : Set foot steps with param (toe heel contact)";
1137 std::vector<hrp::Vector3> dzo;
1153 double ratio[7] = {0.07, 0.20, 0.2, 0.0, 0.2, 0.25, 0.08};
1156 std::vector< std::vector<step_node> > fnsl;
1162 gen_and_plot_walk_pattern();
1167 test_doc_string =
"test17 : Test goVelocity (dx = 0.1, dy = 0.05, dth = 10.0)";
1177 gg->
initialize_gait_parameter(cog, boost::assign::list_of(initial_support_leg_step), boost::assign::list_of(initial_swing_leg_dst_step));
1180 check_start_values();
1183 proc_one_walking_motion(i);
1190 plot_and_print_errorcheck ();
1195 test_doc_string =
"test18 : Test goVelocity with changing velocity (translation and rotation)";
1207 gg->
initialize_gait_parameter(cog, boost::assign::list_of(initial_support_leg_step), boost::assign::list_of(initial_swing_leg_dst_step));
1210 check_start_values();
1213 proc_one_walking_motion(i);
1228 plot_and_print_errorcheck ();
1233 test_doc_string =
"test19 : Change stride parameter (translate)";
1236 std::vector<hrp::Vector3> dzo;
1245 gen_and_plot_walk_pattern();
1250 test_doc_string =
"test20 : Change stride parameter (translate+rotate)";
1253 std::vector<hrp::Vector3> dzo;
1262 gen_and_plot_walk_pattern();
1267 if (is_print_doc_setring) std::cerr << test_doc_string << std::endl;
1268 for (
unsigned int i = 0;
i < arg_strs.size(); ++
i) {
1269 if ( arg_strs[
i]==
"--default-step-time" ) {
1271 }
else if ( arg_strs[
i]==
"--default-step-height" ) {
1273 }
else if ( arg_strs[
i]==
"--default-double-support-ratio-before" ) {
1275 }
else if ( arg_strs[
i]==
"--default-double-support-ratio-after" ) {
1277 }
else if ( arg_strs[
i]==
"--default-orbit-type" ) {
1278 if (++
i < arg_strs.size()) {
1279 if (arg_strs[
i] ==
"SHUFFLING") {
1281 }
else if (arg_strs[
i] ==
"CYCLOID") {
1283 }
else if (arg_strs[
i] ==
"RECTANGLE") {
1285 }
else if (arg_strs[
i] ==
"STAIR") {
1287 }
else if (arg_strs[
i] ==
"CYCLOIDDELAY") {
1289 }
else if (arg_strs[
i] ==
"CYCLOIDDELAYKICK") {
1291 }
else if (arg_strs[
i] ==
"CROSS") {
1294 std::cerr <<
"No such default-orbit-type " << arg_strs[
i] << std::endl;
1297 }
else if ( arg_strs[
i]==
"--default-double-support-static-ratio-before" ) {
1299 }
else if ( arg_strs[
i]==
"--default-double-support-static-ratio-after" ) {
1301 }
else if ( arg_strs[
i]==
"--default-double-support-ratio-swing-before" ) {
1303 }
else if ( arg_strs[
i]==
"--default-double-support-ratio-swing-after" ) {
1305 }
else if ( arg_strs[
i]==
"--swing-trajectory-delay-time-offset" ) {
1307 }
else if ( arg_strs[
i]==
"--swing-trajectory-final-distance-weight" ) {
1309 }
else if ( arg_strs[
i]==
"--swing-trajectory-time-offset-xy2z" ) {
1311 }
else if ( arg_strs[
i]==
"--stair-trajectory-way-point-offset" ) {
1312 if (++
i < arg_strs.size()) {
1316 }
else if ( arg_strs[
i]==
"--cycloid-delay-kick-point-offset" ) {
1317 if (++
i < arg_strs.size()) {
1321 }
else if ( arg_strs[
i]==
"--toe-angle" ) {
1322 if (++
i < arg_strs.size()) gg->
set_toe_angle(atof(arg_strs[
i].c_str()));
1323 }
else if ( arg_strs[
i]==
"--heel-angle" ) {
1325 }
else if ( arg_strs[
i]==
"--toe-heel-phase-ratio" ) {
1326 if (++
i < arg_strs.size()) {
1328 std::vector<double> ratio;
1329 for (
size_t i_th = 0; i_th < strs.size(); i_th++) {
1330 ratio.push_back(atof(strs[i_th].c_str()));
1335 }
else if ( arg_strs[
i]==
"--optional-go-pos-finalize-footstep-num" ) {
1337 }
else if ( arg_strs[
i]==
"--use-gnuplot" ) {
1338 if (++
i < arg_strs.size()) use_gnuplot = (arg_strs[
i]==
"true");
1339 }
else if ( arg_strs[
i]==
"--use-graph-append" ) {
1340 if (++
i < arg_strs.size()) use_graph_append = (arg_strs[
i]==
"true");
1354 && is_step_time_valid && is_toe_heel_dif_angle_valid && is_toe_heel_zmp_offset_x_valid
1355 && is_contact_states_swing_support_time_validity;
1365 leg_pos.push_back(hrp::Vector3(0,1e-3*-105,0));
1366 leg_pos.push_back(hrp::Vector3(0,1e-3* 105,0));
1367 all_limbs.push_back(
"rleg");
1368 all_limbs.push_back(
"lleg");
1369 gg =
new gait_generator(dt, leg_pos, all_limbs, 1e-3*150, 1e-3*50, 10, 1e-3*50, 1e-3*50*0.5, 10*0.5);
1375 std::cerr <<
"Usage : testGaitGenerator [test-name] [option]" << std::endl;
1376 std::cerr <<
" [test-name] should be:" << std::endl;
1377 std::cerr <<
" --test0 : Set foot steps" << std::endl;
1378 std::cerr <<
" --test1 : Go pos x,y,th combination" << std::endl;
1379 std::cerr <<
" --test2 : Go pos x" << std::endl;
1380 std::cerr <<
" --test3 : Go pos y" << std::endl;
1381 std::cerr <<
" --test4 : Go pos th" << std::endl;
1382 std::cerr <<
" --test5 : Set foot steps with Z change" << std::endl;
1383 std::cerr <<
" --test6 : Go single step" << std::endl;
1384 std::cerr <<
" --test7 : Toe heel walk" << std::endl;
1385 std::cerr <<
" --test8 : Toe heel walk on slope" << std::endl;
1386 std::cerr <<
" --test9 : Stair walk" << std::endl;
1387 std::cerr <<
" --test10 : Stair walk + toe heel contact" << std::endl;
1388 std::cerr <<
" --test11 : Foot rot change" << std::endl;
1389 std::cerr <<
" --test12 : Change step param in set foot steps" << std::endl;
1390 std::cerr <<
" --test13 : Arbitrary leg switching" << std::endl;
1391 std::cerr <<
" --test14 : kick walk" << std::endl;
1392 std::cerr <<
" --test15 : Stair walk down" << std::endl;
1393 std::cerr <<
" --test16 : Set foot steps with param (toe heel contact)" << std::endl;
1394 std::cerr <<
" --test17 : Test goVelocity (dx = 0.1, dy = 0.05, dth = 10.0)" << std::endl;
1395 std::cerr <<
" --test18 : Test goVelocity with changing velocity (translation and rotation)" << std::endl;
1396 std::cerr <<
" --test19 : Change stride parameter (translate)" << std::endl;
1397 std::cerr <<
" --test20 : Change stride parameter (translate+rotate)" << std::endl;
1398 std::cerr <<
" [option] should be:" << std::endl;
1399 std::cerr <<
" --use-gnuplot : Use gnuplot and dump eps file to /tmp. (true/false, true by default)" << std::endl;
1400 std::cerr <<
" --use-graph-append : Append generated graph to /tmp/testGaitGenerator.jpg. (true/false, false by default)" << std::endl;
1401 std::cerr <<
" other options : for GaitGenerator" << std::endl;
1409 for (
int i = 1;
i < argc; ++
i) {
1410 tgg.
arg_strs.push_back(std::string(argv[
i]));
1412 if (std::string(argv[1]) ==
"--test0") {
1414 }
else if (std::string(argv[1]) ==
"--test1") {
1416 }
else if (std::string(argv[1]) ==
"--test2") {
1418 }
else if (std::string(argv[1]) ==
"--test3") {
1420 }
else if (std::string(argv[1]) ==
"--test4") {
1422 }
else if (std::string(argv[1]) ==
"--test5") {
1424 }
else if (std::string(argv[1]) ==
"--test6") {
1426 }
else if (std::string(argv[1]) ==
"--test7") {
1428 }
else if (std::string(argv[1]) ==
"--test8") {
1430 }
else if (std::string(argv[1]) ==
"--test9") {
1432 }
else if (std::string(argv[1]) ==
"--test10") {
1434 }
else if (std::string(argv[1]) ==
"--test11") {
1436 }
else if (std::string(argv[1]) ==
"--test12") {
1438 }
else if (std::string(argv[1]) ==
"--test13") {
1440 }
else if (std::string(argv[1]) ==
"--test14") {
1442 }
else if (std::string(argv[1]) ==
"--test15") {
1444 }
else if (std::string(argv[1]) ==
"--test16") {
1446 }
else if (std::string(argv[1]) ==
"--test17") {
1448 }
else if (std::string(argv[1]) ==
"--test18") {
1450 }
else if (std::string(argv[1]) ==
"--test19") {
1452 }
else if (std::string(argv[1]) ==
"--test20") {
std::string fname_fposvel
std::string test_doc_string
double getMaxValue() const
const std::vector< step_node > & get_support_leg_steps() const
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 print_param(const std::string &print_str="") const
double get_toe_pos_offset_x() const
double get_heel_zmp_offset_x() const
void set_default_double_support_ratio_swing_before(const double _default_double_support_ratio_swing_before)
void set_default_double_support_static_ratio_after(const double _default_double_support_static_ratio_after)
double calcDiff(T &value) const
~ValueDifferenceChecker()
double get_toe_zmp_offset_x() const
void set_swing_trajectory_delay_time_offset(const double _time_offset)
void set_heel_angle(const double _angle)
const hrp::Vector3 & get_refzmp() const
void set_default_step_height(const double _tmp)
size_t get_overwrite_check_timing() const
ValueErrorChecker(double _thre)
ValueDifferenceChecker< hrp::Vector3 > ssmcrotvel_diff_checker
void parse_params(bool is_print_doc_setring=true)
void set_swing_trajectory_final_distance_weight(const double _final_distance_weight)
size_t get_lcg_count() const
double getMaxValue() const
void clear_footstep_nodes_list()
bool isSmallError() const
int get_NUM_TH_PHASES() const
void set_toe_pos_offset_x(const double _offx)
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
bool get_use_toe_heel_auto_set() const
void set_default_double_support_ratio_swing_after(const double _default_double_support_ratio_swing_after)
void get_swing_support_mid_coords(coordinates &ret) const
hrp::Vector3 prev_rfoot_rpy
void set_optional_go_pos_finalize_footstep_num(const size_t num)
testGaitGenerator(double _dt)
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
int main(int argc, char *argv[])
double getDiffThre() const
ValueDifferenceChecker< std::vector< hrp::Vector3 > > zmpoffset_diff_checker
void error(char *msg) const
void set_use_toe_heel_transition(const bool _u)
std::vector< bool > prev_contact_states
void set_overwritable_footstep_index_offset(const size_t _of)
std::vector< std::string > all_limbs
bool set_toe_heel_phase_ratio(const std::vector< double > &ratio)
void check_start_values()
void checkValueError(const hrp::Vector3 &p0, const hrp::Vector3 &p1, std::vector< size_t > neglect_index=std::vector< size_t >())
double get_default_step_time() const
void set_default_zmp_offsets(const std::vector< hrp::Vector3 > &tmp)
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 set_default_double_support_ratio_before(const double _default_double_support_ratio_before)
std::vector< std::string > vstring
std::vector< hrp::Vector3 > leg_pos
std::string fname_ssmcvel
void set_stair_trajectory_way_point_offset(const hrp::Vector3 _offset)
double get_heel_pos_offset_x() const
std::vector< double > prev_swing_support_time
const std::vector< std::string > get_support_leg_names() const
void set_cycloid_delay_kick_point_offset(const hrp::Vector3 _offset)
const std::vector< hrp::Vector3 > & get_swing_foot_zmp_offsets() const
void set_stride_parameters(const double _stride_fwd_x, const double _stride_outside_y, const double _stride_outside_theta, const double _stride_bwd_x, const double _stride_inside_y, const double _stride_inside_theta)
double get_heel_angle() const
std::vector< std::string > arg_strs
ValueDifferenceChecker(double _diff_thre)
void set_default_double_support_ratio_after(const double _default_double_support_ratio_after)
std::vector< double > step_time_list
void set_velocity_param(const double vel_x, const double vel_y, const double vel_theta)
void plot_and_save(FILE *gp, const std::string graph_fname, const std::string plot_str)
FILE * popen(const char *cmd, const char *mode)
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)
void set_default_orbit_type(const orbit_type type)
void set_default_step_time(const double _default_step_time)
void set_use_toe_heel_auto_set(const bool _u)
void gen_and_plot_walk_pattern(const step_node &initial_support_leg_step, const step_node &initial_swing_leg_dst_step)
double get_current_swing_time(const size_t idx) const
std::vector< leg_type > get_current_support_states() const
HRP_UTIL_EXPORT Vector3 rpyFromRot(const Matrix33 &m)
bool get_use_toe_heel_transition() const
void checkValueDiff(T &value)
double get_toe_angle() const
bool eps_eq(const double a, const double b, const double eps=0.001)
std::vector< hrp::Vector3 > get_support_foot_zmp_offsets() const
void plot_and_print_errorcheck()
bool check_all_results() const
void set_swing_trajectory_time_offset_xy2z(const double _tmp)
const std::vector< step_node > & get_swing_leg_steps() const
void set_toe_zmp_offset_x(const double _off)
hrp::Vector3 min_rfoot_pos
ValueErrorChecker zmp_error_checker
bool is_contact_states_swing_support_time_validity
std::vector< std::string > get_footstep_front_leg_names() const
void set_toe_angle(const double _angle)
void set_foot_steps_list(const std::vector< std::vector< step_node > > &fnsl)
double get_default_step_height() const
void gen_and_plot_walk_pattern()
hrp::Vector3 get_cart_zmp() const
virtual ~testGaitGenerator()
void set_heel_zmp_offset_x(const double _off)
double get_current_toe_heel_ratio() const
bool is_toe_heel_zmp_offset_x_valid
double getErrorThre() const
const hrp::Vector3 & get_cog() const
testGaitGeneratorHRP2JSK()
void proc_one_walking_motion(size_t i)
void set_default_double_support_static_ratio_before(const double _default_double_support_static_ratio_before)
void mid_coords(coordinates &mid_coords, const double p, const coordinates &c1, const coordinates &c2, const double eps)
int usleep(useconds_t usec)
std::string fname_frotvel
void set_heel_pos_offset_x(const double _offx)