rpng / open_vins

An open source platform for visual-inertial navigation research.
https://docs.openvins.com
GNU General Public License v3.0
2.21k stars 653 forks source link

Why do transpose on rotation in B-spline curve feed_trajectory() #404

Closed Alex-Beh closed 11 months ago

Alex-Beh commented 11 months ago

Hi, I have one question about the feed_trajectory in B-spline curve. The input is the trajectory in TUM format, each line represent the translation & rotation from IMU to the global frame. However, in the feed_trajectory() function, why do you transpose the rotation matrix while leaving the translation unchanged?

https://github.com/rpng/open_vins/blob/e84c8ca164c1ba59b4d0cae8da66141fc6df22fe/ov_core/src/sim/BsplineSE3.cpp#L42-L43

Alex-Beh commented 11 months ago

After I dive deeper into the code, I realized the function quat_2_Rot() is converting inverse() operation. and I guess that's why you doing transpose() after getting the result from quat_2_Rot(). May I know why need to do the inverse() operation in quat_2_Rot()? Same thing happened in rot_2_quat()

goldbattle commented 11 months ago

The rotation is read into a JPL quaternion, so its direction flip (e.g. a ItoG rotation in hamilton becomes a GtoI in JPL). Thus, we transpose so that the SE3 matrix we are constructing actually corresponds to the correct T_ItoG transformation with R_ItoG and p_GinI values.

This is the same reason why when we internally estimate rotation R_GtoI / q_GtoI, but when we save and external tools process it it will be the expected R_ItoG with p_GinI values. Hope this helps.

On Fri, Dec 1, 2023 at 12:19 AM Alex Beh @.***> wrote:

After I dive deeper into the code, I realized the function quat_2_Rot() is converting inverse() operation. and I guess that's why you doing transpose() after getting the result from quat_2_Rot(). May I know why need to do the inverse() operation in quat_2_Rot()? Same thing happened in rot_2_quat()

— Reply to this email directly, view it on GitHub https://github.com/rpng/open_vins/issues/404#issuecomment-1835665648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ6TYXHQMJYC54KQJTQSNTYHGHI5AVCNFSM6AAAAABACFLKFWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZVGY3DKNRUHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>