Giter Site home page Giter Site logo

Comments (4)

DmitriyKorchemkin avatar DmitriyKorchemkin commented on June 10, 2024

angle?() methods return rotation angle around corresponding axis that acts as similar as possible (in l2 sense) on the points from corresponding plane. It is not expected to match with Euler angles in all cases except some degenerate ones (rotations purely around one of the axes).

scipy.spatial.transform.Rotation.from_euler supports both intrinsic and extrinsic Euler angles denoted by different case of letters (parameter seq described in https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.transform.Rotation.from_euler.html ). If you try scipy.spatial.transform.Rotation.from_euler('XYZ', ...) -- you'll get Rorigin (up to precision of specified values)

from sophus.

libdoron avatar libdoron commented on June 10, 2024

Thanks @DmitriyKorchemkin
Using scipy.spatial.transform.Rotation.from_euler('XYZ', ...) with the angles I get from the 'angle?()' functions, I still don't get the original rotation matrix.
Taking the example from my original post:

yaw_rad, pitch_rad, roll_rad = 0.080531626939773560, -0.184074640274047852, -0.106850937008857727
Rangles = R.from_euler('XYZ', [yaw_rad, pitch_rad, roll_rad], degrees=False).as_matrix()

I now get:

array([[ 0.97749926,  0.10484603, -0.18303689],
       [-0.12094245,  0.98950412, -0.07908558],
       [ 0.17282394,  0.09944303,  0.97991988]])

Which is still not so similar to Rorigin.
I looked over multiple examples and the results I get are still very different.
Still, do you think it is correct to assume that if I need the Euler angles I should stick to the rotationMatrix() function and extract the euler angles from there?

from sophus.

DmitriyKorchemkin avatar DmitriyKorchemkin commented on June 10, 2024

I've meant that you need to use scipy.spatial.transform.Rotation.from_euler('XYZ', ...) with the angles you get from Eigen::MatrixBase<...>::eulerAngles(0, 1, 2);.

Seem to match perfectly:

>>> import scipy.spatial.transform as sst
>>> sst.Rotation.from_euler('XYZ', [0.071102283895015717, -0.187578573822975159, -0.100159876048564911]).as_matrix()
array([[ 0.97753477,  0.09823849, -0.18648049],
       [-0.11292146,  0.99114945, -0.06979621],
       [ 0.17797336,  0.08928587,  0.97997628]])

Angles that you get from Sophus::SO3<...>::angle?() will never match Euler angles except some corner-cases, because they're different and somewhat unrelated quantities.

from sophus.

libdoron avatar libdoron commented on June 10, 2024

I checked and you are right - they match. Thanks!

from sophus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.