coincar-sim / util_eigen_geometry

BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Incorrect calculation of Isometry2d from 3d #1

Open joeda opened 4 years ago

joeda commented 4 years ago

In https://github.com/coincar-sim/util_eigen_geometry/blob/release/src/util_eigen_geometry.cpp#L221,

the calculation of the 2D rotation matrix is done by using the (2,2) sized top left block of the 3D rotation matrix. In the general case, this is not a rotation matrix since the determinant = 1 requirement is not fulfilled (except for special cases, such as z pointing upward). For example, a transformation that is slightly pitched by -0.1 will give the following 2D rotation matrix:

0.995 0
0     1

which is not actually a rotation matrix, or for pitch = -1 and roll = 0.6

0.5403,   0.4751
8.61e-17  0.8253

. The yaw angle can be computed from the matrix (see https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Rotation_matrix_%E2%86%92_Euler_angles_(z-x-z_extrinsic) ), but so far I've been unable to find the correct formulation. Any Ideas?

m-naumann commented 4 years ago

Hi @joeda

you revealed that we are missing documentation. All provided methods silently assume that 2d<->3d conversion works by neglecting z, i.e. we assume to be in the x-y-plane with z=0.

I'll also look into your problem closer in June, sorry for this delay