12 double edist(double x1, double y1, double x2, double y2)
14 return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
17 std::chrono::high_resolution_clock::time_point TSTART_;
18 std::chrono::high_resolution_clock::time_point TEND_;
19 inline void TSTART() { TSTART_ = std::chrono::high_resolution_clock::now(); }
20 inline void TEND() { TEND_ = std::chrono::high_resolution_clock::now(); }
23 std::chrono::duration<double> DT_;
24 DT_ = std::chrono::duration_cast<std::chrono::duration<double>>(
29 inline void TPRINT(const char *what)
31 std::cerr << what << ": " << TDIFF() << std::endl;
38 Json::Value jvi; // JSON input
39 Json::Value jvo; // JSON output
40 Json::Value best_path; // JSON output
45 jvi["slot"][0][0][0].asDouble(),
46 jvi["slot"][0][0][1].asDouble(),
48 jvi["slot"][0][1][0].asDouble(),
49 jvi["slot"][0][1][1].asDouble(),
51 jvi["slot"][0][2][0].asDouble(),
52 jvi["slot"][0][2][1].asDouble(),
54 jvi["slot"][0][3][0].asDouble(),
55 jvi["slot"][0][3][1].asDouble()
59 auto lm = psp.last_maneuver();
60 std::reverse(lm.begin(), lm.end());
63 jvi["goals"][i][0] = g.x();
64 jvi["goals"][i][1] = g.y();
65 jvi["goals"][i][2] = g.h();
71 epp.sample_dist_type(2);
72 // TODO the following has no meaning for uniform circle sampling
73 epp.set_sample(-50, 50, -50, 50, 0, 2 * M_PI);
74 unsigned int icnt = 0;
75 unsigned int rcnt = 0;
76 unsigned int bcnt = 0;
85 auto epp_path = epp.path();
88 && epp_path.size() > 0
89 && epp_path.back()->cc < cost
91 cost = epp_path.back()->cc;
92 best_path = epp.json();
99 jvo["path"] = best_path["path"];
100 jvo["goal"] = best_path["goal"];
101 jvo["slot"] = jvi["slot"];
102 jvo["bcnt"] = bcnt; // better
103 jvo["rcnt"] = rcnt; // reset
104 std::cout << jvo << std::endl;