Drake
exponential_plus_piecewise_polynomial.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #include <Eigen/Core>
6 
9 
14 template <typename CoefficientType = double>
16  public:
17  typedef Eigen::Matrix<CoefficientType, Eigen::Dynamic, Eigen::Dynamic>
19  typedef Eigen::Matrix<CoefficientType, Eigen::Dynamic, 1> VectorX;
20  typedef Eigen::Matrix<double, Eigen::Dynamic, 1> ValueType;
21 
22  private:
23  MatrixX K_;
24  MatrixX A_;
25  MatrixX alpha_;
26  PiecewisePolynomial<CoefficientType> piecewise_polynomial_part_;
27 
28  public:
30 
31  template <typename DerivedK, typename DerivedA, typename DerivedAlpha>
33  const Eigen::MatrixBase<DerivedK>& K,
34  const Eigen::MatrixBase<DerivedA>& A,
35  const Eigen::MatrixBase<DerivedAlpha>& alpha,
36  const PiecewisePolynomial<CoefficientType>& piecewise_polynomial_part)
37  : PiecewiseFunction(piecewise_polynomial_part),
38  K_(K),
39  A_(A),
40  alpha_(alpha),
41  piecewise_polynomial_part_(piecewise_polynomial_part) {
42  DRAKE_ASSERT(K.rows() == rows());
43  DRAKE_ASSERT(K.cols() == A.rows());
44  DRAKE_ASSERT(A.rows() == A.cols());
45  DRAKE_ASSERT(alpha.rows() == A.cols());
46  DRAKE_ASSERT(alpha.cols() ==
47  piecewise_polynomial_part.getNumberOfSegments());
48  DRAKE_ASSERT(piecewise_polynomial_part.rows() == rows());
49  DRAKE_ASSERT(piecewise_polynomial_part.cols() == 1);
50  }
51 
52  // from PiecewisePolynomial
54  const PiecewisePolynomial<CoefficientType>& piecewise_polynomial_part);
55 
56  // TODO(tkoolen): fix return type (handle complex etc.)
57  ValueType value(double t) const;
58 
59  ExponentialPlusPiecewisePolynomial derivative(int derivative_order = 1) const;
60 
61  Eigen::Index rows() const override;
62 
63  Eigen::Index cols() const override;
64 
65  void shiftRight(double offset);
66 };
int getNumberOfSegments() const
Definition: piecewise_function.cc:33
ExponentialPlusPiecewisePolynomial(const Eigen::MatrixBase< DerivedK > &K, const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedAlpha > &alpha, const PiecewisePolynomial< CoefficientType > &piecewise_polynomial_part)
Definition: exponential_plus_piecewise_polynomial.h:32
Definition: piecewise_function.h:8
Eigen::Matrix< double, Eigen::Dynamic, 1 > ValueType
Definition: exponential_plus_piecewise_polynomial.h:20
Eigen::Matrix< CoefficientType, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Definition: exponential_plus_piecewise_polynomial.h:18
std::vector< snopt::doublereal > A
Definition: snopt_solver.cc:65
Eigen::Matrix< CoefficientType, Eigen::Dynamic, 1 > VectorX
Definition: exponential_plus_piecewise_polynomial.h:19
#define DRAKE_ASSERT(condition)
DRAKE_ASSERT(condition) is similar to the built-in assert(condition) from the C++ system header <cas...
Definition: drake_assert.h:39
y(t) = K * exp(A * (t - t_j)) * alpha.col(j) + piecewise_polynomial_part(t)
Definition: exponential_plus_piecewise_polynomial.h:15
Eigen::Index cols() const override
Definition: piecewise_polynomial.cc:321
Eigen::Index rows() const override
Definition: piecewise_polynomial.cc:312
A scalar multi-variate piecewise polynomial.
Definition: piecewise_polynomial.h:40
Provides Drake&#39;s assertion implementation.
void shiftRight(double offset)
Definition: exponential_plus_piecewise_polynomial.cc:72
Eigen::Index cols() const override
Definition: exponential_plus_piecewise_polynomial.cc:67
ValueType value(double t) const
Definition: exponential_plus_piecewise_polynomial.cc:34
ExponentialPlusPiecewisePolynomial()
Definition: exponential_plus_piecewise_polynomial.cc:14
ExponentialPlusPiecewisePolynomial derivative(int derivative_order=1) const
Definition: exponential_plus_piecewise_polynomial.cc:47
Eigen::Index rows() const override
Definition: exponential_plus_piecewise_polynomial.cc:62