Drake
random_piecewise_polynomial.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #include <Eigen/Core>
6 
9 
10 namespace drake {
11 namespace test {
12 
17 template <typename CoefficientType = double>
19  Eigen::Index rows, Eigen::Index cols,
20  Eigen::Index num_coefficients_per_polynomial,
21  const std::vector<double>& segment_times) {
22  Eigen::Index num_segments =
23  static_cast<Eigen::Index>(segment_times.size() - 1);
24  typedef Polynomial<CoefficientType> PolynomialType;
25  typedef Eigen::Matrix<PolynomialType, Eigen::Dynamic, Eigen::Dynamic>
26  PolynomialMatrix;
27  std::vector<PolynomialMatrix> polynomials;
28  for (Eigen::Index segment_index = 0; segment_index < num_segments;
29  ++segment_index) {
30  polynomials.push_back(
31  drake::test::RandomPolynomialMatrix<CoefficientType>(
32  num_coefficients_per_polynomial, rows, cols));
33  }
34  return PiecewisePolynomial<CoefficientType>(polynomials, segment_times);
35 }
36 
37 } // namespace test
38 } // namespace drake
Definition: automotive_demo.cc:88
A scalar multi-variate piecewise polynomial.
Definition: piecewise_polynomial.h:40
PiecewisePolynomial< CoefficientType > MakeRandomPiecewisePolynomial(Eigen::Index rows, Eigen::Index cols, Eigen::Index num_coefficients_per_polynomial, const std::vector< double > &segment_times)
Obtains a random PiecewisePolynomial with the given segment_times.
Definition: random_piecewise_polynomial.h:18