warp.spatial_cross_dual#
- warp.spatial_cross_dual( ) Vector[Float, Literal[6]]#
Return the spatial force cross product of twist
aand wrenchb.This is the wrench counterpart of
spatial_cross(): the second operand and result are both wrenches. “Dual” refers to the wrench-twist dot product, which computes mechanical power. The operation is not antisymmetric, so its operands are not interchangeable. Both arguments must have the same scalar type.- Parameters:
a – Twist represented as a spatial vector.
b – Wrench represented as a spatial vector.
- Returns:
The wrench
(w x n + v x f, w x f), wherea = (w, v)andb = (n, f).
Example
@wp.kernel def compute_spatial_cross_dual( twists: wp.array[wp.spatial_vector], wrenches: wp.array[wp.spatial_vector], out: wp.array[wp.spatial_vector], ): i = wp.tid() out[i] = wp.spatial_cross_dual(twists[i], wrenches[i]) twists = wp.array([wp.spatial_vector(0.0, 0.0, 1.0, 1.0, 0.0, 0.0)], dtype=wp.spatial_vector) wrenches = wp.array([wp.spatial_vector(0.0, 0.0, 0.0, 0.0, 1.0, 0.0)], dtype=wp.spatial_vector) out = wp.empty(1, dtype=wp.spatial_vector) wp.launch(compute_spatial_cross_dual, dim=1, inputs=[twists, wrenches], outputs=[out]) print(out.numpy())
[[ 0. 0. 1. -1. 0. 0.]]