angutils package
Submodules
angutils.angutils module
- angutils.angutils.DCM2EulerAng(DCM: ndarray[tuple[int, ...], dtype[float64]], rotSet: List[int] | Tuple[int] | ndarray[tuple[int, ...], dtype[int64]], body: bool = True) List[float][source]
- Parameters:
DCM (numpy.ndarray) – Direction Cosine Matrix
rotSet (iterable) – 3-element iterable defining order of rotations of a body Euler angle set. See
validateEulerAngSet().body (bool) – True for body rotations, False for space rotations. Defaults to True.
- Returns:
List of the three computed angles
- Return type:
- angutils.angutils.DCM2axang(DCM: ndarray[tuple[int, ...], dtype[float64]]) Tuple[ndarray[tuple[int, ...], dtype[float64]], float][source]
Given a direction cosine matrix \({}^\mathcal{B}C^\mathcal{A}\) compute the axis and angle of the rotation. Inverse of
calcDCM().- Parameters:
DCM (numpy.ndarray) – 3x3 Direction cosine matrix transforming vector components from frame \(\mathcal{A}\) to frame \(\mathcal{B}\).
- Returns:
- n (numpy.ndarray):
3x1 matrix representation of the unit vector of the axis of rotation
- th (float):
Expression for the angle of rotation. Will always be between 0 and pi
- Return type:
- angutils.angutils.EulerAng2DCM(rotSet: List[int] | Tuple[int] | ndarray[tuple[int, ...], dtype[int64]], angs: List[float] | Tuple[float] | ndarray[tuple[int, ...], dtype[float64]], body: bool = True) ndarray[tuple[int, ...], dtype[float64]][source]
Calculate the equivalent direction cosine matrix for an Euler Angle set
- Parameters:
rotSet (iterable) – 3-element iterable defining order of rotations of a body Euler angle set. See
validateEulerAngSet().angs (iterable) – 3-element iterable of symbols or expressions defining the angle of each rotation.
body (bool) – True for body rotations, False for space rotations. Defaults to True.
- Returns:
3x3 equivalent direction cosine matrix \({}^\mathcal{B}C^\mathcal{A}\)
- Return type:
- angutils.angutils.calcDCM(n: List[float] | Tuple[float] | ndarray[tuple[int, ...], dtype[float64]], th: float) ndarray[tuple[int, ...], dtype[float64]][source]
Rodrigues formula: Calculates the DCM \({}^\mathcal{A}C^\mathcal{B}\) for a rotation of the given angle about a given axis. This is a generalization of
rotMat().- Parameters:
n (iterable) – 3 element vector representing rotation axis
th (float) – Angle of rotation
- Returns:
3x3 rotation matrix
- Return type:
Note
nneed not be normalized - it will automatically be transformed to a unit vector as part of the calculation.
- angutils.angutils.calcang(x: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], y: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], z: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) float[source]
Compute the angle between vectors x and y when rotating counter-clockwise about vector z
- Parameters:
x (iterable) – 3 components of x vector
y (iterable) – 3 components of y vector
z (iterable) – 3 components of z vector
- Returns:
Angle in radians
- Return type:
- angutils.angutils.colVec(n: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) ndarray[tuple[int, ...], dtype[float64]][source]
Turn any 3-element iterable into a 3x1 column vector
- Parameters:
n (iterable) – 3 element iterable
- Returns:
3x1 component representation of the vector
- Return type:
- angutils.angutils.projplane(v: ndarray[tuple[int, ...], dtype[float64]], nv: ndarray[tuple[int, ...], dtype[float64]]) ndarray[tuple[int, ...], dtype[float64]][source]
Project vectors v onto a plane normal to nv
- Parameters:
v (numpy.ndarray) – 3xn vectors to be projected
nv (numpy.ndarray) – 3x1 or 1x3 components of vector orthogonal to plane of projection
- Returns:
Output has equivalent size to v and contains the projected vectors
- Return type:
- angutils.angutils.rotMat(axis: int, angle: float) ndarray[tuple[int, ...], dtype[float64]][source]
Returns the DCM \({}^\mathcal{B}C^\mathcal{A}\) for a rotation of the given angle about the specified axis of frame \(\mathcal{A}\)
- Parameters:
- Returns:
3x3 rotation matrix
- Return type:
- angutils.angutils.skew(v: ndarray[tuple[int, ...], dtype[float64]]) ndarray[tuple[int, ...], dtype[float64]][source]
Given 3x1 vector v, return skew-symmetric matrix
- Parameters:
v (iterable) – Component representation of vector. Must have 3 elements
- Returns:
3x3 skew-symmetric matrix
- Return type:
- angutils.angutils.validateEulerAngSet(rotSet: List[int] | Tuple[int] | ndarray[tuple[int, ...], dtype[int64]]) int[source]
Ensure that a rotation set is valid and return the number of unique elements
- Parameters:
rotSet (iterable) – 3-element iterable defining order of rotations of a body Euler angle set. Indexing is 1-based, so valid rotation sets may only contains 1, 2, or 3. A valid rotation set contains exactly 3 elements, at least 2 of which are distinct, and with no rotations about the same axis repeated in a row. [1, 2, 3] and [1, 3, 1] are valid, but [1, 1, 2] is not.
- Returns:
Number of unique axes used in rotation (2 or 3).
- Return type: