Error in converting Eigen::Quaternion to Eigen::AngleAxis in cost function

322 views
Skip to first unread message

aeoleader

unread,
May 24, 2017, 7:22:20 AM5/24/17
to Ceres Solver
Hi all,

How to convert an Eigen::Quaternion object to AngleAxis representation? I have tried the following code with no luck.
Eigen::Quaternion<T> quat = Eigen::Map<Eigen::Quaternion<double>>(quaternion);
T angleaxis
[3];
auxiliary
::QuaternionToAngleAxis(quat.coeffs().data(),angleaxis);

QuaternionToAngleAxis is a re-implementation of QuaternionToAngleAxis in rotation.h, which uses the Eigen order (x, y, z, w).

I am getting -nan in all jacobian evaluation.

Regards,
Xiangyu Li


Sameer Agarwal

unread,
May 24, 2017, 10:43:54 AM5/24/17
to ceres-...@googlegroups.com
Xiangyu,
It is hard to debug this on the basis of this much information.  You can print the intermediate values in QuarternionToAngleAxis and see where the nan is being introduced.
Sameer


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/8cf53caa-f515-41e4-9362-6167090e8101%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alex Stewart

unread,
May 24, 2017, 2:00:28 PM5/24/17
to ceres-...@googlegroups.com
This line:

Eigen::Quaternion<T> quat = Eigen::Map<Eigen::Quaternion<double>>(quaternion);

looks suspicious.  Assuming that ‘quaternion' is a T* parameter block then you should not be casting it to a double - that’s going to end badly with T is a Jet.  The line should probably be:

Eigen::Quaternion<T> quat = Eigen::Map<Eigen::Quaternion<T> >(quaternion);

-Alex

aeoleader

unread,
May 24, 2017, 9:54:08 PM5/24/17
to Ceres Solver
I am sorry, that was a typo, in my implementation it was T instead of double... 

aeoleader

unread,
May 24, 2017, 10:54:02 PM5/24/17
to Ceres Solver
My method may not be right, is there a better way to do the task? Convert Eigen::Quaternion to T[3] AngleAxis?

Xiangyu 

Sameer Agarwal

unread,
May 24, 2017, 10:55:25 PM5/24/17
to Ceres Solver
take the quarternion, convert it to wxyz form and call the conversion routine.

Reply all
Reply to author
Forward
0 new messages