@@ -440,6 +440,28 @@ nav_msgs::msg::Path SmacPlannerLattice::createPlan(
440
440
_raw_plan_publisher->publish (plan);
441
441
}
442
442
443
+ // Find how much time we have left to do smoothing
444
+ steady_clock::time_point b = steady_clock::now ();
445
+ duration<double > time_span = duration_cast<duration<double >>(b - a);
446
+ double time_remaining = _max_planning_time - static_cast <double >(time_span.count ());
447
+
448
+ #ifdef BENCHMARK_TESTING
449
+ std::cout << " It took " << time_span.count () * 1000 <<
450
+ " milliseconds with " << num_iterations << " iterations." << std::endl;
451
+ #endif
452
+
453
+ // Smooth plan
454
+ if (_smoother && num_iterations > 1 ) {
455
+ _smoother->smooth (plan, _costmap, time_remaining);
456
+ }
457
+
458
+ #ifdef BENCHMARK_TESTING
459
+ steady_clock::time_point c = steady_clock::now ();
460
+ duration<double > time_span2 = duration_cast<duration<double >>(c - b);
461
+ std::cout << " It took " << time_span2.count () * 1000 <<
462
+ " milliseconds to smooth path." << std::endl;
463
+ #endif
464
+
443
465
if (_debug_visualizations) {
444
466
// Publish expansions for debug
445
467
geometry_msgs::msg::PoseArray msg;
@@ -472,28 +494,6 @@ nav_msgs::msg::Path SmacPlannerLattice::createPlan(
472
494
}
473
495
}
474
496
475
- // Find how much time we have left to do smoothing
476
- steady_clock::time_point b = steady_clock::now ();
477
- duration<double > time_span = duration_cast<duration<double >>(b - a);
478
- double time_remaining = _max_planning_time - static_cast <double >(time_span.count ());
479
-
480
- #ifdef BENCHMARK_TESTING
481
- std::cout << " It took " << time_span.count () * 1000 <<
482
- " milliseconds with " << num_iterations << " iterations." << std::endl;
483
- #endif
484
-
485
- // Smooth plan
486
- if (_smoother && num_iterations > 1 ) {
487
- _smoother->smooth (plan, _costmap, time_remaining);
488
- }
489
-
490
- #ifdef BENCHMARK_TESTING
491
- steady_clock::time_point c = steady_clock::now ();
492
- duration<double > time_span2 = duration_cast<duration<double >>(c - b);
493
- std::cout << " It took " << time_span2.count () * 1000 <<
494
- " milliseconds to smooth path." << std::endl;
495
- #endif
496
-
497
497
return plan;
498
498
}
499
499
0 commit comments