5 // When the file with precomputed entries is ready.
6 //#include "fiat_punto.h"
20 std::cout << std::fixed;
21 std::cerr << std::fixed;
22 assert(jvi["slot"] != Json::nullValue);
26 jvi["slot"][0][0].asDouble(), jvi["slot"][0][1].asDouble(),
27 jvi["slot"][1][0].asDouble(), jvi["slot"][1][1].asDouble(),
28 jvi["slot"][2][0].asDouble(), jvi["slot"][2][1].asDouble(),
29 jvi["slot"][3][0].asDouble(), jvi["slot"][3][1].asDouble());
32 //c.ctc(8.411896337925237);
37 // jhang 2020 https://en.wikipedia.org/wiki/Chrysler_Pacifica_(minivan)
38 //c.ctc(9.557619159602458);
45 // PES Porsche Cayenne
46 c.ctc(11.2531); // this is guess
49 c.df(2.895 + 0.9); // this is guess
53 if (s.parallel() && !s.right()) {
60 pr.reflect(s.entry());
62 //std::cerr << ip_time.scnt() << std::endl;
63 // The following uses precomputed entries and needs `"fiat_punto.h"` to
65 //auto pr = get_fiat_punto_entry(s.len(), s.w());
66 //pr = s.recompute_entry(pr);
72 std::vector<bcar::Pose> ispath;
74 while (!c.rf().on_right_side_of(s.entry())) {
79 while (c.lf().on_right_side_of(s.entry())) {
86 for (auto &n : s.drive_in_slot(c)) {
90 jvi["goal"][0] = pr.x();
91 jvi["goal"][1] = pr.y();
92 jvi["goal"][2] = pr.b();
93 jvi["goal"][3] = pr.e();
94 jvi["goal_inside"][0] = ispath.back().x();
95 jvi["goal_inside"][1] = ispath.back().y();
96 jvi["goal_inside"][2] = ispath.back().h();
105 //p.bc().ctc(8.411896337925237);
110 // jhang 2020 https://en.wikipedia.org/wiki/Chrysler_Pacifica_(minivan)
111 //p.bc().ctc(9.557619159602458);
119 // PES Porsche Cayenne
120 p.bc().ctc(11.2531); // this is guess
123 p.bc().df(2.895 + 0.9); // this is guess
128 unsigned int icnt = 0;
129 unsigned int rcnt = 0;
130 unsigned int bcnt = 0;
131 unsigned int ncnt = 0; // not better counter
132 Json::Value best_path;
136 while (icnt < 1000) {
141 if (pj["path"] != Json::nullValue) {
142 double gc = pj["goal_cc"].asDouble();
144 if (cost == 0.0 || gc < cost) {
145 if (gc < 0.75 * cost) {
148 best_path = pj["path"];
161 double elapsed = p.scnt();
164 for (auto p: ispath) {
165 jvo["ispath"][i][0] = p.x();
166 jvo["ispath"][i][1] = p.y();
167 jvo["ispath"][i][2] = p.h();
170 jvo["init"] = jvi["init"];
171 jvo["slot"] = jvi["slot"];
172 jvo["obst"] = jvi["obst"];
173 jvo["entry"] = jvi["goal"];
174 jvo["goal"][0] = ispath.back().x();
175 jvo["goal"][1] = ispath.back().y();
176 jvo["goal"][2] = ispath.back().h();
177 jvo["time"] = elapsed;
178 jvo["icnt"] = p.icnt();
182 jvo["path"] = best_path;
183 jvo["goal_cc"] = cost;
184 std::cout << jvo << std::endl;