Skip to content

Commit e9500ba

Browse files
authored
Merge branch 'main' into refactor/pure_pursuit
2 parents c5e6655 + 8f79195 commit e9500ba

File tree

260 files changed

+7809
-6561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+7809
-6561
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ localization/autoware_twist2accel/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier
9494
localization/ekf_localizer/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp takamasa.horibe@tier4.jp takeshi.ishita@tier4.jp yamato.ando@tier4.jp
9595
localization/localization_util/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp
9696
localization/ndt_scan_matcher/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp
97-
localization/pose_initializer/** anh.nguyen.2@tier4.jp isamu.takagi@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp
97+
localization/autoware_pose_initializer/** anh.nguyen.2@tier4.jp isamu.takagi@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp
9898
localization/yabloc/yabloc_common/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp
9999
localization/yabloc/yabloc_image_processing/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp
100100
localization/yabloc/yabloc_monitor/** anh.nguyen.2@tier4.jp kento.yabuuchi.2@tier4.jp masahiro.sakamoto@tier4.jp ryu.yamamoto@tier4.jp shintaro.sakoda@tier4.jp taiki.yamada@tier4.jp yamato.ando@tier4.jp

.github/workflows/cppcheck-daily.yaml .github/workflows/cppcheck-weekly.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: cppcheck-daily
1+
name: cppcheck-weekly
22

33
on:
44
schedule:
5-
- cron: 0 0 * * *
5+
- cron: 0 0 * * 1
66
workflow_dispatch:
77

88
jobs:
9-
cppcheck-daily:
9+
cppcheck-weekly:
1010
runs-on: ubuntu-latest
1111

1212
steps:

common/autoware_motion_utils/README.md

-13
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,6 @@ const size_t traffic_obj_nearest_idx = findNearestIndexFromLaneId(path_with_lane
9797
const size_t traffic_obj_nearest_seg_idx = findNearestSegmentIndexFromLaneId(path_with_lane_id, traffic_obj_pos, lane_id);
9898
```
9999

100-
## Path/Trajectory length calculation between designated points
101-
102-
Based on the discussion so far, the nearest index search algorithm is different depending on the object type.
103-
Therefore, we recommended using the wrapper utility functions which require the nearest index search (e.g., calculating the path length) with each nearest index search.
104-
105-
For example, when we want to calculate the path length between the ego and the dynamic object, the implementation is as follows.
106-
107-
```cpp
108-
const size_t ego_nearest_seg_idx = findFirstNearestSegmentIndex(points, ego_pose, ego_nearest_dist_threshold, ego_nearest_yaw_threshold);
109-
const size_t dyn_obj_nearest_seg_idx = findFirstNearestSegmentIndex(points, dyn_obj_pose, dyn_obj_nearest_dist_threshold);
110-
const double length_from_ego_to_obj = calcSignedArcLength(points, ego_pose, ego_nearest_seg_idx, dyn_obj_pose, dyn_obj_nearest_seg_idx);
111-
```
112-
113100
## For developers
114101

115102
Some of the template functions in `trajectory.hpp` are mostly used for specific types (`autoware_planning_msgs::msg::PathPoint`, `autoware_planning_msgs::msg::PathPoint`, `autoware_planning_msgs::msg::TrajectoryPoint`), so they are exported as `extern template` functions to speed-up compilation time.

common/autoware_motion_utils/include/autoware/motion_utils/trajectory_container/interpolator/akima_spline.hpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <Eigen/Dense>
2121

22+
#include <memory>
2223
#include <vector>
2324

2425
namespace autoware::motion_utils::trajectory_container::interpolator
@@ -31,14 +32,9 @@ namespace autoware::motion_utils::trajectory_container::interpolator
3132
*/
3233
class AkimaSpline : public Interpolator<double>
3334
{
34-
template <typename InterpolatorType>
35-
friend class InterpolatorCreator;
36-
3735
private:
3836
Eigen::VectorXd a_, b_, c_, d_; ///< Coefficients for the Akima spline.
3937

40-
AkimaSpline() = default;
41-
4238
/**
4339
* @brief Compute the spline parameters.
4440
*
@@ -85,12 +81,21 @@ class AkimaSpline : public Interpolator<double>
8581
[[nodiscard]] double compute_second_derivative_impl(const double & s) const override;
8682

8783
public:
84+
AkimaSpline() = default;
85+
8886
/**
8987
* @brief Get the minimum number of required points for the interpolator.
9088
*
9189
* @return The minimum number of required points.
9290
*/
9391
[[nodiscard]] size_t minimum_required_points() const override { return 5; }
92+
93+
/**
94+
* @brief Clone the interpolator.
95+
*
96+
* @return A shared pointer to a new instance of the interpolator.
97+
*/
98+
[[nodiscard]] std::shared_ptr<Interpolator<double>> clone() const override;
9499
};
95100

