3 #include <jsoncpp/json/json.h>
8 std::chrono::high_resolution_clock::time_point TSTART_;
9 std::chrono::high_resolution_clock::time_point TEND_;
10 inline void TSTART() { TSTART_ = std::chrono::high_resolution_clock::now(); }
11 inline void TEND() { TEND_ = std::chrono::high_resolution_clock::now(); }
14 std::chrono::duration<double> DT_;
15 DT_ = std::chrono::duration_cast<std::chrono::duration<double>>(
20 inline void TPRINT(const char *what)
22 std::cerr << what << ": " << TDIFF() << std::endl;
25 #define EPP RRTCE7 // EPP stands for entry point planner.
30 EppStat epp_stat = FINISHED;
33 , std::vector<RRTNode> *fp
45 if (epp.path().size() > 0) {
46 *fc = cc(*epp.path().back()) + *oic;
48 for (auto n: epp.path()) {
49 fp->push_back(RRTNode());
60 Json::Value jvi; // JSON input
63 std::vector<RRTNode> final_path;
64 double final_path_cost = 9999;
65 std::vector<RRTNode> feasible_path;
66 double feasible_path_cost = 9999;
67 double orig_init_cost = 0;
69 orig_init.x(jvi["init"][0].asDouble());
70 orig_init.y(jvi["init"][1].asDouble());
71 orig_init.h(jvi["init"][2].asDouble());
73 //orig_init.st(M_PI / 32); // only for sc2_4
75 std::thread epp_thread(
84 Json::Value jvo = jvi; // JSON output
86 jvo["path"][0][0] = orig_init.x();
87 jvo["path"][0][1] = orig_init.y();
88 jvo["path"][0][2] = orig_init.h();
91 unsigned int pcnt = 1;
92 for (auto n: final_path) {
93 jvo["path"][pcnt][0] = n.x();
94 jvo["path"][pcnt][1] = n.y();
95 jvo["path"][pcnt][2] = n.h();
96 if (n.t(RRTNodeType::cusp))
98 if (n.t(RRTNodeType::connected))
102 jvo["cusps-in-path"] = cu;
103 jvo["connecteds-in-path"] = co;
105 std::cout << jvo << std::endl;