18 #include <gtest/gtest.h> 40 #define EPS_KAPPA 1e-3 // [1/m] 41 #define KAPPA 1.0 // [1/m] 42 #define SIGMA 1.0 // [1/m^2] 43 #define DISCRETIZATION 0.1 // [m] 44 #define SAMPLES 1e5 // [-] 45 #define OPERATING_REGION_X 20.0 // [m] 46 #define OPERATING_REGION_Y 20.0 // [m] 47 #define OPERATING_REGION_THETA 2 * M_PI // [rad] 48 #define ALPHA1 0.1 // [-] 49 #define ALPHA2 0.05 // [-] 50 #define ALPHA3 0.05 // [-] 51 #define ALPHA4 0.1 // [-] 52 #define STD_X 0.1 // [m] 53 #define STD_Y 0.1 // [m] 54 #define STD_THETA 0.05 // [rad] 56 #define K2 0.25 // [-] 58 #define random(lower, upper) (rand() * (upper - lower) / RAND_MAX + lower) 85 double sum = accumulate(v.begin(), v.end(), 0.0);
86 return sum / v.size();
93 for (
const auto& x : v)
95 diff_sq +=
pow(x - mean, 2);
97 return sqrt(diff_sq / v.size());
103 vector<Control>::const_iterator iter1 = controls.begin();
104 for (vector<Control>::const_iterator iter2 = next(controls.begin()); iter2 != controls.end(); ++iter2)
106 if (fabs(iter1->kappa + iter1->sigma * fabs(iter1->delta_s) - iter2->kappa) >
EPS_KAPPA)
116 remove(path_to_output.c_str());
117 string header =
"start,goal,computation_time,path_length";
119 f.open(path_to_output, ios::app);
121 for (
const auto& stat : stats)
124 State goal = stat.goal;
125 f << start.
x <<
" " << start.
y <<
" " << start.
theta <<
" " << start.
kappa <<
" " << start.
d <<
",";
126 f << goal.
x <<
" " << goal.
y <<
" " << goal.
theta <<
" " << goal.
kappa <<
" " << goal.
d <<
",";
127 f << stat.computation_time <<
"," << stat.path_length <<
"," << stat.curv_discont << endl;
146 vector<Statistic>
get_controls(
const string&
id,
const vector<State>& starts,
const vector<State>& goals)
149 clock_t clock_finish;
151 vector<Statistic> stats;
155 for (
auto start = starts.begin(), goal = goals.begin();
start != starts.end(); ++
start, ++goal)
157 if (
id ==
"CC_Dubins")
159 clock_start = clock();
160 vector<Control> cc_dubins_forwards_controls = cc_dubins_forwards_ss.
get_controls(*
start, *goal);
161 clock_finish = clock();
165 else if (
id ==
"CC00_Dubins")
167 clock_start = clock();
168 vector<Control> cc00_dubins_forwards_controls = cc00_dubins_forwards_ss.
get_controls(*
start, *goal);
169 clock_finish = clock();
173 else if (
id ==
"CC0pm_Dubins")
175 clock_start = clock();
176 vector<Control> cc0pm_dubins_forwards_controls = cc0pm_dubins_forwards_ss.
get_controls(*
start, *goal);
177 clock_finish = clock();
181 else if (
id ==
"CCpm0_Dubins")
183 clock_start = clock();
184 vector<Control> ccpm0_dubins_forwards_controls = ccpm0_dubins_forwards_ss.
get_controls(*
start, *goal);
185 clock_finish = clock();
189 else if (
id ==
"CCpmpm_Dubins")
191 clock_start = clock();
192 vector<Control> ccpmpm_dubins_forwards_controls = ccpmpm_dubins_forwards_ss.
get_controls(*
start, *goal);
193 clock_finish = clock();
197 else if (
id ==
"Dubins")
199 clock_start = clock();
200 vector<Control> dubins_forwards_controls = dubins_forwards_ss.
get_controls(*
start, *goal);
201 clock_finish = clock();
205 else if (
id ==
"CC00_RS")
207 clock_start = clock();
209 clock_finish = clock();
213 else if (
id ==
"HC_RS")
215 clock_start = clock();
217 clock_finish = clock();
221 else if (
id ==
"HC00_RS")
223 clock_start = clock();
225 clock_finish = clock();
229 else if (
id ==
"HC0pm_RS")
231 clock_start = clock();
233 clock_finish = clock();
237 else if (
id ==
"HCpm0_RS")
239 clock_start = clock();
241 clock_finish = clock();
245 else if (
id ==
"HCpmpm_RS")
247 clock_start = clock();
249 clock_finish = clock();
255 clock_start = clock();
257 clock_finish = clock();
263 stat.
computation_time = double(clock_finish - clock_start) / CLOCKS_PER_SEC;
266 stats.push_back(stat);
271 vector<Statistic>
get_path(
const string&
id,
const vector<State>& starts,
const vector<State>& goals)
274 clock_t clock_finish;
276 vector<Statistic> stats;
278 for (
auto start = starts.begin(), goal = goals.begin();
start != starts.end(); ++
start, ++goal)
280 if (
id ==
"CC_Dubins")
282 clock_start = clock();
284 clock_finish = clock();
286 else if (
id ==
"CC00_Dubins")
288 clock_start = clock();
290 clock_finish = clock();
292 else if (
id ==
"CC0pm_Dubins")
294 clock_start = clock();
296 clock_finish = clock();
298 else if (
id ==
"CCpm0_Dubins")
300 clock_start = clock();
302 clock_finish = clock();
304 else if (
id ==
"CCpmpm_Dubins")
306 clock_start = clock();
308 clock_finish = clock();
310 else if (
id ==
"Dubins")
312 clock_start = clock();
314 clock_finish = clock();
316 else if (
id ==
"CC00_RS")
318 clock_start = clock();
320 clock_finish = clock();
322 else if (
id ==
"HC_RS")
324 clock_start = clock();
326 clock_finish = clock();
328 else if (
id ==
"HC00_RS")
330 clock_start = clock();
332 clock_finish = clock();
334 else if (
id ==
"HC0pm_RS")
336 clock_start = clock();
338 clock_finish = clock();
340 else if (
id ==
"HCpm0_RS")
342 clock_start = clock();
344 clock_finish = clock();
346 else if (
id ==
"HCpmpm_RS")
348 clock_start = clock();
350 clock_finish = clock();
354 clock_start = clock();
356 clock_finish = clock();
360 stat.
computation_time = double(clock_finish - clock_start) / CLOCKS_PER_SEC;
361 stats.push_back(stat);
367 const vector<State>& goals)
370 clock_t clock_finish;
372 vector<Statistic> stats;
374 auto start = starts.begin();
375 auto goal = goals.begin();
376 for (
start = starts.begin(), goal = goals.begin();
start != starts.end(); ++
start, ++goal)
378 if (
id ==
"CC_Dubins")
380 clock_start = clock();
382 clock_finish = clock();
384 else if (
id ==
"CC00_Dubins")
386 clock_start = clock();
388 clock_finish = clock();
390 if (
id ==
"CC0pm_Dubins")
392 clock_start = clock();
394 clock_finish = clock();
396 if (
id ==
"CCpm0_Dubins")
398 clock_start = clock();
400 clock_finish = clock();
402 if (
id ==
"CCpmpm_Dubins")
404 clock_start = clock();
406 clock_finish = clock();
408 else if (
id ==
"Dubins")
410 clock_start = clock();
412 clock_finish = clock();
414 else if (
id ==
"CC00_RS")
416 clock_start = clock();
418 clock_finish = clock();
420 else if (
id ==
"HC_RS")
422 clock_start = clock();
424 clock_finish = clock();
426 else if (
id ==
"HC00_RS")
428 clock_start = clock();
430 clock_finish = clock();
432 else if (
id ==
"HC0pm_RS")
434 clock_start = clock();
436 clock_finish = clock();
438 else if (
id ==
"HCpm0_RS")
440 clock_start = clock();
442 clock_finish = clock();
444 else if (
id ==
"HCpmpm_RS")
446 clock_start = clock();
448 clock_finish = clock();
452 clock_start = clock();
454 clock_finish = clock();
458 stat.
computation_time = double(clock_finish - clock_start) / CLOCKS_PER_SEC;
459 stats.push_back(stat);
467 vector<double> computation_times;
468 computation_times.reserve(
SAMPLES);
469 vector<State> starts_with_curvature, starts_without_curvature;
470 starts_with_curvature.reserve(
SAMPLES);
471 starts_without_curvature.reserve(
SAMPLES);
472 vector<State> goals_with_curvature, goals_without_curvature;
473 goals_with_curvature.reserve(
SAMPLES);
474 goals_without_curvature.reserve(
SAMPLES);
475 for (
int i = 0; i <
SAMPLES; i++)
479 starts_with_curvature.push_back(start);
480 goals_with_curvature.push_back(goal);
483 starts_without_curvature.push_back(start);
484 goals_without_curvature.push_back(goal);
487 string cc_dubins_id =
"CC_Dubins";
488 vector<Statistic> cc_dubins_stats =
get_controls(cc_dubins_id, starts_with_curvature, goals_with_curvature);
489 computation_times.clear();
490 for (
const auto& stat : cc_dubins_stats)
492 computation_times.push_back(stat.computation_time);
494 cout <<
"[----------] " + cc_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 495 <<
get_std(computation_times) << endl;
497 string cc00_dubins_id =
"CC00_Dubins";
498 vector<Statistic> cc00_dubins_stats =
get_controls(cc00_dubins_id, starts_without_curvature, goals_without_curvature);
499 computation_times.clear();
500 for (
const auto& stat : cc00_dubins_stats)
502 computation_times.push_back(stat.computation_time);
504 cout <<
"[----------] " + cc00_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 505 <<
get_std(computation_times) << endl;
507 string cc0pm_dubins_id =
"CC0pm_Dubins";
508 vector<Statistic> cc0pm_dubins_stats =
509 get_controls(cc0pm_dubins_id, starts_without_curvature, goals_without_curvature);
510 computation_times.clear();
511 for (
const auto& stat : cc0pm_dubins_stats)
513 computation_times.push_back(stat.computation_time);
515 cout <<
"[----------] " + cc0pm_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 516 <<
get_std(computation_times) << endl;
518 string ccpm0_dubins_id =
"CCpm0_Dubins";
519 vector<Statistic> ccpm0_dubins_stats =
520 get_controls(ccpm0_dubins_id, starts_without_curvature, goals_without_curvature);
521 computation_times.clear();
522 for (
const auto& stat : ccpm0_dubins_stats)
524 computation_times.push_back(stat.computation_time);
526 cout <<
"[----------] " + ccpm0_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 527 <<
get_std(computation_times) << endl;
529 string ccpmpm_dubins_id =
"CCpmpm_Dubins";
530 vector<Statistic> ccpmpm_dubins_stats =
531 get_controls(ccpmpm_dubins_id, starts_without_curvature, goals_without_curvature);
532 computation_times.clear();
533 for (
const auto& stat : ccpmpm_dubins_stats)
535 computation_times.push_back(stat.computation_time);
537 cout <<
"[----------] " + ccpmpm_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 538 <<
get_std(computation_times) << endl;
540 string dubins_id =
"Dubins";
541 vector<Statistic> dubins_stats =
get_controls(dubins_id, starts_without_curvature, goals_without_curvature);
542 computation_times.clear();
543 for (
const auto& stat : dubins_stats)
545 computation_times.push_back(stat.computation_time);
547 cout <<
"[----------] " + dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 548 <<
get_std(computation_times) << endl;
550 string cc00_rs_id =
"CC00_RS";
551 vector<Statistic> cc00_rs_stats =
get_controls(cc00_rs_id, starts_without_curvature, goals_without_curvature);
552 computation_times.clear();
553 for (
const auto& stat : cc00_rs_stats)
555 computation_times.push_back(stat.computation_time);
557 cout <<
"[----------] " + cc00_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 558 <<
get_std(computation_times) << endl;
560 string hc_rs_id =
"HC_RS";
561 vector<Statistic> hc_rs_stats =
get_controls(hc_rs_id, starts_with_curvature, goals_with_curvature);
562 computation_times.clear();
563 for (
const auto& stat : hc_rs_stats)
565 computation_times.push_back(stat.computation_time);
567 cout <<
"[----------] " + hc_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 568 <<
get_std(computation_times) << endl;
570 string hc00_rs_id =
"HC00_RS";
571 vector<Statistic> hc00_rs_stats =
get_controls(hc00_rs_id, starts_without_curvature, goals_without_curvature);
572 computation_times.clear();
573 for (
const auto& stat : hc00_rs_stats)
575 computation_times.push_back(stat.computation_time);
577 cout <<
"[----------] " + hc00_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 578 <<
get_std(computation_times) << endl;
580 string hc0pm_rs_id =
"HC0pm_RS";
581 vector<Statistic> hc0pm_rs_stats =
get_controls(hc0pm_rs_id, starts_without_curvature, goals_without_curvature);
582 computation_times.clear();
583 for (
const auto& stat : hc0pm_rs_stats)
585 computation_times.push_back(stat.computation_time);
587 cout <<
"[----------] " + hc0pm_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 588 <<
get_std(computation_times) << endl;
590 string hcpm0_rs_id =
"HCpm0_RS";
591 vector<Statistic> hcpm0_rs_stats =
get_controls(hcpm0_rs_id, starts_without_curvature, goals_without_curvature);
592 computation_times.clear();
593 for (
const auto& stat : hcpm0_rs_stats)
595 computation_times.push_back(stat.computation_time);
597 cout <<
"[----------] " + hcpm0_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 598 <<
get_std(computation_times) << endl;
600 string hcpmpm_rs_id =
"HCpmpm_RS";
601 vector<Statistic> hcpmpm_rs_stats =
get_controls(hcpmpm_rs_id, starts_without_curvature, goals_without_curvature);
602 computation_times.clear();
603 for (
const auto& stat : hcpmpm_rs_stats)
605 computation_times.push_back(stat.computation_time);
607 cout <<
"[----------] " + hcpmpm_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 608 <<
get_std(computation_times) << endl;
611 vector<Statistic> rs_stats =
get_controls(rs_id, starts_without_curvature, goals_without_curvature);
612 computation_times.clear();
613 for (
const auto& stat : rs_stats)
615 computation_times.push_back(stat.computation_time);
617 cout <<
"[----------] " + rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 618 <<
get_std(computation_times) << endl;
638 vector<double> computation_times;
639 computation_times.reserve(
SAMPLES);
640 vector<State> starts_with_curvature, starts_without_curvature;
641 starts_with_curvature.reserve(
SAMPLES);
642 starts_without_curvature.reserve(
SAMPLES);
643 vector<State> goals_with_curvature, goals_without_curvature;
644 goals_with_curvature.reserve(
SAMPLES);
645 goals_without_curvature.reserve(
SAMPLES);
646 for (
int i = 0; i <
SAMPLES; i++)
650 starts_with_curvature.push_back(start);
651 goals_with_curvature.push_back(goal);
654 starts_without_curvature.push_back(start);
655 goals_without_curvature.push_back(goal);
658 string cc_dubins_id =
"CC_Dubins";
659 vector<Statistic> cc_dubins_stats =
get_path(cc_dubins_id, starts_with_curvature, goals_with_curvature);
660 computation_times.clear();
661 for (
const auto& stat : cc_dubins_stats)
663 computation_times.push_back(stat.computation_time);
665 cout <<
"[----------] " + cc_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 666 <<
get_std(computation_times) << endl;
668 string cc00_dubins_id =
"CC00_Dubins";
669 vector<Statistic> cc00_dubins_stats =
get_path(cc00_dubins_id, starts_without_curvature, goals_without_curvature);
670 computation_times.clear();
671 for (
const auto& stat : cc00_dubins_stats)
673 computation_times.push_back(stat.computation_time);
675 cout <<
"[----------] " + cc00_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 676 <<
get_std(computation_times) << endl;
678 string cc0pm_dubins_id =
"CC0pm_Dubins";
679 vector<Statistic> cc0pm_dubins_stats =
get_path(cc0pm_dubins_id, starts_without_curvature, goals_without_curvature);
680 computation_times.clear();
681 for (
const auto& stat : cc0pm_dubins_stats)
683 computation_times.push_back(stat.computation_time);
685 cout <<
"[----------] " + cc0pm_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 686 <<
get_std(computation_times) << endl;
688 string ccpm0_dubins_id =
"CCpm0_Dubins";
689 vector<Statistic> ccpm0_dubins_stats =
get_path(ccpm0_dubins_id, starts_without_curvature, goals_without_curvature);
690 computation_times.clear();
691 for (
const auto& stat : ccpm0_dubins_stats)
693 computation_times.push_back(stat.computation_time);
695 cout <<
"[----------] " + ccpm0_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 696 <<
get_std(computation_times) << endl;
698 string ccpmpm_dubins_id =
"CCpmpm_Dubins";
699 vector<Statistic> ccpmpm_dubins_stats =
get_path(ccpmpm_dubins_id, starts_without_curvature, goals_without_curvature);
700 computation_times.clear();
701 for (
const auto& stat : ccpmpm_dubins_stats)
703 computation_times.push_back(stat.computation_time);
705 cout <<
"[----------] " + ccpmpm_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 706 <<
get_std(computation_times) << endl;
708 string dubins_id =
"Dubins";
709 vector<Statistic> dubins_stats =
get_path(dubins_id, starts_without_curvature, goals_without_curvature);
710 computation_times.clear();
711 for (
const auto& stat : dubins_stats)
713 computation_times.push_back(stat.computation_time);
715 cout <<
"[----------] " + dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 716 <<
get_std(computation_times) << endl;
718 string cc00_rs_id =
"CC00_RS";
719 vector<Statistic> cc00_rs_stats =
get_path(cc00_rs_id, starts_without_curvature, goals_without_curvature);
720 computation_times.clear();
721 for (
const auto& stat : cc00_rs_stats)
723 computation_times.push_back(stat.computation_time);
725 cout <<
"[----------] " + cc00_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 726 <<
get_std(computation_times) << endl;
728 string hc_rs_id =
"HC_RS";
729 vector<Statistic> hc_rs_stats =
get_path(hc_rs_id, starts_with_curvature, goals_with_curvature);
730 computation_times.clear();
731 for (
const auto& stat : hc_rs_stats)
733 computation_times.push_back(stat.computation_time);
735 cout <<
"[----------] " + hc_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 736 <<
get_std(computation_times) << endl;
738 string hc00_rs_id =
"HC00_RS";
739 vector<Statistic> hc00_rs_stats =
get_path(hc00_rs_id, starts_without_curvature, goals_without_curvature);
740 computation_times.clear();
741 for (
const auto& stat : hc00_rs_stats)
743 computation_times.push_back(stat.computation_time);
745 cout <<
"[----------] " + hc00_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 746 <<
get_std(computation_times) << endl;
748 string hc0pm_rs_id =
"HC0pm_RS";
749 vector<Statistic> hc0pm_rs_stats =
get_path(hc0pm_rs_id, starts_without_curvature, goals_without_curvature);
750 computation_times.clear();
751 for (
const auto& stat : hc0pm_rs_stats)
753 computation_times.push_back(stat.computation_time);
755 cout <<
"[----------] " + hc0pm_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 756 <<
get_std(computation_times) << endl;
758 string hcpm0_rs_id =
"HCpm0_RS";
759 vector<Statistic> hcpm0_rs_stats =
get_path(hcpm0_rs_id, starts_without_curvature, goals_without_curvature);
760 computation_times.clear();
761 for (
const auto& stat : hcpm0_rs_stats)
763 computation_times.push_back(stat.computation_time);
765 cout <<
"[----------] " + hcpm0_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 766 <<
get_std(computation_times) << endl;
768 string hcpmpm_rs_id =
"HCpmpm_RS";
769 vector<Statistic> hcpmpm_rs_stats =
get_path(hcpmpm_rs_id, starts_without_curvature, goals_without_curvature);
770 computation_times.clear();
771 for (
const auto& stat : hcpmpm_rs_stats)
773 computation_times.push_back(stat.computation_time);
775 cout <<
"[----------] " + hcpmpm_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 776 <<
get_std(computation_times) << endl;
779 vector<Statistic> rs_stats =
get_path(rs_id, starts_without_curvature, goals_without_curvature);
780 computation_times.clear();
781 for (
const auto& stat : rs_stats)
783 computation_times.push_back(stat.computation_time);
785 cout <<
"[----------] " + rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 786 <<
get_std(computation_times) << endl;
789 TEST(Timing, getPathWithCovariance)
821 vector<double> computation_times;
822 computation_times.reserve(
SAMPLES);
823 vector<State_With_Covariance> starts_with_curvature, starts_without_curvature;
824 starts_with_curvature.reserve(
SAMPLES);
825 starts_without_curvature.reserve(
SAMPLES);
826 vector<State> goals_with_curvature, goals_without_curvature;
827 goals_with_curvature.reserve(
SAMPLES);
828 goals_without_curvature.reserve(
SAMPLES);
829 for (
int i = 0; i <
SAMPLES; i++)
837 starts_with_curvature.push_back(start);
838 goals_with_curvature.push_back(goal);
841 starts_without_curvature.push_back(start);
842 goals_without_curvature.push_back(goal);
845 string cc_dubins_id =
"CC_Dubins";
846 vector<Statistic> cc_dubins_stats =
848 computation_times.clear();
849 for (
const auto& stat : cc_dubins_stats)
851 computation_times.push_back(stat.computation_time);
853 cout <<
"[----------] " + cc_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 854 <<
get_std(computation_times) << endl;
856 string cc00_dubins_id =
"CC00_Dubins";
857 vector<Statistic> cc00_dubins_stats =
859 computation_times.clear();
860 for (
const auto& stat : cc00_dubins_stats)
862 computation_times.push_back(stat.computation_time);
864 cout <<
"[----------] " + cc00_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 865 <<
get_std(computation_times) << endl;
867 string cc0pm_dubins_id =
"CC0pm_Dubins";
868 vector<Statistic> cc0pm_dubins_stats =
870 computation_times.clear();
871 for (
const auto& stat : cc0pm_dubins_stats)
873 computation_times.push_back(stat.computation_time);
875 cout <<
"[----------] " + cc0pm_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 876 <<
get_std(computation_times) << endl;
878 string ccpm0_dubins_id =
"CCpm0_Dubins";
879 vector<Statistic> ccpm0_dubins_stats =
881 computation_times.clear();
882 for (
const auto& stat : ccpm0_dubins_stats)
884 computation_times.push_back(stat.computation_time);
886 cout <<
"[----------] " + ccpm0_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 887 <<
get_std(computation_times) << endl;
889 string ccpmpm_dubins_id =
"CCpmpm_Dubins";
890 vector<Statistic> ccpmpm_dubins_stats =
892 computation_times.clear();
893 for (
const auto& stat : ccpmpm_dubins_stats)
895 computation_times.push_back(stat.computation_time);
897 cout <<
"[----------] " + ccpmpm_dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 898 <<
get_std(computation_times) << endl;
900 string dubins_id =
"Dubins";
901 vector<Statistic> dubins_stats =
903 computation_times.clear();
904 for (
const auto& stat : dubins_stats)
906 computation_times.push_back(stat.computation_time);
908 cout <<
"[----------] " + dubins_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 909 <<
get_std(computation_times) << endl;
911 string cc00_rs_id =
"CC00_RS";
912 vector<Statistic> cc00_rs_stats =
914 computation_times.clear();
915 for (
const auto& stat : cc00_rs_stats)
917 computation_times.push_back(stat.computation_time);
919 cout <<
"[----------] " + cc00_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 920 <<
get_std(computation_times) << endl;
922 string hc_rs_id =
"HC_RS";
924 computation_times.clear();
925 for (
const auto& stat : hc_rs_stats)
927 computation_times.push_back(stat.computation_time);
929 cout <<
"[----------] " + hc_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 930 <<
get_std(computation_times) << endl;
932 string hc00_rs_id =
"HC00_RS";
933 vector<Statistic> hc00_rs_stats =
935 computation_times.clear();
936 for (
const auto& stat : hc00_rs_stats)
938 computation_times.push_back(stat.computation_time);
940 cout <<
"[----------] " + hc00_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 941 <<
get_std(computation_times) << endl;
943 string hc0pm_rs_id =
"HC0pm_RS";
944 vector<Statistic> hc0pm_rs_stats =
946 computation_times.clear();
947 for (
const auto& stat : hc0pm_rs_stats)
949 computation_times.push_back(stat.computation_time);
951 cout <<
"[----------] " + hc0pm_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 952 <<
get_std(computation_times) << endl;
954 string hcpm0_rs_id =
"HCpm0_RS";
955 vector<Statistic> hcpm0_rs_stats =
957 computation_times.clear();
958 for (
const auto& stat : hcpm0_rs_stats)
960 computation_times.push_back(stat.computation_time);
962 cout <<
"[----------] " + hcpm0_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 963 <<
get_std(computation_times) << endl;
965 string hcpmpm_rs_id =
"HCpmpm_RS";
966 vector<Statistic> hcpmpm_rs_stats =
968 computation_times.clear();
969 for (
const auto& stat : hcpmpm_rs_stats)
971 computation_times.push_back(stat.computation_time);
973 cout <<
"[----------] " + hcpmpm_rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 974 <<
get_std(computation_times) << endl;
978 computation_times.clear();
979 for (
const auto& stat : rs_stats)
981 computation_times.push_back(stat.computation_time);
983 cout <<
"[----------] " + rs_id +
" mean [s] +/- std [s]: " <<
get_mean(computation_times) <<
" +/- " 984 <<
get_std(computation_times) << endl;
987 int main(
int argc,
char** argv)
989 testing::InitGoogleTest(&argc, argv);
990 return RUN_ALL_TESTS();
double k1
Weight on longitudinal error.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
CCpmpm_Dubins_State_Space ccpmpm_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)
std::vector< State > get_path(const State &state1, const State &state2) const
Returns shortest path from state1 to state2 with curvature = kappa_.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
CC0pm_Dubins_State_Space cc0pm_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)
An implementation of continuous curvature (CC) steer for a Reeds-Shepp car with zero curvature at the...
vector< Statistic > get_path(const string &id, const vector< State > &starts, const vector< State > &goals)
An implementation of hybrid curvature (HC) steer with arbitrary curvature at the start and goal confi...
void write_to_file(const string &id, const vector< Statistic > &stats)
An implementation of continuous curvature (CC) steer for a Dubins car with zero curvature at the star...
An implementation of hybrid curvature (HC) steer with zero curvature at the start and goal configurat...
std::vector< State_With_Covariance > get_path_with_covariance(const State_With_Covariance &state1, const State &state2) const
Returns path including covariances from state1 to state2.
double std_y
Standard deviation of localization in y.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
std::vector< State_With_Covariance > get_path_with_covariance(const State_With_Covariance &state1, const State &state2) const
Returns shortest path including covariances from state1 to state2 with curvature = kappa_...
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
An implementation of continuous curvature (CC) steer for a Dubins car with either positive (p) or neg...
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
Reeds_Shepp_State_Space rs_ss(KAPPA, DISCRETIZATION)
double get_std(const vector< double > &v)
Dubins_State_Space dubins_backwards_ss(KAPPA, DISCRETIZATION, false)
#define random(lower, upper)
HCpmpm_Reeds_Shepp_State_Space hcpmpm_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
#define OPERATING_REGION_THETA
double std_x
Standard deviation of localization in x.
double k2
Weight on lateral error.
void set_filter_parameters(const Motion_Noise &motion_noise, const Measurement_Noise &measurement_noise, const Controller &controller)
Sets the parameters required by the filter.
vector< Statistic > get_controls(const string &id, const vector< State > &starts, const vector< State > &goals)
An implementation of hybrid curvature (HC) steer with either positive (p) or negative (n) max...
An implementation of hybrid curvature (HC) steer with either positive (p) or negative (n) max...
An implementation of continuous curvature (CC) steer for a Dubins car with arbitrary curvature at the...
An SE(2) state space where distance is measured by the length of Reeds-Shepp curves. The notation and solutions are taken from: J.A. Reeds and L.A. Shepp, “Optimal paths for a car that goes both forwards and backwards,” Pacific Journal of Mathematics, 145(2):367–393, 1990. This implementation explicitly computes all 48 Reeds-Shepp curves and returns the shortest valid solution. This can be improved by using the configuration space partition described in: P. Souères and J.-P. Laumond, “Shortest paths synthesis for a car-like robot,” IEEE Trans. on Automatic Control, 41(5):672–688, May 1996.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2 with curvature = kappa_.
std::vector< State_With_Covariance > get_path_with_covariance(const State_With_Covariance &state1, const State &state2) const
Returns shortest path including covariances from state1 to state2 with curvature = kappa_...
Parameters of the motion noise model according to the book: Probabilistic Robotics, S. Thrun and others, MIT Press, 2006, p. 127-128 and p.204-206.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
State state
Expected state of the robot.
double covariance[16]
Covariance of the state given by Sigma + Lambda: (x_x x_y x_theta x_kappa y_x y_y y_theta y_kappa the...
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2 with curvature = kappa_.
double x
Position in x of the robot.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
double get_mean(const vector< double > &v)
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2 with curvature = kappa_.
#define OPERATING_REGION_Y
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
Dubins_State_Space dubins_forwards_ss(KAPPA, DISCRETIZATION, true)
TEST(Timing, getControls)
Description of a kinematic car's state with covariance.
Parameters of the measurement noise.
double k3
Weight on heading error.
Parameters of the feedback controller.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
int get_curv_discont(const vector< Control > &controls)
An implementation of continuous curvature (CC) steer for a Dubins car with either positive (p) or neg...
HCpm0_Reeds_Shepp_State_Space hcpm0_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
CC00_Dubins_State_Space cc00_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)
double alpha1
Variance in longitudinal direction: alpha1*delta_s*delta_s + alpha2*kappa*kappa.
ROSLIB_DECL std::string getPath(const std::string &package_name)
Description of a kinematic car's state.
CC00_Reeds_Shepp_State_Space cc00_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
vector< Statistic > get_path_with_covariance(const string &id, const vector< State_With_Covariance > &starts, const vector< State > &goals)
void set_filter_parameters(const Motion_Noise &motion_noise, const Measurement_Noise &measurement_noise, const Controller &controller)
Sets the parameters required by the filter.
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
std::vector< State > get_path(const State &state1, const State &state2) const
Returns shortest path from state1 to state2 with curvature = kappa_.
#define OPERATING_REGION_X
An SE(2) state space where distance is measured by the length of Dubins curves. Note that this Dubins...
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
HC00_Reeds_Shepp_State_Space hc00_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
HC_Reeds_Shepp_State_Space hc_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
double std_theta
Standard deviation of localization in theta.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
An implementation of continuous curvature (CC) steer for a Dubins car with zero curvature at the star...
double Sigma[16]
Covariance of the state estimation due to motion and measurement noise.
int main(int argc, char **argv)
double alpha3
Variance in lateral direction: alpha3*delta_s*delta_s + alpha4*kappa*kappa.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
void set_filter_parameters(const Motion_Noise &motion_noise, const Measurement_Noise &measurement_noise, const Controller &controller)
Sets the parameters required by the filter.
double kappa
Curvature at position (x,y)
CCpm0_Dubins_State_Space ccpm0_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)
std::vector< State > get_path(const State &state1, const State &state2) const
Returns path from state1 to state2.
std::vector< Control > get_controls(const State &state1, const State &state2) const
Returns controls of the shortest path from state1 to state2.
HC0pm_Reeds_Shepp_State_Space hc0pm_rs_ss(KAPPA, SIGMA, DISCRETIZATION)
double y
Position in y of the robot.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2 with curvature = kappa_.
double theta
Orientation of the robot.
double get_distance(const State &state1, const State &state2) const
Returns shortest path length from state1 to state2.
An implementation of hybrid curvature (HC) steer with zero curvature at the start configuration and e...
CC_Dubins_State_Space cc_dubins_forwards_ss(KAPPA, SIGMA, DISCRETIZATION, true)