Method for finding Orientation Error using Axis-Angle

asked 2018-06-12 21:05:54 -0600

malharjajoo gravatar image

updated 2018-06-13 09:31:35 -0600

Hi,

I have a reference value for Roll, pitch and yaw (Euler Angles) and my estimate for the same. I want to find the error between the two. If I convert each of the RPY values to a Rotation matrix, I see some possible ways (see below) of finding the orientation error.

I recently came across this openCV function in the calib3d module: get_rotation_error that uses Rodrigues/Axis-Angle (I think they mean the same) for finding the error between 2 rotation matrices.

I have 2 questions -

1) In the method given in get_rotation_error, it seems to "subtract" the two rotation matrices by transposing one (not sure what the negative sign is about)

error_mat = R_ref * R.transpose() * -1
error = cv::norm( cv::Rodrigues ( error_mat ))

How are we supposed to interpret the output ( I believe the output of the cv::norm( rodrigues_vector) is the angle of the rodrigues vector according to openCV convention. Does this mean I simply need to convert it to degrees to find the angle error (between reference and my estimates) in degrees ?

I would also like to mention that this method keeps returning 3.14159 even for wildly different values of the reference and my estimates. Is there something that I''m missing ?

======

2) I thought of another method, slightly different from the above , what if I do the following -

my_angle = cv::norm (cv::Rodrigues ( R ))

reference_angle = cv::norm (cv::Rodrigues ( R_ref ))

error = reference_angle - my_angle

Is there something wrong with method 2) ? I have tried it and it gives a different output compared to method 1).

I would be very grateful if someone can answer the above queries or even point me in the right direction.

Thanks!

edit retag flag offensive close merge delete

Comments

Quick answer:

  • inverse of rotation is rotation transpose (no idea about why the minus sign but it should not matter much)
  • if the two rotations are identical, R_ref . R^T is identity, otherwise you get the rotation transformation / error
  • axis-angle formalism represents rotation as a combination of a vector and a magnitude, in your second case you are comparing only the angle error but not the vector error

You should look at a course about rotation, axis-angle, quaternion, formalisms and homogeneous transformation in robotics or in computer graphics if you want more information.

Eduardo gravatar imageEduardo ( 2018-06-14 16:06:34 -0600 )edit

In my second case I am not comparing the direction vector of the axis angle. Yes, but that is not being done in method 1) either (and it's a part of the openCV library).

malharjajoo gravatar imagemalharjajoo ( 2018-06-14 16:57:22 -0600 )edit

Computing R_ref . R^T basically computes the rotation difference / error.

Eduardo gravatar imageEduardo ( 2018-06-15 16:47:04 -0600 )edit

But then we only find the norm of the error vector ? What about the direction then

malharjajoo gravatar imagemalharjajoo ( 2018-06-15 17:25:32 -0600 )edit

What is bothering you? R_ref . R^T is a 3x3 rotation matrix. Norm of the Axis-Angle rotation representation is the amount of rotation. The direction doesn't matter if you are looking for quantifying (more/less rotation error?) the rotation error, at least in most of the cases.

Eduardo gravatar imageEduardo ( 2018-06-18 15:28:04 -0600 )edit

So why doesn't the direction of cv::Rodrigues ( error_mat ) matter ? ( If I have an angle around an axis, and then the same angle around a different axis, then shoulnd't they be considered as different ? )

malharjajoo gravatar imagemalharjajoo ( 2018-06-18 16:18:18 -0600 )edit

In 2), you are comparing the angle magnitude between one reference rotation and another one that could be completely different if the direction is different but the angle magnitude the same.

In 1), you are doing it for the rotation transformation / error.

Just to be clear, you can of course compare the angle magnitude and the direction if you want / need it.

Eduardo gravatar imageEduardo ( 2018-06-23 18:03:46 -0600 )edit