51 const std::size_t n = waypoints.size();
55 for (std::size_t dim = 0; dim < D; dim++) {
57 m_accs[dim].resize(n);
59 for (std::size_t i = 0; i < n; i++) {
60 m_ts[i] = waypoints[i].getTime();
61 m_ys[dim][i] = waypoints[i].getPos()[dim];
64 const double yp1 = waypoints[0].getVel()[dim];
65 const double ypn = waypoints[n - 1].getVel()[dim];
67 spline(m_ts.data(), m_ys[dim].data(),
static_cast<int>(n), yp1, ypn,
76 : m_ts{other.m_ts}, m_ys{other.m_ys}, m_accs{other.m_accs} {}
89 m_accs = other.m_accs;
107 const std::size_t n = m_ts.size();
111 for (std::size_t dim = 0; dim < D; dim++) {
114 static_cast<int>(n), t, &output);
129 const std::size_t n = m_ts.size();
133 for (std::size_t dim = 0; dim < D; dim++) {
136 static_cast<int>(n), t, &output);
151 const std::size_t n = m_ts.size();
155 for (std::size_t dim = 0; dim < D; dim++) {
158 static_cast<int>(n), t, &output);
166 std::vector<double> m_ts;
167 std::array<std::vector<double>, D> m_ys;
168 std::array<std::vector<double>, D> m_accs;
bool splacc(const double xa[], const double ya[], const double y2a[], const int n, const double x, double *y)
Calculates acceleration of spline.
Definition: cubic_impl.hpp:167
bool splvel(const double xa[], const double ya[], const double y2a[], const int n, const double x, double *y)
Calculates velocity of spline.
Definition: cubic_impl.hpp:122
void spline(const double t[], const double y[], const int n, const double yp1, const double ypn, double y2[])
Calculates second derivatives at tabulated points.
Definition: cubic_impl.hpp:25
bool splpos(const double xa[], const double ya[], const double y2a[], const int n, const double x, double *y)
Calculates position of spline.
Definition: cubic_impl.hpp:78
Spline vector calculator.
Definition: cubic_vec.hpp:25
CubicVec< D > & operator=(const CubicVec< D > &other)
Assignment operator.
Definition: cubic_vec.hpp:81
Vector< D > splacc(const double t) const
Definition: cubic_vec.hpp:150
CubicVec(const std::vector< Pose< D >> &waypoints)
Constructor.
Definition: cubic_vec.hpp:50
~CubicVec()=default
Destructor.
Vector< D > splvel(const double t) const
Definition: cubic_vec.hpp:128
CubicVec()=default
Default constructor.
CubicVec(const CubicVec< D > &other)
Copy constructor.
Definition: cubic_vec.hpp:75
Vector< D > splpos(const double t) const
Definition: cubic_vec.hpp:106
A pose object.
Definition: pose.hpp:23
A base vector representation.
Definition: simplevectors.hpp:63