rigid_body_motion.transform_linear_velocity

rigid_body_motion.transform_linear_velocity(arr, into, outof=None, what='reference_frame', moving_frame=None, reference_frame=None, dim=None, axis=None, timestamps=None, time_axis=None, cutoff=None, outlier_thresh=None, return_timestamps=False)[source]

Transform an array of linear velocities between frames.

The array represents the velocity of a moving body or frame wrt a reference frame, expressed in a representation frame.

The transformation changes either the reference frame, the moving frame or the representation frame of the velocity from this frame to another. In either case, it is assumed that the array is represented in the frame that is being changed and will be represented in the new frame after the transformation.

When transforming the reference frame R to a new frame R’ while keeping the moving frame M fixed, the transformed velocity is calculated according to the formula:

\[v_{M/R'} = v_{M/R} + v_{R/R'} + \omega_{R/R'} \times t_{M/R}\]

When transforming the moving frame M to a new frame M’ while keeping the reference frame R fixed, the transformed velocity is calculated according to the formula:

\[v_{M'/R} = v_{M/R} + v_{M'/M} + \omega_{M/R} \times t_{M'/M}\]
Parameters
arr: array_like

The array to transform.

into: str or ReferenceFrame

The target reference frame.

outof: str or ReferenceFrame, optional

The source reference frame. Can be omitted if the array is a DataArray whose attrs contain a “representation_frame”, “reference_frame” or “moving_frame” entry with the name of a registered frame (depending on what you want to transform, see what).

what: str

What frame of the velocity to transform. Can be “reference_frame”, “moving_frame” or “representation_frame”.

moving_frame: str or ReferenceFrame, optional

The moving frame when transforming the reference frame of the velocity.

reference_frame: str or ReferenceFrame, optional

The reference frame when transforming the moving frame of the velocity.

dim: str, optional

If the array is a DataArray, the name of the dimension representing the spatial coordinates of the velocities.

axis: int, optional

The axis of the array representing the spatial coordinates of the velocities. Defaults to the last axis of the array.

timestamps: array_like or str, optional

The timestamps of the velocities, corresponding to the time_axis of the array. If str and the array is a DataArray, the name of the coordinate with the timestamps. The axis defined by time_axis will be re-sampled to the timestamps for which the transformation is defined.

time_axis: int, optional

The axis of the array representing the timestamps of the velocities. Defaults to the first axis of the array.

cutoff: float, optional

Frequency of a low-pass filter applied to linear and angular velocity after the twist estimation as a fraction of the Nyquist frequency.

outlier_thresh: float, optional

Some SLAM-based trackers introduce position corrections when a new camera frame becomes available. This introduces outliers in the linear velocity estimate. The estimation algorithm used here can suppress these outliers by throwing out samples where the norm of the second-order differences of the position is above outlier_thresh and interpolating the missing values. For measurements from the Intel RealSense T265 tracker, set this value to 1e-3.

return_timestamps: bool, default False

If True, also return the timestamps after the transformation.

Returns
arr_transformed: array_like

The transformed array.

ts: array_like

The timestamps after the transformation.