Method for finding Orientation Error using Axis-Angle
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!
Quick answer:
R_ref . R^T
is identity, otherwise you get the rotation transformation / errorYou 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.
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).
Computing
R_ref . R^T
basically computes the rotation difference / error.But then we only find the norm of the error vector ? What about the direction then
What is bothering you?
R_ref . R^T
is a3x3
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.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 ? )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.