forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refactor/start_planner_filtering' into refactor/use_run…
…_base_class_function Signed-off-by: kyoichi-sugahara <[email protected]>
- Loading branch information
Showing
9 changed files
with
128 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
common/motion_utils/test/src/trajectory/benchmark_calcLateralOffset.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2023 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "motion_utils/trajectory/trajectory.hpp" | ||
|
||
#include <gtest/gtest.h> | ||
#include <gtest/internal/gtest-port.h> | ||
#include <tf2/LinearMath/Quaternion.h> | ||
|
||
#include <random> | ||
|
||
namespace | ||
{ | ||
using autoware_auto_planning_msgs::msg::Trajectory; | ||
using tier4_autoware_utils::createPoint; | ||
using tier4_autoware_utils::createQuaternionFromRPY; | ||
|
||
constexpr double epsilon = 1e-6; | ||
|
||
geometry_msgs::msg::Pose createPose( | ||
double x, double y, double z, double roll, double pitch, double yaw) | ||
{ | ||
geometry_msgs::msg::Pose p; | ||
p.position = createPoint(x, y, z); | ||
p.orientation = createQuaternionFromRPY(roll, pitch, yaw); | ||
return p; | ||
} | ||
|
||
template <class T> | ||
T generateTestTrajectory( | ||
const size_t num_points, const double point_interval, const double vel = 0.0, | ||
const double init_theta = 0.0, const double delta_theta = 0.0) | ||
{ | ||
using Point = typename T::_points_type::value_type; | ||
|
||
T traj; | ||
for (size_t i = 0; i < num_points; ++i) { | ||
const double theta = init_theta + i * delta_theta; | ||
const double x = i * point_interval * std::cos(theta); | ||
const double y = i * point_interval * std::sin(theta); | ||
|
||
Point p; | ||
p.pose = createPose(x, y, 0.0, 0.0, 0.0, theta); | ||
p.longitudinal_velocity_mps = vel; | ||
traj.points.push_back(p); | ||
} | ||
|
||
return traj; | ||
} | ||
} // namespace | ||
|
||
TEST(trajectory_benchmark, DISABLED_calcLateralOffset) | ||
{ | ||
std::random_device r; | ||
std::default_random_engine e1(r()); | ||
std::uniform_real_distribution<double> uniform_dist(0.0, 1000.0); | ||
|
||
using motion_utils::calcLateralOffset; | ||
|
||
const auto traj = generateTestTrajectory<Trajectory>(1000, 1.0, 0.0, 0.0, 0.1); | ||
constexpr auto nb_iteration = 10000; | ||
for (auto i = 0; i < nb_iteration; ++i) { | ||
const auto point = createPoint(uniform_dist(e1), uniform_dist(e1), 0.0); | ||
calcLateralOffset(traj.points, point); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters