scenario_simulator_v2 C++ API
hermite_curve.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GEOMETRY__SPLINE__HERMITE_CURVE_HPP_
16 #define GEOMETRY__SPLINE__HERMITE_CURVE_HPP_
17 
18 #include <gtest/gtest.h>
19 
21 #include <geometry_msgs/msg/point.hpp>
22 #include <geometry_msgs/msg/pose.hpp>
23 #include <geometry_msgs/msg/vector3.hpp>
24 #include <optional>
25 #include <vector>
26 
27 namespace math
28 {
29 namespace geometry
30 {
32 {
33 private:
34  friend class HermiteCurveTest;
35  double ax_;
36  double bx_;
37  double cx_;
38  double dx_;
39 
40  double ay_;
41  double by_;
42  double cy_;
43  double dy_;
44 
45  double az_;
46  double bz_;
47  double cz_;
48  double dz_;
50 
51 public:
53  const geometry_msgs::msg::Pose & start_pose, const geometry_msgs::msg::Pose & goal_pose,
54  const geometry_msgs::msg::Vector3 & start_vec, const geometry_msgs::msg::Vector3 & goal_vec);
56  double ax, double bx, double cx, double dx, double ay, double by, double cy, double dy,
57  double az, double bz, double cz, double dz);
58  std::vector<geometry_msgs::msg::Point> getTrajectory(size_t num_points = 30) const;
59  const std::vector<geometry_msgs::msg::Point> getTrajectory(
60  double start_s, double end_s, double resolution, bool denormalize_s = false) const;
61  const geometry_msgs::msg::Pose getPose(
62  double s, bool denormalize_s = false, bool fill_pitch = true) const;
63  const geometry_msgs::msg::Point getPoint(double s, bool denormalize_s = false) const;
64  const geometry_msgs::msg::Vector3 getTangentVector(double s, bool denormalize_s = false) const;
65  const geometry_msgs::msg::Vector3 getNormalVector(double s, bool denormalize_s = false) const;
66  double get2DCurvature(double s, bool denormalize_s = false) const;
67  double getMaximum2DCurvature() const;
68  double getLength(size_t num_points) const;
69  double getLength() const { return length_; }
70  std::optional<double> getSValue(
71  const geometry_msgs::msg::Pose & pose, double threshold_distance = 3.0,
72  bool denormalize_s = false) const;
74  const geometry_msgs::msg::Point & point, double s, bool denormalize_s = false) const;
75  geometry_msgs::msg::Vector3 getSquaredDistanceVector(
76  const geometry_msgs::msg::Point & point, double s, bool denormalize_s = false) const;
77  std::set<double> getCollisionPointsIn2D(
78  const geometry_msgs::msg::Point & point0, const geometry_msgs::msg::Point & point1,
79  bool search_backward = false, bool denormalize_s = false) const;
80  std::optional<double> getCollisionPointIn2D(
81  const geometry_msgs::msg::Point & point0, const geometry_msgs::msg::Point & point1,
82  bool search_backward = false, bool denormalize_s = false) const;
83  std::set<double> getCollisionPointsIn2D(
84  const std::vector<geometry_msgs::msg::Point> & polygon, bool search_backward = false,
85  bool close_start_end = true, bool denormalize_s = false) const;
86  std::optional<double> getCollisionPointIn2D(
87  const std::vector<geometry_msgs::msg::Point> & polygon, bool search_backward = false,
88  bool close_start_end = true, bool denormalize_s = false) const;
89 
90 private:
91  std::pair<double, double> get2DMinMaxCurvatureValue() const;
92  double length_;
93 };
94 } // namespace geometry
95 } // namespace math
96 
97 #endif // GEOMETRY__SPLINE__HERMITE_CURVE_HPP_
Definition: hermite_curve.hpp:32
const geometry_msgs::msg::Point getPoint(double s, bool denormalize_s=false) const
Definition: hermite_curve.cpp:367
const geometry_msgs::msg::Pose getPose(double s, bool denormalize_s=false, bool fill_pitch=true) const
Definition: hermite_curve.cpp:283
const geometry_msgs::msg::Vector3 getNormalVector(double s, bool denormalize_s=false) const
Definition: hermite_curve.cpp:257
friend class HermiteCurveTest
Definition: hermite_curve.hpp:34
geometry_msgs::msg::Vector3 getSquaredDistanceVector(const geometry_msgs::msg::Point &point, double s, bool denormalize_s=false) const
Definition: hermite_curve.cpp:76
double get2DCurvature(double s, bool denormalize_s=false) const
Definition: hermite_curve.cpp:300
std::vector< geometry_msgs::msg::Point > getTrajectory(size_t num_points=30) const
Definition: hermite_curve.cpp:243
HermiteCurve(const geometry_msgs::msg::Pose &start_pose, const geometry_msgs::msg::Pose &goal_pose, const geometry_msgs::msg::Vector3 &start_vec, const geometry_msgs::msg::Vector3 &goal_vec)
Definition: hermite_curve.cpp:50
double getLength() const
Definition: hermite_curve.hpp:69
std::optional< double > getSValue(const geometry_msgs::msg::Pose &pose, double threshold_distance=3.0, bool denormalize_s=false) const
Definition: hermite_curve.cpp:202
double getMaximum2DCurvature() const
Definition: hermite_curve.cpp:335
const geometry_msgs::msg::Vector3 getTangentVector(double s, bool denormalize_s=false) const
Definition: hermite_curve.cpp:270
double getSquaredDistanceIn2D(const geometry_msgs::msg::Point &point, double s, bool denormalize_s=false) const
Definition: hermite_curve.cpp:69
std::set< double > getCollisionPointsIn2D(const geometry_msgs::msg::Point &point0, const geometry_msgs::msg::Point &point1, bool search_backward=false, bool denormalize_s=false) const
Definition: hermite_curve.cpp:123
std::optional< double > getCollisionPointIn2D(const geometry_msgs::msg::Point &point0, const geometry_msgs::msg::Point &point1, bool search_backward=false, bool denormalize_s=false) const
Definition: hermite_curve.cpp:188
Definition: polynomial_solver.hpp:26
Definition: bounding_box.hpp:32