udaan.flatness.jet module¶
Jet — a time-varying signal packaged with its time derivatives.
A k-th order jet at time t₀ of a (possibly vector-valued) signal y(t) is the tuple
Jₖ(y, t₀) = (y(t₀), ẏ(t₀), ÿ(t₀), …, y⁽ᵏ⁾(t₀))
In differential-flatness theory (Fliess, Lévine, et al.) the state and input
of a flat system are algebraic functions of such a jet of the flat output.
This module provides a lightweight container for these tuples, used
throughout udaan.flatness as the atomic data type for flat-output
derivative bundles.
Convention¶
The underlying storage is a 2-D numpy array of shape (order+1, dim).
Row k is the k-th time derivative of the signal:
data[0] → y
data[1] → ẏ
data[2] → ÿ
...
data[order] → y⁽ᵒʳᵈᵉʳ⁾
Scalar signals (dim == 1) may be constructed from a 1-D array of length
order+1; it’s promoted to 2-D internally. Indexing a scalar jet returns
a Python float; indexing a vector jet returns a 1-D np.ndarray of
shape (dim,).
Strictly, the k-jet in the differential-geometry literature is the truncated
Taylor polynomial Σ yᵏ(t₀)/k! · zᵏ; Jet stores the raw derivative
tuple (no factorial scaling).
See also
https//en.wikipedia.org/wiki/Jet_(mathematics)
- class udaan.flatness.jet.Jet[source]¶
Bases:
objectTime-derivative tuple
(y, ẏ, ÿ, …)of a signal at a single time.- Parameters:
data (
ndarray) – Either a 1-D array of shape(order+1,)— which promotes to a scalar jet withdim == 1— or a 2-D array of shape(order+1, dim). Dtype is coerced to float64.
- data¶
2-D numpy array of shape
(order+1, dim).
Examples
Scalar signal (e.g. yaw angle with three derivative levels):
>>> psi = Jet(np.array([0.0, 0.1, 0.2])) >>> psi.order 2 >>> psi.dim 1 >>> psi[1] 0.1
Vector signal (e.g. position with four derivative levels):
>>> x = Jet(np.stack([[0, 0, 1], [1, 0, 0], [0, 0, 0], [0, 0, 0]], axis=0)) >>> x.order 3 >>> x.dim 3 >>> x[1] array([1., 0., 0.])
- __init__(data=<factory>)¶
- differentiate()[source]¶
Shift derivatives down by one level and return a new jet.
Given
J = (y, ẏ, ÿ, …, y⁽ᵒʳᵈᵉʳ⁾)returnsJ' = (ẏ, ÿ, …, y⁽ᵒʳᵈᵉʳ⁾)— i.e. the jet of the time derivative of the original signal, withorderreduced by one.- Return type:
- classmethod from_list(derivatives)[source]¶
Construct from an explicit list of derivative arrays/scalars.
- Return type:
Examples
>>> Jet.from_list([pos, vel, acc, jerk, snap])