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
51 c.become("porsche cayenne");
54 if (s.parallel() && !s.right()) {
61 pr.reflect(s.entry());
63 //std::cerr << ip_time.scnt() << std::endl;
64 // The following uses precomputed entries and needs `"fiat_punto.h"` to
66 //auto pr = get_fiat_punto_entry(s.len(), s.w());
67 //pr = s.recompute_entry(pr);
73 std::vector<bcar::Pose> ispath;
75 while (!c.rf().on_right_side_of(s.entry())) {
80 while (c.lf().on_right_side_of(s.entry())) {
87 for (auto &n : s.drive_in_slot(c)) {
91 jvi["goal"][0] = pr.x();
92 jvi["goal"][1] = pr.y();
93 jvi["goal"][2] = pr.b();
94 jvi["goal"][3] = pr.e();
95 jvi["goal_inside"][0] = ispath.back().x();
96 jvi["goal_inside"][1] = ispath.back().y();
97 jvi["goal_inside"][2] = ispath.back().h();
106 //p.bc().ctc(8.411896337925237);
111 // jhang 2020 https://en.wikipedia.org/wiki/Chrysler_Pacifica_(minivan)
112 //p.bc().ctc(9.557619159602458);
120 // PES Porsche Cayenne
121 //p.bc().ctc(11.2531); // this is guess
124 //p.bc().df(2.895 + 0.9); // this is guess
127 c.become("porsche cayenne");
130 unsigned int icnt = 0;
131 unsigned int rcnt = 0;
132 unsigned int bcnt = 0;
133 unsigned int ncnt = 0; // not better counter
134 Json::Value best_path;
138 while (icnt < 1000) {
143 if (pj["path"] != Json::nullValue) {
144 double gc = pj["goal_cc"].asDouble();
146 if (cost == 0.0 || gc < cost) {
147 if (gc < 0.75 * cost) {
150 best_path = pj["path"];
163 double elapsed = p.scnt();
166 for (auto p: ispath) {
167 jvo["ispath"][i][0] = p.x();
168 jvo["ispath"][i][1] = p.y();
169 jvo["ispath"][i][2] = p.h();
172 jvo["init"] = jvi["init"];
173 jvo["slot"] = jvi["slot"];
174 jvo["obst"] = jvi["obst"];
175 jvo["entry"] = jvi["goal"];
176 jvo["goal"][0] = ispath.back().x();
177 jvo["goal"][1] = ispath.back().y();
178 jvo["goal"][2] = ispath.back().h();
179 jvo["time"] = elapsed;
180 jvo["icnt"] = p.icnt();
184 jvo["path"] = best_path;
185 jvo["goal_cc"] = cost;
186 std::cout << jvo << std::endl;