Spatial momentum
- class SpatialMomentum(value=None)[source]
- Bases: - SpatialF6- Spatial momentum class - Concrete subclass of SpatialF6 and represents the translational and rotational momentum of a rigid-body 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 - ndefault values
 - X.Alloc(N)creates an instance of the pose class- Xwith- Ndefault values, ie.- len(X)will be- N.- Xcan be considered a vector of pose objects, and those elements can be referenced- X[i]or assigned to- X[i] = ....- Note - The default value depends on the pose class and is the result of the empty constructor. For - SO2,- SE2,- SO3,- SE3it is an identity matrix, for a twist class- Twist2or- Twist3it is a zero vector, for a- UnitQuaternionor- Quaternionit is a zero vector.- Example: - >>> x = X.Alloc(10) >>> len(x) 10 - where - Xis 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 - Xis 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 + v2is a spatial vector of the same type as- v1and- v2whose value is the element-wise sum of- v1and- v2. 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-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.
 
 - __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 - v2is a spatial vector of the same type as- v1and- v2whose value is the element-wise difference of- v1and- v2. 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 
- Return type:
- None
 - 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 - Xis any of the SMTB classes.
 - clear() None -- remove all items from S
 - dot(value)
 - 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 
- Return type:
- None
 - 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 - Xis any of the SMTB classes.
 - 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 
- Return type:
- None
 - 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 - Xis any of the SMTB classes.- Note - If - iis beyond the end of the list, the item is appended to the list
 - 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 - Xis any of the SMTB classes.
 - reverse()
- S.reverse() – reverse IN PLACE 
 - property A: List[ndarray[Any, dtype[ScalarType]]] | ndarray[Any, dtype[ScalarType]]
- Array value of an instance (BasePoseList superclass method) - Returns:
- NumPy array value of this instance 
- Return type:
- ndarray 
 - X.Ais a NumPy array that represents the value of this instance, and has a shape given by- X.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