96101
} // namespace autoware::motion_utils::trajectory_container::interpolator

common/autoware_motion_utils/include/autoware/motion_utils/trajectory_container/interpolator/cubic_spline.hpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,10 @@ namespace autoware::motion_utils::trajectory_container::interpolator
3131
*/
3232
class CubicSpline : public Interpolator<double>
3333
{
34-
template <typename InterpolatorType>
35-
friend class InterpolatorCreator;
36-
3734
private:
3835
Eigen::VectorXd a_, b_, c_, d_; ///< Coefficients for the cubic spline.
3936
Eigen::VectorXd h_; ///< Interval sizes between axis points.
4037

41-
CubicSpline() = default;
42-
4338
/**
4439
* @brief Compute the spline parameters.
4540
*
@@ -87,12 +82,21 @@ class CubicSpline : public Interpolator<double>
8782
[[nodiscard]] double compute_second_derivative_impl(const double & s) const override;
8883

8984
public:
85+
CubicSpline() = default;
86+
9087
/**
9188
* @brief Get the minimum number of required points for the interpolator.
9289
*
9390
* @return The minimum number of required points.
9491
*/
9592
[[nodiscard]] size_t minimum_required_points() const override { return 4; }
93+
94+
/**
95+
* @brief Clone the interpolator.
96+
*
97+
* @return A shared pointer to a new instance of the interpolator.
98+
*/
99+
[[nodiscard]] std::shared_ptr<Interpolator<double>> clone() const override;
96100
};
97101

98102
} // namespace autoware::motion_utils::trajectory_container::interpolator

common/autoware_motion_utils/include/autoware/motion_utils/trajectory_container/interpolator/interpolator.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "autoware/motion_utils/trajectory_container/interpolator/detail/interpolator_common_impl.hpp"
1919

