pydrake.trajectories

class pydrake.trajectories.PiecewisePolynomial

Bases: pydrake.trajectories.PiecewiseTrajectory

A scalar multi-variate piecewise polynomial.

PiecewisePolynomial represents a list of contiguous segments in time with a Matrix of Polynomials defined for each segment. The term segment is used for piece.

An example of a piecewise polynomial is a function of x segments in time, where for each segment a different polynomial is defined. For a more specific example, consider the absolute value function, which is a piecewise function. It uses one function for inputs values < 0, and another function for input values > 0:

int abs(int x)
{
  if (x<0) {
    return -x;
  }
  else return x;
}

PiecewisePolynomials can be added, subtracted, and multiplied. They cannot be divided because Polynomials are not closed under division.

Template parameter T:
is a scalar type.

Explicit instantiations are provided for:

  • double
Cubic(*args, **kwargs)

Overloaded function.

  1. Cubic(breaks: numpy.ndarray[float64[m, 1]], knots: numpy.ndarray[float64[m, n], flags.f_contiguous], knots_dot_start: numpy.ndarray[float64[m, 1]], knots_dot_end: numpy.ndarray[float64[m, 1]]) -> pydrake.trajectories.PiecewisePolynomial

Eigen version of Cubic(breaks, knots, knots_dot_start, knots_dot_end) where each column of knots is used as a knot point, and knots.cols() == breaks.size().

@overload PiecewisePolynomial<T> Cubic(breaks, knots, knots_dot_start, knots_dot_end)

  1. Cubic(breaks: numpy.ndarray[float64[m, 1]], knots: numpy.ndarray[float64[m, n], flags.f_contiguous], knots_dot: numpy.ndarray[float64[m, n], flags.f_contiguous]) -> pydrake.trajectories.PiecewisePolynomial

Eigen version of Cubic(breaks, knots, knots_dot) where each column of knots and knots_dot are used as the knot point/derivative. knots.cols() == knots_dot.cols() == breaks.size().

@overload PiecewisePolynomial<T> Cubic(breaks, knots, knots_dot)

  1. Cubic(breaks: numpy.ndarray[float64[m, 1]], knots: numpy.ndarray[float64[m, n], flags.f_contiguous], periodic_end: bool) -> pydrake.trajectories.PiecewisePolynomial

Eigen version of Cubic(breaks, knots) where each column of knots is used as a knot point and knots.cols() == breaks.size().

@overload PiecewisePolynomial<T> Cubic(breaks, knots)

FirstOrderHold(arg0: numpy.ndarray[float64[m, 1]], arg1: numpy.ndarray[float64[m, n], flags.f_contiguous]) → pydrake.trajectories.PiecewisePolynomial

Eigen version of FirstOrderHold(breaks, knots) where each column of knots is used as a knot point, and knots.cols() == breaks.size().

@overload PiecewisePolynomial<T> FirstOrderHold(breaks, knots)

Pchip(arg0: numpy.ndarray[float64[m, 1]], arg1: numpy.ndarray[float64[m, n], flags.f_contiguous], arg2: bool) → pydrake.trajectories.PiecewisePolynomial

Eigen version of Pchip(breaks, knots, zero_end_point_derivatives) where each column of knots is used as a knot point, and knots.cols() == breaks.size().

@overload PiecewisePolynomial<T> Pchip(breaks, knots, zero_end_point_derivatives)

ZeroOrderHold(arg0: numpy.ndarray[float64[m, 1]], arg1: numpy.ndarray[float64[m, n], flags.f_contiguous]) → pydrake.trajectories.PiecewisePolynomial

Eigen version of ZeroOrderHold(breaks, knots) where each column of knots is used as a knot point, and knots.cols() == breaks.size().

@overload PiecewisePolynomial<T> ZeroOrderHold(breaks, knots)

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.trajectories.PiecewisePolynomial) -> None

Default constructor; just leaves segment_times and polynomials empty.

  1. __init__(self: pydrake.trajectories.PiecewisePolynomial, arg0: numpy.ndarray[float64[m, n], flags.f_contiguous]) -> None

Single segment and/or constant value constructor.

cols(self: pydrake.trajectories.PiecewisePolynomial) → int

Returns the column count of each and every PolynomialMatrix segment.

derivative(self: pydrake.trajectories.PiecewisePolynomial, arg0: int) → pydrake.trajectories.PiecewisePolynomial

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.

rows(self: pydrake.trajectories.PiecewisePolynomial) → int

Returns the row count of each and every PolynomialMatrix segment.

shiftRight(self: pydrake.trajectories.PiecewisePolynomial, offset: float) → None
slice(self: pydrake.trajectories.PiecewisePolynomial, start_segment_index: int, num_segments: int) → pydrake.trajectories.PiecewisePolynomial
value(self: pydrake.trajectories.PiecewisePolynomial, arg0: float) → numpy.ndarray[float64[m, n]]

Evaluates the PiecewisePolynomial at the given time t.

Parameter t:
The time at which to evaluate the PiecewisePolynomial.
Returns:The matrix of evaluated values.
class pydrake.trajectories.PiecewiseTrajectory

Bases: pydrake.trajectories.Trajectory

Abstract class that implements the basic logic of maintaining consequent segments of time (delimited by breaks) to implement a trajectory that is represented by simpler logic in each segment or “piece”.

Template parameter T:
is the scalar type.

Instantiated templates for the following kinds of T’s are provided:

  • double
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

duration(self: pydrake.trajectories.PiecewiseTrajectory, arg0: int) → float
end_time(*args, **kwargs)

Overloaded function.

  1. end_time(self: pydrake.trajectories.PiecewiseTrajectory, arg0: int) -> float
  2. end_time(self: pydrake.trajectories.PiecewiseTrajectory) -> float
get_number_of_segments(self: pydrake.trajectories.PiecewiseTrajectory) → int
get_segment_index(self: pydrake.trajectories.PiecewiseTrajectory, arg0: float) → int
get_segment_times(self: pydrake.trajectories.PiecewiseTrajectory) → List[float]
start_time(*args, **kwargs)

Overloaded function.

  1. start_time(self: pydrake.trajectories.PiecewiseTrajectory, arg0: int) -> float
  2. start_time(self: pydrake.trajectories.PiecewiseTrajectory) -> float
class pydrake.trajectories.Trajectory

A Trajectory represents a time-varying matrix, indexed by a single scalar double time.

Template parameter T:
is a Scalar type for the data that is returned.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature