3 #include <jsoncpp/json/json.h>
7 std::chrono::high_resolution_clock::time_point TSTART_;
8 std::chrono::high_resolution_clock::time_point TEND_;
9 inline void TSTART() { TSTART_ = std::chrono::high_resolution_clock::now(); }
10 inline void TEND() { TEND_ = std::chrono::high_resolution_clock::now(); }
13 std::chrono::duration<double> DT_;
14 DT_ = std::chrono::duration_cast<std::chrono::duration<double>>(
19 inline void TPRINT(const char *what)
21 std::cerr << what << ": " << TDIFF() << std::endl;
26 Json::Value jvo; // JSON output
28 double offset = -1.256994;
30 std::cerr << "#dist,fe cusps,fe time,fer cusps,fer time";
31 std::cerr << std::endl;
32 for (int i = 0; i < 14; i++) {
33 jvo["goals"] = Json::nullValue;
36 double ppsl = 0.01 + psp.cc().perfect_parking_slot_len();
37 double psl = ppsl + offset + i * delta;
48 std::cerr << (psl - psp.cc().l() - 0.01);
54 jvo["time"] = TDIFF();
55 jvo["goal"][0] = psp.gc().x();
56 jvo["goal"][1] = psp.gc().y();
57 jvo["goal"][2] = psp.gc().h();
58 unsigned int icnt = 0;
59 for (auto &i: psp.cusps()) {
60 jvo["goals"][icnt][0] = i.x();
61 jvo["goals"][icnt][1] = i.y();
62 jvo["goals"][icnt][2] = i.h();
65 jvo["goals"][icnt][0] = psp.cc().x();
66 jvo["goals"][icnt][1] = psp.cc().y();
67 jvo["goals"][icnt][2] = psp.cc().h();
68 jvo["slot"][0][0][0] = psp.ps().x1();
69 jvo["slot"][0][0][1] = psp.ps().y1();
70 jvo["slot"][0][1][0] = psp.ps().x2();
71 jvo["slot"][0][1][1] = psp.ps().y2();
72 jvo["slot"][0][2][0] = psp.ps().x3();
73 jvo["slot"][0][2][1] = psp.ps().y3();
74 jvo["slot"][0][3][0] = psp.ps().x4();
75 jvo["slot"][0][3][1] = psp.ps().y4();
76 jvo["cusp"] = psp.c();
77 std::cout << jvo << std::endl;
80 psp.fer(); // or fer()
86 std::cerr << std::endl;
88 jvo["time"] = TDIFF();
89 jvo["goal"][0] = psp.gc().x();
90 jvo["goal"][1] = psp.gc().y();
91 jvo["goal"][2] = psp.gc().h();
93 for (auto &i: psp.cusps()) {
94 jvo["goals"][icnt][0] = i.x();
95 jvo["goals"][icnt][1] = i.y();
96 jvo["goals"][icnt][2] = i.h();
99 jvo["goals"][icnt][0] = psp.cc().x();
100 jvo["goals"][icnt][1] = psp.cc().y();
101 jvo["goals"][icnt][2] = psp.cc().h();
102 jvo["slot"][0][0][0] = psp.ps().x1();
103 jvo["slot"][0][0][1] = psp.ps().y1();
104 jvo["slot"][0][1][0] = psp.ps().x2();
105 jvo["slot"][0][1][1] = psp.ps().y2();
106 jvo["slot"][0][2][0] = psp.ps().x3();
107 jvo["slot"][0][2][1] = psp.ps().y3();
108 jvo["slot"][0][3][0] = psp.ps().x4();
109 jvo["slot"][0][3][1] = psp.ps().y4();
110 jvo["cusp"] = psp.c();
111 std::cout << jvo << std::endl;