Spatial vector

class SpatialVector(value)[source]

Bases: spatialmath.baseposelist.BasePoseList

Spatial 6-vector abstract superclass

This class has two abstract subclasses, which each have concrete subclasses. Key characteristics:

  • 6D vectors that represent velocity, acceleration, momentum and force of bodies in 3D.

  • inherit list-like properties from SMUserList class

  • support operators:

Operator

Operation

+

addition of spatial vectors of the same subclass

-

subtraction of spatial vectors of the same subclass

-

unary minus

*

see table below

^

cross product x or x*

Certain subtypes can be multiplied

Multiplicands

Product

left

right

type

operation

SE3, Twist3

SpatialVelocity

SpatialVelocity

adjoint product

SE3, Twist3

SpatialAcceleration

SpatialAcceleration

adjoint product

SE3, Twist3

SpatialMomentum

SpatialMomentum

adjoint transpose product

SE3, Twist3

SpatialForce

SpatialForce

adjoint transpose product

SpatialAcceleration

SpatialInertia

SpatialForce

matrix-vector product**

SpatialVelocity

SpatialInertia

SpatialMomentum

matrix-vector product**

** indicates commutative operator.

Inheritance diagram of spatialmath.spatialvector.SpatialVelocity, spatialmath.spatialvector.SpatialAcceleration, spatialmath.spatialvector.SpatialForce, spatialmath.spatialvector.SpatialMomentum

References:

  • “Robot Dynamics Algorithms”, R. Featherstone, volume 22, Springer International Series in Engineering and Computer Science, Springer, 1987.

  • “A beginner’s guide to 6-d vectors (part 1)”, R. Featherstone, IEEE Robotics Automation Magazine, 17(3):83-94, Sep. 2010.

  • Online notes Methods:

Seealso

SpatialM6(), SpatialF6(), SpatialVelocity(), SpatialAcceleration(), SpatialForce(), SpatialMomentum().

__add__(right)[source]

Overloaded * operator (superclass method)

Returns

sum of spatial vectors

Return type

SpatialVector subclass instance

Raises
  • TypeError – attempting to add SpatialVectors of different subclass

  • ValueErrror – attempting to add SpatialVectors with different numbers of values

v1 + v2 is a spatial vector of the same type as v1 and v2 whose value is the element-wise sum of v1 and v2. If both are arrays of spatial vectors V1 (1xN) and V2 (1xN) the result is an array (1xN).

Seealso

__sub__()

__init__(value)[source]

Create a new spatial vector (abstract superclass)

Parameters

value – Value of the

  • SpatialVector(vec) is a spatial vector constructed from the 6-element array-like vec

  • SpatialVector([V1, V2, ... VN]) is a spatial vector array with N elements, constructed from the 6-element array-like values Vi

  • SpatialVector(A) is a spatial vector array with N elements, constructed from the columns of the 6xN array A.

__neg__()[source]

Overloaded unary - operator (superclass method)

Returns

negative of spatial vector

Return type

SpatialVector subclass instance

-v is a spatial vector of the same type as v whose value is the element-wise negative of v.

Seealso

__sub__()

__sub__(right)[source]

Overloaded - operator (superclass method)

Returns

difference of spatial vectors

Return type

SpatialVector subclass instance

Raises
  • TypeError – attempting to subtract SpatialVectors of different subclass

  • ValueErrror – attempting to subtract SpatialVectors with different numbers of values

v1 - v2 is a spatial vector of the same type as v1 and v2 whose value is the element-wise difference of v1 and v2. If both are arrays of spatial vectors V1 (1xN) and V2 (1xN) the result is an array (1xN).

Seealso

__add__(), __neg__()

isvalid(x, check)[source]

Test if vector is valid spatial vector

Parameters
Returns

True if the matrix has shape (6,).

Return type

bool

property shape

Shape of the object’s interal matrix representation

Returns

(6,)

Return type

tuple