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);
24 jvi["slot"][0][0].asDouble(), jvi["slot"][0][1].asDouble(),
25 jvi["slot"][1][0].asDouble(), jvi["slot"][1][1].asDouble(),
26 jvi["slot"][2][0].asDouble(), jvi["slot"][2][1].asDouble(),
27 jvi["slot"][3][0].asDouble(), jvi["slot"][3][1].asDouble());
30 if (s.parallel() && !s.right()) {
37 pr.reflect(s.entry());
39 // The following uses precomputed entries and needs `"fiat_punto.h"` to
41 //auto pr = get_fiat_punto_entry(s.len(), s.w());
42 //pr = s.recompute_entry(pr);
48 std::vector<bcar::Pose> ispath;
50 while (!c.rf().on_right_side_of(s.entry())) {
55 while (c.lf().on_right_side_of(s.entry())) {
65 for (auto p: s.steer_in_slot(c)) {
70 jvi["goal"][0] = pr.x();
71 jvi["goal"][1] = pr.y();
72 jvi["goal"][2] = pr.b();
73 jvi["goal"][3] = pr.e();
75 unsigned int icnt = 0;
76 unsigned int rcnt = 0;
77 unsigned int bcnt = 0;
78 unsigned int ncnt = 0; // not better counter
79 Json::Value best_path;
87 if (pj["path"] != Json::nullValue) {
88 double gc = pj["goal_cc"].asDouble();
90 if (cost == 0.0 || gc < cost) {
91 if (gc < 0.75 * cost) {
94 best_path = pj["path"];
107 double elapsed = p.scnt();
110 for (auto p: ispath) {
111 jvo["ispath"][i][0] = p.x();
112 jvo["ispath"][i][1] = p.y();
113 jvo["ispath"][i][2] = p.h();
116 jvo["init"] = jvi["init"];
117 jvo["slot"] = jvi["slot"];
118 jvo["obst"] = jvi["obst"];
119 jvo["entry"] = jvi["goal"];
120 jvo["goal"][0] = ispath.back().x();
121 jvo["goal"][1] = ispath.back().y();
122 jvo["goal"][2] = ispath.back().h();
123 jvo["time"] = elapsed;
124 jvo["icnt"] = p.icnt();
127 jvo["path"] = best_path;
128 jvo["goal_cc"] = cost;
129 std::cout << jvo << std::endl;