Attitude¶
- class sonic.Attitude¶
- Constructor Summary
- Attitude(raw_att, quat_flag)¶
Constructs an Attitude object, which parameterizes different representations of the same attitude. Note that this class adopts the passive representation of Attitude.
- Inputs:
raw_att: A valid parameterization of attitude. Valid input representations are:
(3x1 double): Rotation vector
(4x1 double): Quaternion
(3x3 double): Direction Cosine Matrix (DCM)
The type of attitude parameterization is inferred from the number of elements in the supplied parameterization.
quat_flag (char/string): If inputting a quaternion, this is REQUIRED. Specify ‘vs’ or ‘sv’ to indicate the convention of the quaternion as scalar-last or scalar-first, respectively.
- Outputs:
obj (sonic.Attitude): Attitude object, encoding a particular attitude which can be viewed in multiple parameterizations.
Last revised: 2/15/24 Last author: Michael Krause
- Property Summary
- dcm¶
- quat_s¶
- quat_v¶
Quaternion representation of attitude (this is what we will store all attitudes as, fundamentally)
- rotation_vec¶
- Method Summary
- static DCMtoAxAng(T)¶
Converts a direction cosine matrix (DCM) to an Euler axis/angle pair (angle in radians).
- Inputs:
T (3x3 double): Valid DCM
- Outputs:
ax (3x1 double): Euler rotation axis
ang_RAD (1x1 double): Euler rotation angle, in radians
Last revised: 2/15/24 Last author: Michael Krause
- static DCMtoQuat(T)¶
Converts a DCM to a quaternion.
- Inputs:
T (3x3 double): Valid DCM
- Outputs:
qv (3x1 double): Vector component of the quaternion.
qs (1x1 double): Scalar component of the quaternion.
Last revised: 2/15/24 Last author: Michael Krause
- static DCMtoRotationVec(T)¶
Converts a direction cosine matrix (DCM) to an Euler rotation vector.
- Inputs:
T (3x3 double): Valid DCM
- Outputs:
rotation_vec (3x1 double): Euler rotation vector.
Last revised: 2/15/24 Last author: Michael Krause
- static angleBetween(att1, att2)¶
Computes the angle between two attitude objects
- Inputs:
att1 (1x1 sonic.Attitude): attitude object 1
att2 (1x1 sonic.Attitude): attitude object 2
- Outputs:
ang_RAD (1x1 double): angle between the two attitudes
Last revised: 4/15/24 Last author: Sebastien Henry
- static axAngToDCM(ax, ang_RAD)¶
Converts an Euler axis/angle pair to a direction cosine matrix (DCM).
- Inputs:
ax (3x1 double): Valid Euler rotation axis
- ang_RAD (1x1 double): Valid Euler rotation angle, in
radians.
- Outputs:
T (3x3 double): DCM representation of attitude.
Last revised: 2/15/24 Last author: Michael Krause
- static axAngToQuat(ax, ang_RAD)¶
Converts an Euler axis/angle to a quaternion.
- Inputs:
ax: (3x1 double): Valid Euler rotation axis
ang_RAD: (1x1 double): Valid Euler rotation angle, in radians.
- Outputs:
qv (3x1 double): Vector component of the quaternion.
qs (1x1 double): Scalar component of the quaternion.
Last revised: 2/15/24 Last author: Michael Krause
- static axAngToRotationVec(ax, ang)¶
Converts an Euler axis/angle pair (angle in radians) to an Euler rotation vector.
- Inputs:
ax (3x1 double): Valid Euler rotation axis
ang_RAD (1x1 double): Valid Euler rotation angle, in radians.
- Outputs:
rotation_vec: (3x1 double): Euler rotation vector.
Last revised: 2/15/24 Last author: Michael Krause
- comp(obj2)¶
Composes attitudes together. This may be thought of in terms of DCMs as:
new_att.dcm = obj.dcm*t_obj.dcm;
- Inputs:
obj (1x1 sonic.Attitude): Attitude object
obj2 (1x1 sonic.Attitude): Another attitude object to compose with the calling object
- Outputs:
new_att (1x1 sonic.Attitude): The resultant composed attitude object
Last revised: 3/15/24 Last author: Michael Krause
- static dDCMdRotationVec(rotVec)¶
Compute the partial of a vectorized DCM with respect to a rotation vector.
- static interpolate(att1, att2, t)¶
Given two Attitude objects and a parameter for the fraction of arclength between the attitudes, interpolates the desired intermediate attitude. Internally, uses a quaternion-based spherical linear interpolation (SLERP) routine.
- Inputs:
att1 (1x1 sonic.Attitude): an Attitude object
att2 (1x1 sonic.Attitude): an Attitude object
t (1x1 double): a fraction of the spherical arclength between att1 and att2 at which to interpolate the attitude.
- Outputs:
interp_att (1x1 sonic.Attitude): a new Attitude object representing the desired interpolated attitude.
Last revised: 4/18/24 Last author: Michael Krause
- inv()¶
Inverses attitude. This may be thought of in terms of DCMs as:
new_att.dcm = obj.dcm’;
- Inputs:
obj (1x1 sonic.Attitude): Attitude object
- Outputs:
new_att (1x1 sonic.Attitude): The resultant inversed attitude object
Last revised: 10/29/2024 Last author: Sebastien Henry
- mtimes(to_mult)¶
Pre-multiply the att to an object result depending on the type of to_mult
- Inputs:
- to_mult: a SONIC object, either
(1x1 sonic.PointsS2): In this case, the output is
the attitude matrix times the points s2 - (1x1 sonic.Points3): In this case, the output is the attitude matrix times the points p3 - (1x1 sonic.Attitude): In this case, the output is the compose of the attitude matrices
Last revised: 11/07/2024 Last author: Jennifer Nolan
- static quatToAxAng(qv, qs)¶
Converts a quaternion (expressed as separate vector/scalar parts) to an Euler axis/angle pair (angle in radians).
- Inputs:
qv (3x1 double): Vector component of the quaternion.
qs (1x1 double): Scalar component of the quaternion.
- Outputs:
ax (3x1 double): Euler rotation axis
ang_RAD (1x1 double): Euler rotation angle, in radians
Last revised: 2/15/24 Last author: Michael Krause
- static quatToDCM(qv, qs)¶
Converts a quaternion (expressed as separate vector/scalar parts) to a direction cosine matrix (DCM).
- Inputs:
qv (3x1 double): Vector component of the quaternion.
qs (1x1 double): Scalar component of the quaternion.
- Outputs:
T (3x3 double): DCM representation of attitude.
Last revised: 2/15/24 Last author: Michael Krause
- static quatToRotationVec(qv, qs)¶
Converts a quaternion (expressed as separate vector/scalar parts) to an Euler rotation vector.
- Inputs:
qv (3x1 double): Vector component of the quaternion.
qs (1x1 double): Scalar component of the quaternion.
- Outputs:
rotation_vec: (3x1 double): Euler rotation vector.
Last revised: 2/15/24 Last author: Michael Krause
- rotate(to_rot)¶
Rotates an object relative to the observer. Currently only supports rotating points in P3, i.e., sonic.Points3 and sonic.PointsS2.
- Inputs:
to_rot (1x1 sonic.Points3 or sonic.PointsS2): Object to rotate. Currently only supports rotating 3D points.
rot_att (1x1 sonic.Attitude): Object to Camera attitude.
- Outputs:
rot_obj (1x1 sonic.Points3 or sonic.PointsS2): Rotated object. Return type will match the input type.
Last revised: 11/08/24 Last author: Sebastien Henry
- static rotationVecToAxAng(rotation_vec)¶
Converts an Euler rotation vector to an Euler axis/angle pair (angle in radians).
- Inputs:
rotation_vec (3x1 double): Euler rotation vector.
- Outputs:
ax (3x1 double): Euler rotation axis
ang_RAD (1x1 double): Euler rotation angle, in radians
Last revised: 2/15/24 Last author: Michael Krause
- static rotationVecToDCM(rotation_vec)¶
Converts an Euler rotation vector to a direction cosine matrix (DCM).
- Inputs:
rotation_vec (3x1 double): Valid rotation vector
- Outputs:
T (3x3 double): DCM representation of attitude.
Last revised: 2/15/24 Last author: Michael Krause
- static rotationVecToQuat(rotation_vec)¶
Converts an Euler rotation vector to a quaternion.
- Inputs:
rotation_vec: (3x1 double): Valid rotation vector
- Outputs:
qv (3x1 double): Vector component of the quaternion.
qs (1x1 double): Scalar component of the quaternion.
Last revised: 2/29/24 Last author: John Christian
- static solveWahbasProblem(pointsS2_cam, pointsS2_world)¶
Compute attitude from world to camera using directions in the camera frame and corresponding directions in the world frame. Requires at least 2 points.
- Inputs:
pointsS2_cam (1x1 sonic.PointsS2): directions in the camera frame
pointsS2_world (1x1 sonic.PointsS2): directions in the world frame
- Outputs:
att (1x1 sonic.Attitude): attitude object that goes from world to camera
Last revised: 4/15/24 Last author: Sebastien Henry
- static verifyValidDCM(cand_dcm)¶
Verifies that a DCM is valid. Errors if invalid, runs to completion if valid. Currently, the validity checks are:
Ensure determinant is +1.
- Inputs:
cand_dcm (3x3 double): Possible DCM
Last revised: 2/15/24 Last author: Michael Krause
- static verifyValidQuat(cand_quat)¶
Verifies that a quaternion is valid. Errors if invalid, runs to completion if valid. Currently, the validity checks are:
Ensure norm of quaternion is 1.
- Inputs:
cand_quat (4x1 double): Possible quaternion
Last revised: 2/15/24 Last author: Michael Krause
- static verifyValidRotationVec(cand_rotation_vec)¶
Verifies that a rotation vector is valid. Errors if invalid, runs to completion if valid. Currently, there are no validity checks, and this serves as a placeholder.
- Inputs:
cand_rotation_vec (3x1 double): Possible rotation vector
Last revised: 2/15/24 Last author: Michael Krause