Spatial acceleration
- class SpatialAcceleration(value=None)[source]
Bases:
spatialmath.spatialvector.SpatialM6
Spatial acceleration class
Concrete subclass of SpatialM6 that represents the translational and rotational acceleration of a rigid-body moving in 3D space.
- Seealso
- classmethod Alloc(n=1)
Construct an instance with N default values (BasePoseList superclass method)
- Parameters
n (int, optional) – Number of values, defaults to 1
- Return type
Self
- Returns
pose instance with
n
default values
X.Alloc(N)
creates an instance of the pose classX
withN
default values, ie.len(X)
will beN
.X
can be considered a vector of pose objects, and those elements can be referencedX[i]
or assigned toX[i] = ...
.Note
The default value depends on the pose class and is the result of the empty constructor. For
SO2
,SE2
,SO3
,SE3
it is an identity matrix, for a twist classTwist2
orTwist3
it is a zero vector, for aUnitQuaternion
orQuaternion
it is a zero vector.Example:
>>> x = X.Alloc(10) >>> len(x) 10
where
X
is any of the SMTB classes.
- classmethod Empty()
Construct an empty instance (BasePoseList superclass method)
- Return type
Self
- Returns
pose instance with zero values
Example:
>>> x = X.Empty() >>> len(x) 0
where
X
is any of the SMTB classes.
- __add__(right)
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 asv1
andv2
whose value is the element-wise sum ofv1
andv2
. If both are arrays of spatial vectors V1 (1xN) and V2 (1xN) the result is an array (1xN).- Seealso
- __init__(value=None)[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-likevec
SpatialVector([V1, V2, ... VN])
is a spatial vector array with N elements, constructed from the 6-element array-like valuesVi
SpatialVector(A)
is a spatial vector array with N elements, constructed from the columns of the 6xN arrayA
.
- __sub__(right)
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 asv1
andv2
whose value is the element-wise difference ofv1
andv2
. If both are arrays of spatial vectors V1 (1xN) and V2 (1xN) the result is an array (1xN).- Seealso
__add__()
,__neg__()
- append(item)
Append a value to an instance (BasePoseList superclass method)
- Parameters
x (Quaternion or UnitQuaternion instance) – the value to append
- Raises
ValueError – incorrect type of appended object
Appends the argument to the object’s internal list of values.
Example:
>>> x = X.Alloc(10) >>> len(x) 10 >>> x.append(X()) # append to the list >>> len(x) 11
where
X
is any of the SMTB classes.- Return type
None
- clear() None -- remove all items from S
- cross(other)
Spatial vector cross product
- Parameters
other (SpatialM6 instance) – spatial motion vector
- Returns
cross product of spatial vectors
- Return type
SpatialF6 instance if
other
is SpatialF6 instance- Return type
SpatialM6 instance if
other
is SpatialM6 instance
v1.cross(v2)
is a spatial vector cross product whose result depends on the SpatialVector subclass ofv2
:if \(\vec{m} \in \mat{M}^6\) is a spatial motion vector fixed in a body with velocity \(\vec{v}\) then \(\dvec{m} = \vec{v} \times \vec{m}\) or the
crm()
function.if \(\vec{f} \in \mat{F}^6\) is a spatial force vector fixed in a body with velocity \(\vec{v}\) then \(\dvec{f} = \vec{v} \times^* \vec{f}\) or the
crm()
function.
- extend(iterable)
Extend sequence of values in an instance (BasePoseList superclass method)
- Parameters
x (instance of same type) – the value to extend
- Raises
ValueError – incorrect type of appended object
Appends the argument’s values to the object’s internal list of values.
Example:
>>> x = X.Alloc(10) >>> len(x) 10 >>> x.append(X.Alloc(5)) # extend the list >>> len(x) 15
where
X
is any of the SMTB classes.- Return type
None
- insert(i, item)
Insert a value to an instance (BasePoseList superclass method)
- Parameters
i (int) – element to insert value before
item (instance of same type) – the value to insert
- Raises
ValueError – incorrect type of inserted value
Inserts the argument into the object’s internal list of values.
Example:
>>> x = X.Alloc(10) >>> len(x) 10 >>> x.insert(0, X()) # insert at start of list >>> len(x) 11 >>> x.insert(10, X()) # append to the list >>> len(x) 11
where
X
is any of the SMTB classes.Note
If
i
is beyond the end of the list, the item is appended to the list- Return type
None
- isvalid(x, check)
Test if vector is valid spatial vector
- Parameters
x (numpy.ndarray) – vector to test
check (bool) – ignored
- Returns
True if the matrix has shape (6,).
- Return type
bool
- pop(i=- 1)
Pop value from an instance (BasePoseList superclass method)
- Parameters
i (int) – item in the list to pop, default is last
- Returns
the popped value
- Return type
instance of same type
- Raises
IndexError – if there are no values to pop
Removes a value from the value list and returns it. The original instance is modified.
Example:
>>> x = X.Alloc(10) >>> len(x) 10 >>> y = x.pop() # pop the last value x[9] >>> len(x) 9 >>> y = x.pop(0) # pop the first value x[0] >>> len(x) 8
where
X
is any of the SMTB classes.
- reverse()
S.reverse() – reverse IN PLACE
- property A: Union[List[numpy.ndarray[Any, numpy.dtype[numpy.typing._generic_alias.ScalarType]]], numpy.ndarray[Any, numpy.dtype[numpy.typing._generic_alias.ScalarType]]]
Array value of an instance (BasePoseList superclass method)
- Returns
NumPy array value of this instance
- Return type
ndarray
X.A
is a NumPy array that represents the value of this instance, and has a shape given byX.shape
.
Note
This assumes that
len(X)
== 1, ie. it is a single-valued instance.
- property shape
Shape of the object’s interal matrix representation
- Returns
(6,)
- Return type
tuple