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

gtsam::Rot3::quaternion() vs gtsam::Rot3::toQuaternion() #10

Closed
RyGuy101 opened this issue Mar 13, 2023 · 0 comments
Closed

gtsam::Rot3::quaternion() vs gtsam::Rot3::toQuaternion() #10

RyGuy101 opened this issue Mar 13, 2023 · 0 comments

Comments

@RyGuy101
Copy link

Hello, I encountered a bug here because gtsam::Rot3::quaternion() does not behave as expected (the w, x, y, z are in the wrong order). This is probably due to the specific version of GTSAM I'm using, as the behavior has not always been the same (see
borglab/gtsam#1219). It may be a good idea to switch to toQuaternion() which should always be correct.

Current code:

Eigen::Quaterniond rot = Eigen::Quaterniond(
prev_pose_.rotation().quaternion().w(),
prev_pose_.rotation().quaternion().x(),
prev_pose_.rotation().quaternion().y(),
prev_pose_.rotation().quaternion().z());

Proposed change:

  Eigen::Quaterniond rot = Eigen::Quaterniond(
    prev_pose_.rotation().toQuaternion().w(),
    prev_pose_.rotation().toQuaternion().x(),
    prev_pose_.rotation().toQuaternion().y(),
    prev_pose_.rotation().toQuaternion().z());
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

2 participants