Skip to content

Commit 58ff7b5

Browse files
add stop watch
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
1 parent 4616b5f commit 58ff7b5

File tree

2 files changed

+12
-0
lines changed
  • planning/behavior_path_dynamic_avoidance_module

2 files changed

+12
-0
lines changed

planning/behavior_path_dynamic_avoidance_module/include/behavior_path_dynamic_avoidance_module/scene.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define BEHAVIOR_PATH_DYNAMIC_AVOIDANCE_MODULE__SCENE_HPP_
1717

1818
#include "behavior_path_planner_common/interface/scene_module_interface.hpp"
19+
#include "tier4_autoware_utils/system/stop_watch.hpp"
1920

2021
#include <rclcpp/rclcpp.hpp>
2122
#include <tier4_autoware_utils/geometry/boost_geometry.hpp>
@@ -442,6 +443,10 @@ class DynamicAvoidanceModule : public SceneModuleInterface
442443
std::shared_ptr<DynamicAvoidanceParameters> parameters_;
443444

444445
TargetObjectsManager target_objects_manager_;
446+
447+
mutable tier4_autoware_utils::StopWatch<
448+
std::chrono::milliseconds, std::chrono::microseconds, std::chrono::steady_clock>
449+
stop_watch_;
445450
};
446451
} // namespace behavior_path_planner
447452

planning/behavior_path_dynamic_avoidance_module/src/scene.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,8 @@ DynamicAvoidanceModule::calcObjectPathBasedDynamicObstaclePolygon(
18451845
std::optional<tier4_autoware_utils::Polygon2d> DynamicAvoidanceModule::calcFreeRunObstaclePolygon(
18461846
const DynamicAvoidanceObject & object, const PathWithLaneId & ego_path) const
18471847
{
1848+
stop_watch_.tic(__func__);
1849+
18481850
constexpr double end_time_to_consider = 3.0;
18491851
constexpr double required_confidence = 0.3;
18501852

@@ -1919,6 +1921,11 @@ std::optional<tier4_autoware_utils::Polygon2d> DynamicAvoidanceModule::calcFreeR
19191921
tier4_autoware_utils::MultiPolygon2d output_poly;
19201922
boost::geometry::difference(expanded_poly[0], ego_path_restriction_poly, output_poly);
19211923
if (output_poly.empty()) return {};
1924+
1925+
const double calculation_time = stop_watch_.toc(__func__);
1926+
RCLCPP_INFO_EXPRESSION(
1927+
getLogger(), parameters_->enable_debug_info, " %s := %f [ms]", __func__, calculation_time);
1928+
19221929
return output_poly[0];
19231930
}
19241931

0 commit comments

Comments
 (0)