-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move SplineInterpolationPoints2d to another file
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
- Loading branch information
1 parent
d965378
commit a683cc0
Showing
6 changed files
with
289 additions
and
287 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
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
71 changes: 71 additions & 0 deletions
71
common/interpolation/include/interpolation/spline_interpolation_points_2d.hpp
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,71 @@ | ||
// Copyright 2021 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. | ||
|
||
#ifndef INTERPOLATION__SPLINE_INTERPOLATION_POINTS_2D_HPP_ | ||
#define INTERPOLATION__SPLINE_INTERPOLATION_POINTS_2D_HPP_ | ||
|
||
#include "interpolation/spline_interpolation.hpp" | ||
|
||
#include <vector> | ||
|
||
namespace interpolation | ||
{ | ||
// TODO(murooka) use template | ||
// template <typename T> | ||
// std::vector<double> slerpYawFromPoints(const std::vector<T> & points); | ||
std::vector<double> slerpYawFromPoints(const std::vector<geometry_msgs::msg::Point> & points); | ||
} // namespace interpolation | ||
|
||
// non-static points spline interpolation | ||
// NOTE: We can calculate yaw from the x and y by interpolation derivatives. | ||
// | ||
// Usage: | ||
// ``` | ||
// SplineInterpolationPoints2d spline; | ||
// // memorize pre-interpolation result internally | ||
// spline.calcSplineCoefficients(base_keys, base_values); | ||
// const auto interpolation_result1 = spline.getSplineInterpolatedPoints( | ||
// base_keys, query_keys1); | ||
// const auto interpolation_result2 = spline.getSplineInterpolatedPoints( | ||
// base_keys, query_keys2); | ||
// const auto yaw_interpolation_result = spline.getSplineInterpolatedYaws( | ||
// base_keys, query_keys1); | ||
// ``` | ||
class SplineInterpolationPoints2d | ||
{ | ||
public: | ||
SplineInterpolationPoints2d() = default; | ||
|
||
// TODO(murooka) use template | ||
// template <typename T> | ||
// void calcSplineCoefficients(const std::vector<T> & points); | ||
void calcSplineCoefficients(const std::vector<geometry_msgs::msg::Point> & points); | ||
|
||
// TODO(murooka) implement these functions | ||
// std::vector<geometry_msgs::msg::Point> getSplineInterpolatedPoints(const double width); | ||
// std::vector<geometry_msgs::msg::Pose> getSplineInterpolatedPoses(const double width); | ||
|
||
geometry_msgs::msg::Point getSplineInterpolatedPoint(const size_t idx, const double s) const; | ||
double getSplineInterpolatedYaw(const size_t idx, const double s) const; | ||
|
||
double getAccumulatedLength(const size_t idx) const; | ||
|
||
private: | ||
SplineInterpolation slerp_x_; | ||
SplineInterpolation slerp_y_; | ||
|
||
std::vector<double> base_s_vec_; | ||
}; | ||
|
||
#endif // INTERPOLATION__SPLINE_INTERPOLATION_POINTS_2D_HPP_ |
Oops, something went wrong.