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 if (s.parallel() && !s.right()) {
39 pr.reflect(s.entry());
41 std::cerr << ip_time.scnt() << std::endl;
42 // The following uses precomputed entries and needs `"fiat_punto.h"` to
44 //auto pr = get_fiat_punto_entry(s.len(), s.w());
45 //pr = s.recompute_entry(pr);
51 std::vector<bcar::Pose> ispath;
53 while (!c.rf().on_right_side_of(s.entry())) {
58 while (c.lf().on_right_side_of(s.entry())) {
68 for (auto p: s.steer_in_slot(c)) {
73 jvi["goal"][0] = pr.x();
74 jvi["goal"][1] = pr.y();
75 jvi["goal"][2] = pr.b();
76 jvi["goal"][3] = pr.e();
77 jvi["goal_inside"][0] = ispath.back().x();
78 jvi["goal_inside"][1] = ispath.back().y();
79 jvi["goal_inside"][2] = ispath.back().h();
81 unsigned int icnt = 0;
82 unsigned int rcnt = 0;
83 unsigned int bcnt = 0;
84 unsigned int ncnt = 0; // not better counter
85 Json::Value best_path;
93 if (pj["path"] != Json::nullValue) {
94 double gc = pj["goal_cc"].asDouble();
96 if (cost == 0.0 || gc < cost) {
97 if (gc < 0.75 * cost) {
100 best_path = pj["path"];
113 double elapsed = p.scnt();
116 for (auto p: ispath) {
117 jvo["ispath"][i][0] = p.x();
118 jvo["ispath"][i][1] = p.y();
119 jvo["ispath"][i][2] = p.h();
122 jvo["init"] = jvi["init"];
123 jvo["slot"] = jvi["slot"];
124 jvo["obst"] = jvi["obst"];
125 jvo["entry"] = jvi["goal"];
126 jvo["goal"][0] = ispath.back().x();
127 jvo["goal"][1] = ispath.back().y();
128 jvo["goal"][2] = ispath.back().h();
129 jvo["time"] = elapsed;
130 jvo["icnt"] = p.icnt();
133 jvo["path"] = best_path;
134 jvo["goal_cc"] = cost;
135 std::cout << jvo << std::endl;