Template Class Polynomial

Class Documentation

template<int _N, class ScalarT = double>
class mav_planning_utils::Polynomial

Public Types

typedef ScalarT Scalar
typedef Eigen::Matrix<Scalar, 1, N> VectorR
typedef Eigen::Matrix<Scalar, N, 1> VectorV
typedef Eigen::Matrix<Scalar, N, N> MatrixSq

Public Functions

inline Polynomial()
template<class Derived>
inline Polynomial(const Eigen::MatrixBase<Derived> &coeffs)
template<class Derived>
inline void setCoefficients(const Eigen::MatrixBase<Derived> &coeffs)

sets up the internal representation from coeffs coefficients are stored in increasing order with the power of t, i.e.

c1 + c2*t + c3*t^2 ==> coeffs = [c1 c2 c3]

inline VectorR getCoefficients(int derivative = 0)
template<class Derived>
inline void evaluate(const Eigen::MatrixBase<Derived> &result, Scalar t) const

evaluates the polynomial at time t and writes the result to result

inline void evaluate(Scalar &result, Scalar t, int derivative) const

evaluates the specified derivative of the polynomial at time t and writes the result to result

inline Scalar evaluate(Scalar t, int derivative) const

evaluates the specified derivative of the polynomial at time t and returns the result

template<int max_deg>
inline Eigen::Matrix<Scalar, max_deg, 1> evaluate(Scalar t) const

evaluates the polynomial at time t and returns the result

template<int max_deg, int n_samples>
inline void evaluate(const Eigen::Matrix<Scalar, 1, n_samples> &t, Eigen::Matrix<Scalar, max_deg, n_samples> result) const

evaluates the polynomial at times in t and writes the result for each time into the corresponding column of result

Public Members

VectorR coefficients

Public Static Functions

template<class Derived>
static inline void quadraticCostJacobian(const Eigen::MatrixBase<Derived> &C, Scalar t, int derivative)

Computes the jacobian of the integral over the squared derivative.

Parameters
  • [out] C: jacobian to write into, can be any fixed-size block expression

  • [in] t: time of evaluation

  • [in] derivative: used to compute the cost

static inline MatrixSq quadraticCostJacobian(Scalar t, int derivative)

convenience method to compute the jacobin of the quadratic cost

See

static void quadraticCostJacobian(const Eigen::MatrixBase<Derived> & C, Scalar t, int derivative)

template<class Derived>
static inline void baseCoeffsWithTime(const Eigen::MatrixBase<Derived> &coeffs, int derivative, Scalar t)

Computes the base coefficients with the according powers of t, as e.g.

needed for computation of (in)equality constraints

Parameters
  • [out] coeffs: vector to write the coefficients to

  • [in] derivative: of the polynomial for which the coefficients have to be computed

  • [in] t: time of evaluation

static inline Eigen::Matrix<Scalar, 1, N> baseCoeffsWithTime(int derivative, Scalar t)

Convenience method to compute the base coefficents with time.

See

static void baseCoeffsWithTime(const Eigen::MatrixBase<Derived> & coeffs, int derivative, Scalar t)

Public Static Attributes

static const int N = _N
static const int DEG = N - 1
static MatrixSq base_coefficients_ = computeBaseCoefficients<N, Scalar>()