Template Class CubicSplineProfileGenerator#

Inheritance Relationships#

Base Type#

Class Documentation#

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

A simple cubic spline profile generator.

This does cubic interpolation between (t_i,q_i,u_i) and (t_f,q_f,u_f). Times provided outside the given range, less than t_i or greater than t_f, will yield q_i and q_f, respectively.

Template Parameters:

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

Public Functions

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

CubicSplineProfileGenerator 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 CubicSplineProfileGenerator.

  • t_i – Time associated with q_i

  • q_i – The starting coordinate

  • u_i – The starting velocity

  • t_f – Time associated with q_f

  • q_f – The ending coordinate

  • u_f – The ending velocity

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 CubicSplineProfileGenerator 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 Karana::Math::Ktime &t_f, const T &q_f, const T &u_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.

  • t_f – Time associated with q_f.

  • q_f – The ending coordinate.

  • u_f – The ending velocity.

Public Static Functions

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

CubicSplineProfileGenerator constructor.

Parameters:
  • name – The name of the CubicSplineProfileGenerator.

  • t_i – Time associated with q_i

  • q_i – The starting coordinate

  • u_i – The starting velocity

  • t_f – Time associated with q_f

  • q_f – The ending coordinate

  • u_f – The ending velocity

Returns:

A pointer to the newly created instance of CubicSplineProfileGenerator.

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 _u#

Derivative of the current velocity.

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.

Karana::Math::Ktime _t_f#

Time associated with _q_f.

T _q_f#

The ending coordinate.

T _u_f#

The ending velocity.