From 9a5e6c6efc0ec3159c5b3505bc6dea6c02b8cc9b Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Mon, 3 Jun 2024 12:22:16 +0900 Subject: [PATCH] refactor(multi_object_tracker): use constexpr properly (#7206) reafctor multi_object_tracker Signed-off-by: Ryuta Kambe --- .../src/tracker/model/bicycle_tracker.cpp | 6 +++--- .../src/tracker/model/big_vehicle_tracker.cpp | 6 +++--- .../src/tracker/model/normal_vehicle_tracker.cpp | 6 +++--- .../src/tracker/model/pedestrian_tracker.cpp | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/perception/multi_object_tracker/src/tracker/model/bicycle_tracker.cpp b/perception/multi_object_tracker/src/tracker/model/bicycle_tracker.cpp index 4e5f14fde6834..fdc93419b326a 100644 --- a/perception/multi_object_tracker/src/tracker/model/bicycle_tracker.cpp +++ b/perception/multi_object_tracker/src/tracker/model/bicycle_tracker.cpp @@ -127,9 +127,9 @@ BicycleTracker::BicycleTracker( constexpr double p0_stddev_y = 0.5; // in object coordinate [m] constexpr double p0_stddev_yaw = tier4_autoware_utils::deg2rad(25); // in map coordinate [rad] - constexpr double p0_cov_x = std::pow(p0_stddev_x, 2.0); - constexpr double p0_cov_y = std::pow(p0_stddev_y, 2.0); - constexpr double p0_cov_yaw = std::pow(p0_stddev_yaw, 2.0); + constexpr double p0_cov_x = p0_stddev_x * p0_stddev_x; + constexpr double p0_cov_y = p0_stddev_y * p0_stddev_y; + constexpr double p0_cov_yaw = p0_stddev_yaw * p0_stddev_yaw; const double cos_yaw = std::cos(yaw); const double sin_yaw = std::sin(yaw); diff --git a/perception/multi_object_tracker/src/tracker/model/big_vehicle_tracker.cpp b/perception/multi_object_tracker/src/tracker/model/big_vehicle_tracker.cpp index 15c6b2e722ed5..5e3ba8d614e7e 100644 --- a/perception/multi_object_tracker/src/tracker/model/big_vehicle_tracker.cpp +++ b/perception/multi_object_tracker/src/tracker/model/big_vehicle_tracker.cpp @@ -147,9 +147,9 @@ BigVehicleTracker::BigVehicleTracker( constexpr double p0_stddev_y = 0.5; // in object coordinate [m] constexpr double p0_stddev_yaw = tier4_autoware_utils::deg2rad(25); // in map coordinate [rad] - constexpr double p0_cov_x = std::pow(p0_stddev_x, 2.0); - constexpr double p0_cov_y = std::pow(p0_stddev_y, 2.0); - constexpr double p0_cov_yaw = std::pow(p0_stddev_yaw, 2.0); + constexpr double p0_cov_x = p0_stddev_x * p0_stddev_x; + constexpr double p0_cov_y = p0_stddev_y * p0_stddev_y; + constexpr double p0_cov_yaw = p0_stddev_yaw * p0_stddev_yaw; const double cos_yaw = std::cos(yaw); const double sin_yaw = std::sin(yaw); diff --git a/perception/multi_object_tracker/src/tracker/model/normal_vehicle_tracker.cpp b/perception/multi_object_tracker/src/tracker/model/normal_vehicle_tracker.cpp index bd04cc613ef12..9907da2105825 100644 --- a/perception/multi_object_tracker/src/tracker/model/normal_vehicle_tracker.cpp +++ b/perception/multi_object_tracker/src/tracker/model/normal_vehicle_tracker.cpp @@ -148,9 +148,9 @@ NormalVehicleTracker::NormalVehicleTracker( constexpr double p0_stddev_y = 0.3; // in object coordinate [m] constexpr double p0_stddev_yaw = tier4_autoware_utils::deg2rad(25); // in map coordinate [rad] - constexpr double p0_cov_x = std::pow(p0_stddev_x, 2.0); - constexpr double p0_cov_y = std::pow(p0_stddev_y, 2.0); - constexpr double p0_cov_yaw = std::pow(p0_stddev_yaw, 2.0); + constexpr double p0_cov_x = p0_stddev_x * p0_stddev_x; + constexpr double p0_cov_y = p0_stddev_y * p0_stddev_y; + constexpr double p0_cov_yaw = p0_stddev_yaw * p0_stddev_yaw; const double cos_yaw = std::cos(yaw); const double sin_yaw = std::sin(yaw); diff --git a/perception/multi_object_tracker/src/tracker/model/pedestrian_tracker.cpp b/perception/multi_object_tracker/src/tracker/model/pedestrian_tracker.cpp index fd9ef82dfdca3..6891bf6f63500 100644 --- a/perception/multi_object_tracker/src/tracker/model/pedestrian_tracker.cpp +++ b/perception/multi_object_tracker/src/tracker/model/pedestrian_tracker.cpp @@ -122,9 +122,9 @@ PedestrianTracker::PedestrianTracker( constexpr double p0_stddev_y = 2.0; // in object coordinate [m] constexpr double p0_stddev_yaw = tier4_autoware_utils::deg2rad(1000); // in map coordinate [rad] - constexpr double p0_cov_x = std::pow(p0_stddev_x, 2.0); - constexpr double p0_cov_y = std::pow(p0_stddev_y, 2.0); - constexpr double p0_cov_yaw = std::pow(p0_stddev_yaw, 2.0); + constexpr double p0_cov_x = p0_stddev_x * p0_stddev_x; + constexpr double p0_cov_y = p0_stddev_y * p0_stddev_y; + constexpr double p0_cov_yaw = p0_stddev_yaw * p0_stddev_yaw; const double cos_yaw = std::cos(yaw); const double sin_yaw = std::sin(yaw);