Drake
|
A scalar multi-variate piecewise polynomial. More...
#include <drake/systems/trajectories/PiecewisePolynomial.h>
Public Types | |
typedef Polynomial< CoefficientType > | PolynomialType |
typedef Eigen::Matrix< PolynomialType, Eigen::Dynamic, Eigen::Dynamic > | PolynomialMatrix |
typedef Eigen::Matrix< CoefficientType, Eigen::Dynamic, Eigen::Dynamic > | CoefficientMatrix |
typedef Eigen::Ref< CoefficientMatrix > | CoefficientMatrixRef |
Public Member Functions | |
virtual | ~PiecewisePolynomial () |
PiecewisePolynomial () | |
template<typename Derived > | |
PiecewisePolynomial (const Eigen::MatrixBase< Derived > &value) | |
PiecewisePolynomial (std::vector< PolynomialMatrix > const &polynomials, std::vector< double > const &segment_times) | |
PiecewisePolynomial (std::vector< PolynomialType > const &polynomials, std::vector< double > const &segment_times) | |
PiecewisePolynomial | derivative (int derivative_order=1) const |
Takes the derivative of this PiecewisePolynomial. More... | |
PiecewisePolynomial | integral (double value_at_start_time=0.0) const |
Takes the integral of this PiecewisePolynomial. More... | |
PiecewisePolynomial | integral (const CoefficientMatrixRef &value_at_start_time) const |
Takes the integral of this PiecewisePolynomial. More... | |
double | scalarValue (double t, Eigen::Index row=0, Eigen::Index col=0) |
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > | value (double t) const |
const PolynomialMatrix & | getPolynomialMatrix (int segment_index) const |
const PolynomialType & | getPolynomial (int segment_index, Eigen::Index row=0, Eigen::Index col=0) const |
virtual int | getSegmentPolynomialDegree (int segment_index, Eigen::Index row=0, Eigen::Index col=0) const |
virtual Eigen::Index | rows () const |
virtual Eigen::Index | cols () const |
PiecewisePolynomial & | operator+= (const PiecewisePolynomial &other) |
PiecewisePolynomial & | operator-= (const PiecewisePolynomial &other) |
PiecewisePolynomial & | operator*= (const PiecewisePolynomial &other) |
PiecewisePolynomial & | operator+= (const CoefficientMatrix &offset) |
PiecewisePolynomial & | operator-= (const CoefficientMatrix &offset) |
const PiecewisePolynomial | operator+ (const PiecewisePolynomial &other) const |
const PiecewisePolynomial | operator- (const PiecewisePolynomial &other) const |
const PiecewisePolynomial | operator* (const PiecewisePolynomial &other) const |
const PiecewisePolynomial | operator+ (const CoefficientMatrix &offset) const |
const PiecewisePolynomial | operator- (const CoefficientMatrix &offset) const |
bool | isApprox (const PiecewisePolynomial &other, double tol) const |
Checks if a PiecewisePolynomial is approximately equal to this one. More... | |
void | shiftRight (double offset) |
void | setPolynomialMatrixBlock (const PolynomialMatrix &replacement, int segment_number, Eigen::Index row_start=0, Eigen::Index col_start=0) |
PiecewisePolynomial | slice (int start_segment_index, int num_segments) |
Public Member Functions inherited from PiecewisePolynomialBase | |
PiecewisePolynomialBase (std::vector< double > const &segment_times) | |
virtual | ~PiecewisePolynomialBase () |
int | getNumberOfCoefficients (int segment_number, Eigen::Index row=0, Eigen::Index col=0) const |
int | getTotalNumberOfCoefficients (Eigen::Index row=0, Eigen::Index col=0) const |
Public Member Functions inherited from PiecewiseFunction | |
PiecewiseFunction (std::vector< double > const &segment_times) | |
virtual | ~PiecewiseFunction () |
int | getNumberOfSegments () const |
double | getStartTime (int segment_number) const |
double | getEndTime (int segment_number) const |
double | getDuration (int segment_number) const |
double | getStartTime () const |
double | getEndTime () const |
int | getSegmentIndex (double t) const |
const std::vector< double > & | getSegmentTimes () const |
void | segmentNumberRangeCheck (int segment_number) const |
Static Public Member Functions | |
static PiecewisePolynomial | random (Eigen::Index rows, Eigen::Index cols, Eigen::Index num_coefficients_per_polynomial, const std::vector< double > &segment_times) |
Obtains a random PiecewisePolynomial of the specified size. More... | |
Static Public Member Functions inherited from PiecewiseFunction | |
static std::vector< double > | randomSegmentTimes (int num_segments, std::default_random_engine &generator) |
Protected Member Functions | |
double | segmentValueAtGlobalAbscissa (int segment_index, double t, Eigen::Index row, Eigen::Index col) const |
Protected Member Functions inherited from PiecewisePolynomialBase | |
PiecewisePolynomialBase () | |
Protected Member Functions inherited from PiecewiseFunction | |
bool | segmentTimesEqual (const PiecewiseFunction &b, double tol) const |
void | checkScalarValued () const |
PiecewiseFunction () | |
Additional Inherited Members | |
Protected Attributes inherited from PiecewiseFunction | |
std::vector< double > | segment_times |
A scalar multi-variate piecewise polynomial.
PiecewisePolynomial represents a list of contiguous segments in time with a Polynomial defined for each segment.
An example of a piecewise function is the absolute value function:
PiecewisePolynomials can be added, subtracted, and multiplied. They cannot be divided because Polynomials are not closed under division.
typedef Eigen::Matrix<CoefficientType, Eigen::Dynamic, Eigen::Dynamic> CoefficientMatrix |
typedef Eigen::Ref<CoefficientMatrix> CoefficientMatrixRef |
typedef Eigen::Matrix<PolynomialType, Eigen::Dynamic, Eigen::Dynamic> PolynomialMatrix |
typedef Polynomial<CoefficientType> PolynomialType |
|
inlinevirtual |
|
inlineexplicit |
PiecewisePolynomial | ( | std::vector< PolynomialMatrix > const & | polynomials, |
std::vector< double > const & | segment_times | ||
) |
PiecewisePolynomial | ( | std::vector< PolynomialType > const & | polynomials, |
std::vector< double > const & | segment_times | ||
) |
|
virtual |
PiecewisePolynomial< CoefficientType > derivative | ( | int | derivative_order = 1 | ) | const |
Takes the derivative of this PiecewisePolynomial.
Returns a PiecewisePolynomial where each segment is the derivative of the segment in the input PiecewisePolynomial. Any rules or limitations of Polynomial::derivative also apply to this function.
If derivative_order
is given, takes the nth derivative of this PiecewisePolynomial.
const Polynomial< CoefficientType > & getPolynomial | ( | int | segment_index, |
Eigen::Index | row = 0 , |
||
Eigen::Index | col = 0 |
||
) | const |
const PiecewisePolynomial< CoefficientType >::PolynomialMatrix & getPolynomialMatrix | ( | int | segment_index | ) | const |
|
virtual |
Implements PiecewisePolynomialBase.
PiecewisePolynomial< CoefficientType > integral | ( | double | value_at_start_time = 0.0 | ) | const |
Takes the integral of this PiecewisePolynomial.
Returns a PiecewisePolynomial that is the indefinite integral of this one. Any rules or limitations of Polynomial::integral also apply to this function.
If value_at_start_time
is given, it does the following only for the first segment: adds that constant as the constant term (zeroth-order coefficient) of the resulting Polynomial.
PiecewisePolynomial integral | ( | const CoefficientMatrixRef & | value_at_start_time | ) | const |
Takes the integral of this PiecewisePolynomial.
Returns a PiecewisePolynomial that is the indefinite integral of this one. Any rules or limitations of Polynomial::integral also apply to this function.
If value_at_start_time
is given, it does the following only for the first segment: adds value_at_start_time(row,col) as the constant term (zeroth-order coefficient) of the resulting Polynomial.
bool isApprox | ( | const PiecewisePolynomial< CoefficientType > & | other, |
double | tol | ||
) | const |
Checks if a PiecewisePolynomial is approximately equal to this one.
Checks that every coefficient of other
is within tol
of the corresponding coefficient of this PiecewisePolynomial. Throws an exception if any Polynomial in either PiecewisePolynomial is not univariate.
const PiecewisePolynomial< CoefficientType > operator* | ( | const PiecewisePolynomial< CoefficientType > & | other | ) | const |
PiecewisePolynomial< CoefficientType > & operator*= | ( | const PiecewisePolynomial< CoefficientType > & | other | ) |
const PiecewisePolynomial< CoefficientType > operator+ | ( | const PiecewisePolynomial< CoefficientType > & | other | ) | const |
const PiecewisePolynomial operator+ | ( | const CoefficientMatrix & | offset | ) | const |
PiecewisePolynomial< CoefficientType > & operator+= | ( | const PiecewisePolynomial< CoefficientType > & | other | ) |
PiecewisePolynomial& operator+= | ( | const CoefficientMatrix & | offset | ) |
const PiecewisePolynomial< CoefficientType > operator- | ( | const PiecewisePolynomial< CoefficientType > & | other | ) | const |
const PiecewisePolynomial operator- | ( | const CoefficientMatrix & | offset | ) | const |
PiecewisePolynomial< CoefficientType > & operator-= | ( | const PiecewisePolynomial< CoefficientType > & | other | ) |
PiecewisePolynomial& operator-= | ( | const CoefficientMatrix & | offset | ) |
|
static |
Obtains a random PiecewisePolynomial of the specified size.
Obtains a PiecewisePolynomial with the given segment_times
. Each segment will have a matrix of random Polynomials of the specified size.
|
virtual |
|
protected |
void setPolynomialMatrixBlock | ( | const PolynomialMatrix & | replacement, |
int | segment_number, | ||
Eigen::Index | row_start = 0 , |
||
Eigen::Index | col_start = 0 |
||
) |
void shiftRight | ( | double | offset | ) |
PiecewisePolynomial< CoefficientType > slice | ( | int | start_segment_index, |
int | num_segments | ||
) |