20+
#include <memory>
21+
2022
namespace autoware::motion_utils::trajectory_container::interpolator
2123
{
2224
/**
@@ -29,6 +31,8 @@ namespace autoware::motion_utils::trajectory_container::interpolator
2931
template <typename T>
3032
class Interpolator : public detail::InterpolatorCommonImpl<T>
3133
{
34+
public:
35+
[[nodiscard]] virtual std::shared_ptr<Interpolator<T>> clone() const = 0;
3236
};
3337

3438
/**
@@ -84,6 +88,8 @@ class Interpolator<double> : public detail::InterpolatorCommonImpl<double>
8488
this->validate_compute_input(s);
8589
return compute_second_derivative_impl(s);
8690
}
91+
92+
[[nodiscard]] virtual std::shared_ptr<Interpolator<double>> clone() const = 0;
8793
};
8894

8995
} // namespace autoware::motion_utils::trajectory_container::interpolator

common/autoware_motion_utils/include/autoware/motion_utils/trajectory_container/interpolator/linear.hpp

+13-8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <Eigen/Dense>
2121

22+
#include <memory>
2223
#include <vector>
2324

2425
namespace autoware::motion_utils::trajectory_container::interpolator
@@ -31,17 +32,9 @@ namespace autoware::motion_utils::trajectory_container::interpolator
3132
*/
3233
class Linear : public Interpolator<double>
3334
{
34-
template <typename InterpolatorType>
35-
friend class InterpolatorCreator;
36-
3735
private:
3836
Eigen::VectorXd values_; ///< Interpolation values.
3937

40-
/**
41-
* @brief Default constructor.
42-
*/
43-
Linear() = default;
44-
4538
/**
4639
* @brief Build the interpolator with the given values.
4740
*
@@ -77,12 +70,24 @@ class Linear : public Interpolator<double>
7770
[[nodiscard]] double compute_second_derivative_impl(const double &) const override;
7871

7972
public:
73+
/**
74+
* @brief Default constructor.
75+
*/
76+
Linear() = default;
77+
8078
/**
8179
* @brief Get the minimum number of required points for the interpolator.
8280
*
8381
* @return The minimum number of required points.
8482
*/
8583
[[nodiscard]] size_t minimum_required_points() const override;
84+
85+
/**
86+
* @brief Clone the interpolator.
87+
*
88+
* @return A shared pointer to the cloned interpolator.
89+
*/
90+
[[nodiscard]] std::shared_ptr<Interpolator<double>> clone() const override;
8691
};
8792

8893
} // namespace autoware::motion_utils::trajectory_container::interpolator

common/autoware_motion_utils/include/autoware/motion_utils/trajectory_container/interpolator/nearest_neighbor.hpp

+26-9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "autoware/motion_utils/trajectory_container/interpolator/detail/nearest_neighbor_common_impl.hpp"
1919

20+
#include <memory>
21+
2022
namespace autoware::motion_utils::trajectory_container::interpolator
2123
{
2224

@@ -40,11 +42,18 @@ class NearestNeighbor;
4042
template <typename T>
4143
class NearestNeighbor : public detail::NearestNeighborCommonImpl<T>
4244
{
43-
template <typename InterpolatorType>
44-
friend class InterpolatorCreator;
45-
46-
private:
45+
public:
4746
NearestNeighbor() = default;
47+
48+
/**
49+
* @brief Clone the interpolator.
50+
*
51+
* @return A shared pointer to a new instance of the interpolator.
52+
*/
53+
[[nodiscard]] std::shared_ptr<Interpolator<double>> clone() const override
54+
{
55+
return std::make_shared<NearestNeighbor<T>>(*this);
56+
}
4857
};
4958

5059
/**
@@ -55,12 +64,7 @@ class NearestNeighbor : public detail::NearestNeighborCommonImpl<T>
5564
template <>
5665
class NearestNeighbor<double> : public detail::NearestNeighborCommonImpl<double>
5766
{
58-
template <typename InterpolatorType>
59-
friend class InterpolatorCreator;
60-
6167
private:
62-
NearestNeighbor() = default;
63-
6468
/**
6569
* @brief Compute the first derivative at the given point.
6670
*
@@ -76,6 +80,19 @@ class NearestNeighbor<double> : public detail::NearestNeighborCommonImpl<double>
7680
* @return The second derivative.
7781
*/
7882
[[nodiscard]] double compute_second_derivative_impl(const double &) const override { return 0.0; }
83+
84+
public:
85+
NearestNeighbor() = default;
86+
87+
/**
88+
* @brief Clone the interpolator.
89+
*
90+
* @return A shared pointer to a new instance of the interpolator.
91+
*/
92+
[[nodiscard]] std::shared_ptr<Interpolator<double>> clone() const override
93+
{
94+
return std::make_shared<NearestNeighbor<double>>(*this);
95+
}
7996
};
8097

8198
} // namespace autoware::motion_utils::trajectory_container::interpolator

common/autoware_motion_utils/include/autoware/motion_utils/trajectory_container/interpolator/stairstep.hpp

+26-8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "autoware/motion_utils/trajectory_container/interpolator/detail/stairstep_common_impl.hpp"
1919

