Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this Quaternion math ok? #7

Open
willat343 opened this issue Apr 19, 2022 · 0 comments
Open

Is this Quaternion math ok? #7

willat343 opened this issue Apr 19, 2022 · 0 comments

Comments

@willat343
Copy link
Collaborator

A line of code in LoFrontend::GetImuQuaternion caught my eye:

imu_quaternion = I_T_B_q_ * imu_quaternion * I_T_B_q_.inverse();

This line of code transforms the IMU orientation into the base link frame, and only runs if the user has set frame_conversions/b_convert_imu_to_base_link_frame to true (it is false in lo_frames.yaml). The line of code does: q' = q_e * q * q_e^-1 where q is the imu data (in the IMU frame), q' is the imu data transformed to the base link frame, and q_e is the extrinsic mapping the rotation from IMU to base link.

I had recently seen how the IMU to lidar frame conversion is done in LIO-SAM at https://github.com/TixiaoShan/LIO-SAM/blob/0cdc9e8b010fff947275d68aa3545062afb059da/include/utility.h#L269 where they do q' = q * q_e and so this line stuck out to me because of the different operatoin.

My understanding of quaternion math is pretty basic, so forgive me if I am completely wrong here, but after looking at a couple of online resources, I think that the q' = pqp^-1 operation is for rotating vectors and q' = q*p is for chaining rotations. Having said that, when running LIO-SAM I did have to pre-transform the IMU data into a body frame (from an NED frame) in a pre-processing step before applying the extrinsic in their code to get things working, so I'm not completely confident in my assessment.

It would be good to get your thoughts on this and/or confirm that LOCUS is doing the right thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant