Commit d26d8282 authored by Jupp Tscheak's avatar Jupp Tscheak
Browse files

Class "SplineSection" can only be used with unit types.



Revised the control strategies that are spline based accordingly.
Signed-off-by: Jupp Tscheak's avatarJupp Tscheak <jupp.tscheak@daimler.com>
parent 2d1a5c16
......@@ -35,6 +35,7 @@ struct SplineSegment
Vec3<T> d;
};
template <typename T, class = typename std::enable_if_t<units::traits::is_unit_t<T>::value>>
struct SplineSection
{
Time start_time{0};
......@@ -45,17 +46,18 @@ struct SplineSection
/// \f[
/// P(x) = \sum_{i=0}^{3} a_{i} x^{i} = a_3 x^3 + a_2 x^2 + a_1 x + a_0
/// \f]
std::array<double, 4> polynomial{0, 0, 0, 0};
std::array<T, 4> polynomial{0, 0, 0, 0};
};
/// @brief Equality comparison for SplineSection.
inline bool operator==(const SplineSection& lhs, const SplineSection& rhs) noexcept
template <typename T, class = typename std::enable_if_t<units::traits::is_unit_t<T>::value>>
inline bool operator==(const SplineSection<T>& lhs, const SplineSection<T>& rhs) noexcept
{
return lhs.start_time == rhs.start_time && lhs.end_time == rhs.end_time &&
std::equal(lhs.polynomial.begin(),
lhs.polynomial.end(),
rhs.polynomial.begin(),
[](const double a, const double b) { return IsEqual(a, b); });
[](const T& a, const T& b) { return IsEqual(a, b); });
}
} // namespace mantle_api
......
......@@ -91,7 +91,7 @@ struct FollowHeadingSplineControlStrategy : public ControlStrategy
type = ControlStrategyType::kFollowHeadingSpline;
}
std::vector<mantle_api::SplineSection> heading_splines;
std::vector<mantle_api::SplineSection<units::angle::radian_t>> heading_splines;
double default_value{0};
};
......@@ -103,7 +103,7 @@ struct FollowVelocitySplineControlStrategy : public ControlStrategy
type = ControlStrategyType::kFollowVelocitySpline;
}
std::vector<mantle_api::SplineSection> velocity_splines;
std::vector<mantle_api::SplineSection<units::velocity::meters_per_second_t>> velocity_splines;
double default_value{0};
};
......@@ -127,7 +127,7 @@ struct FollowLateralOffsetSplineControlStrategy : public ControlStrategy
type = ControlStrategyType::kFollowLateralOffsetSpline;
}
std::vector<mantle_api::SplineSection> lateral_offset_splines;
std::vector<mantle_api::SplineSection<units::length::meter_t>> lateral_offset_splines;
};
// TODO: Create new control strategy for following 3D trajectories with shapes NURBS, polyline, clothoid
......@@ -177,7 +177,7 @@ struct AcquireLaneOffsetControlStrategy : public ControlStrategy
int road_id{};
int lane_id{};
double offset{};
units::length::meter_t offset{};
TransitionDynamics transition_dynamics;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment