SPART icon indicating copy to clipboard operation
SPART copied to clipboard

Inconsistent base rotation representation in Simulink Plant model

Open nickfaraco opened this issue 5 months ago • 0 comments

I'm under the impression that there's a mismatch in the attitude representation of the base (quaternion q0) in the Plant model of the simulink library. The kinematic equation of the quaterion derivative in the State_Intergrator block assumes the q0 quaternion to be the one associated with the rotation matrix that tranforms vectors expressed in the inertial frame into the same vector expressed in the base spacecraft frame. This is in accordance with the fact that, inside the Matrices block, the DCM associated with q0 is transposed before being fed to the Kinematics function, as it requires the matrix to be the one that expresses body-frame vectors in the inertial frame.

The TEE pose retrieved from the Kinematics&Dynamics block therefore expresses the rotation from the end-effector frame to the inertial one (the columns of the matrix are the components of the end-effector frame axes in the inertial frame), as one would expect. In the EndEffector block, however, the DCM extracted from TEE is transposed again before retrieving the quaternion qEE, causing the aforementioned mismatch. The xEE state therefore contains the conjugate of the quaternion it should.

This could be solved in two ways:

  • Change the formulation of the quaternion derivative in the State_Integrator block and completely remove the two transpose blocks in the Matrices and EndEffector blocks. This should be preferred in order for q0 to be always expressed in a consistent manner, in accordance to the required input of the Kinematics function and others
  • Alternatively, it would be sufficient to remove the transpose from the EndEffector block. Easier solution, but q0 in output would still be the conjugate of the quaternion, with respect to the convention used throughout the rest of the library.

Some tests and verifications have shown results in accordance with my hypotesis. If you think I'm wrong, please let me know.

nickfaraco avatar Feb 01 '24 12:02 nickfaraco