12 : tm(_tm), ref_zmp(_ref_zmp) {};
17 int main(
int argc,
char* argv[])
20 bool use_gnuplot =
true;
22 if ( std::string(argv[1])==
"--use-gnuplot" ) {
23 use_gnuplot = (std::string(argv[2])==
"true");
27 double dt = 0.01, max_tm = 8.0;
28 std::queue<hrp::Vector3> ref_zmp_list;
29 std::deque<double> tm_list;
30 for (
size_t i = 0; i < static_cast<size_t>(round(max_tm / dt));
i++) {
31 double tmp_tm =
i * dt;
32 tm_list.push_back(tmp_tm);
36 }
else if (tmp_tm < 4) {
38 }
else if (tmp_tm < 6) {
48 std::string fname(
"/tmp/plot.dat");
49 FILE*
fp = fopen(fname.c_str(),
"w");
50 double cart_zmp[3], refzmp[3];
55 std::vector<hrp::Vector3> qdata;
56 r = df.update(p, x, qdata, ref_zmp_list.front(), qdata, !ref_zmp_list.empty());
59 df.get_cart_zmp(cart_zmp);
60 df.get_current_refzmp(refzmp);
61 fprintf(fp,
"%f %f %f %f %f %f %f\n",
70 }
else if ( !ref_zmp_list.empty() ) r =
true;
71 if (!ref_zmp_list.empty()) ref_zmp_list.pop();
76 std::string titles[2] = {
"X",
"Y"};
77 for (
size_t ii = 0; ii < 2; ii++) {
78 gp[ii] =
popen(
"gnuplot",
"w");
79 fprintf(gp[ii],
"set title \"%s\"\n", titles[ii].c_str());
80 fprintf(gp[ii],
"plot \"%s\" using 1:%zu with lines title \"cart-table zmp\"\n", fname.c_str(), ( ii * 3 + 2));
81 fprintf(gp[ii],
"replot \"%s\" using 1:%zu with lines title \"cog\"\n", fname.c_str(), ( ii * 3 + 3));
82 fprintf(gp[ii],
"replot \"%s\" using 1:%zu with lines title \"refzmp\"\n", fname.c_str(), ( ii * 3 + 4));
def j(str, encoding="cp932")
FILE * popen(const char *cmd, const char *mode)
int main(int argc, char *argv[])
gait_parameter(const double _tm, const hrp::Vector3 &_ref_zmp)