Template Class QuinticSplineProfileGenerator#

Inheritance Relationships#

Base Type#

Class Documentation#

template<typename T>
class QuinticSplineProfileGenerator : public Karana::Models::ProfileGenerator<T>#

A simple quintic spline profile generator.

This does quintic interpolation between (t_i,q_i,u_i,udot_i) and (t_f,q_f,u_f,udot_f). It uses a Hermite polynomial to match position, velocity, and acceleration at both knot points. Times provided outside the given range, less than t_i or greater than t_f, will yield q_i and q_f, respectively.

For elapsed time \(\tau=t-t_i\), the profile is \(q(\tau)=c_0+c_1\tau+c_2\tau^2+c_3\tau^3+c_4\tau^4+c_5\tau^5\). Its six coefficients uniquely satisfy coordinate, velocity, and acceleration at both endpoints.

Template Parameters:

T – The type of object to generate a profile for.

Public Functions

inline QuinticSplineProfileGenerator(std::string_view name, const Karana::Math::Ktime &t_i, const T &q_i, const T &u_i, const T &udot_i, const Karana::Math::Ktime &t_f, const T &q_f, const T &u_f, const T &udot_f)#

QuinticSplineProfileGenerator constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.

Parameters:
  • name – The name of the QuinticSplineProfileGenerator.

  • t_i – Time associated with q_i

  • q_i – The starting coordinate

  • u_i – The starting velocity

  • udot_i – The starting acceleration

  • t_f – Time associated with q_f; must be later than t_i

  • q_f – The ending coordinate

  • u_f – The ending velocity

  • udot_f – The ending acceleration

inline virtual const T &getQ(const Karana::Math::Ktime &t) override#

Get the profile coordinate for the provided time.

Parameters:

t – The current time

Returns:

The profile coordinate at the provided time.

inline virtual const T &getU(const Karana::Math::Ktime &t) override#

Get the profile velocity for the provided time.

Parameters:

t – The current time

Returns:

The profile velocity at the provided time.

inline virtual const T &getUdot(const Karana::Math::Ktime &t) override#

Get the profile acceleration for the provided time.

Parameters:

t – The current time

Returns:

The profile acceleration at the provided time.

inline virtual bool isReady() const override#

Indicate whether this QuinticSplineProfileGenerator is ready for simulation.

Returns:

true if it is ready, false otherwise.

inline void setValues(const Karana::Math::Ktime &t_i, const T &q_i, const T &u_i, const T &udot_i, const Karana::Math::Ktime &t_f, const T &q_f, const T &u_f, const T &udot_f)#

Set the starting/ending coordinates and calculate constants.

Parameters:
  • t_i – Time associated with q_i.

  • q_i – The starting coordinate.

  • u_i – The starting velocity.

  • udot_i – The starting acceleration.

  • t_f – Time associated with q_f; must be later than t_i.

  • q_f – The ending coordinate.

  • u_f – The ending velocity.

  • udot_f – The ending acceleration.

Throws:

std::invalid_argument – if the time interval is empty or reversed, or vector constraints have inconsistent sizes.

inline std::tuple<Karana::Math::Ktime, T, T, T, Karana::Math::Ktime, T, T, T> getValues() const#

Return the endpoint constraints used to construct this quintic profile.

Returns:

A tuple containing initial time, coordinate, velocity, and acceleration, then final time, coordinate, velocity, and acceleration.

Public Static Functions

static inline Karana::Core::ks_ptr<QuinticSplineProfileGenerator> create(std::string_view name, const Karana::Math::Ktime &t_i, const T &q_i, const T &u_i, const T &udot_i, const Karana::Math::Ktime &t_f, const T &q_f, const T &u_f, const T &udot_f)#

QuinticSplineProfileGenerator constructor.

Parameters:
  • name – The name of the QuinticSplineProfileGenerator.

  • t_i – Time associated with q_i

  • q_i – The starting coordinate

  • u_i – The starting velocity

  • udot_i – The starting acceleration

  • t_f – Time associated with q_f; must be later than t_i

  • q_f – The ending coordinate

  • u_f – The ending velocity

  • udot_f – The ending acceleration

Returns:

A pointer to the newly created instance of QuinticSplineProfileGenerator.

Protected Functions

inline T _init_ddv(const T &value)#

Initialize the ddv value with zero of the appropriate type.

Parameters:

value – The value to use as a template to set zeros for.

Returns:

A value of type T that is zero.

Protected Attributes

T _q#

Represents the current coordinate.

T _udot#

Second derivative of the current acceleration.

Karana::Math::Ktime _t_i#

Time associated with _q_i.

T _q_i#

The starting coordinate.

T _u_i#

The starting velocity.

T _udot_i#

The starting acceleration.

Karana::Math::Ktime _t_f#

Time associated with _q_f.

T _q_f#

The ending coordinate.

T _u_f#

The ending velocity.

T _udot_f#

The ending acceleration.