20+
#include <memory>
21+
2022
namespace autoware::motion_utils::trajectory_container::interpolator
2123
{
2224

@@ -40,11 +42,18 @@ class Stairstep;
4042
template <typename T>
4143
class Stairstep : public detail::StairstepCommonImpl<T>
4244
{
43-
template <typename InterpolatorType>
44-
friend class InterpolatorCreator;
45-
46-
private:
45+
public:
4746
Stairstep() = default;
47+
48+
/**
49+
* @brief Clone the interpolator.
50+
*
51+
* @return A shared pointer to a new instance of the interpolator.
52+
*/
53+
[[nodiscard]] std::shared_ptr<Interpolator<T>> clone() const override
54+
{
55+
return std::make_shared<Stairstep<T>>(*this);
56+
}
4857
};
4958

5059
/**
@@ -55,11 +64,7 @@ class Stairstep : public detail::StairstepCommonImpl<T>
5564
template <>
5665
class Stairstep<double> : public detail::StairstepCommonImpl<double>
5766
{
58-
template <typename InterpolatorType>
59-
friend class InterpolatorCreator;
60-
6167
private:
62-
Stairstep() = default;
6368
/**
6469
* @brief Compute the first derivative at the given point.
6570
*
@@ -75,6 +80,19 @@ class Stairstep<double> : public detail::StairstepCommonImpl<double>
7580
* @return The second derivative.
7681
*/
7782
[[nodiscard]] double compute_second_derivative_impl(const double &) const override { return 0.0; }
83+
84+
public:
85+
Stairstep() = default;
86+
87+
/**
88+
* @brief Clone the interpolator.
89+
*
90+
* @return A shared pointer to a new instance of the interpolator.
91+
*/
92+
[[nodiscard]] std::shared_ptr<Interpolator<double>> clone() const override
93+
{
94+
return std::make_shared<Stairstep<double>>(*this);
95+
}
7896
};
7997

8098
} // namespace autoware::motion_utils::trajectory_container::interpolator

common/autoware_motion_utils/src/trajectory_container/interpolator/akima_spline.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <Eigen/Dense>
1818

1919
#include <cmath>
20+
#include <memory>
2021
#include <vector>
2122

2223
namespace autoware::motion_utils::trajectory_container::interpolator
@@ -90,4 +91,9 @@ double AkimaSpline::compute_second_derivative_impl(const double & s) const
9091
return 2 * c_[i] + 6 * d_[i] * dx;
9192
}
9293

94+
std::shared_ptr<Interpolator<double>> AkimaSpline::clone() const
95+
{
96+
return std::make_shared<AkimaSpline>(*this);
97+
}
98+
9399
} // namespace autoware::motion_utils::trajectory_container::interpolator

common/autoware_motion_utils/src/trajectory_container/interpolator/cubic_spline.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,9 @@ double CubicSpline::compute_second_derivative_impl(const double & s) const
9191
return 2 * c_(i) + 6 * d_(i) * dx;
9292
}
9393

94+
std::shared_ptr<Interpolator<double>> CubicSpline::clone() const
95+
{
96+
return std::make_shared<CubicSpline>(*this);
97+
}
98+
9499
} // namespace autoware::motion_utils::trajectory_container::interpolator

common/autoware_motion_utils/src/trajectory_container/interpolator/linear.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <Eigen/Dense>
1818

19+
#include <memory>
1920
#include <vector>
2021

2122
namespace autoware::motion_utils::trajectory_container::interpolator
@@ -59,4 +60,9 @@ size_t Linear::minimum_required_points() const
5960
return 2;
6061
}
6162

63+
std::shared_ptr<Interpolator<double>> Linear::clone() const
64+
{
65+
return std::make_shared<Linear>(*this);
66+
}
67+
6268
} // namespace autoware::motion_utils::trajectory_container::interpolator

0 commit comments

Comments
 (0)