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: object

Time-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 with dim == 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>)
property acceleration: float | ndarray
property crackle: float | ndarray
data: ndarray
differentiate()[source]

Shift derivatives down by one level and return a new jet.

Given J = (y, ẏ, ÿ, …, y⁽ᵒʳᵈᵉʳ⁾) returns J' = (ẏ, ÿ, …, y⁽ᵒʳᵈᵉʳ⁾) — i.e. the jet of the time derivative of the original signal, with order reduced by one.

Return type:

Jet

property dim: int

Signal dimension; data.shape[1] (1 for scalar signals).

classmethod from_list(derivatives)[source]

Construct from an explicit list of derivative arrays/scalars.

Return type:

Jet

Examples

>>> Jet.from_list([pos, vel, acc, jerk, snap])
property is_scalar: bool

True if the signal is scalar (dim == 1).

property jerk: float | ndarray
property order: int

Highest derivative index stored; data.shape[0] - 1.

property pop: float | ndarray
property snap: float | ndarray
truncate(new_order)[source]

Drop derivatives above new_order and return a new jet.

Return type:

Jet

property value: float | ndarray
property velocity: float | ndarray
classmethod zeros(order, dim=1)[source]

A jet of all zeros with the given order and dim.

Return type:

Jet