0
$\begingroup$

Rosanswers logo

Hello everyone, I noticed tf::Matrix3x3 provides 3 distinct methods (getEulerYPR, getEulerZYX and getRPY) and they all seem to give the very same results :

The output of the following snippet is given below :

   double roll, pitch, yaw;
   tf::Matrix3x3(transform.getRotation()).getRPY(roll, pitch, yaw);
            
   std::cout<<"getRPY():      "<<roll<<" "<<pitch<<" "<<yaw<<"\n";
   tf::Matrix3x3(transform.getRotation()).getEulerYPR(yaw, pitch, roll);
   std::cout<<"getEulerYPR(): "<<roll<<" "<<pitch<<" "<<yaw<<"\n";
   tf::Matrix3x3(transform.getRotation()).getEulerZYX(yaw, pitch, roll);
   std::cout<<"getEulerZYX(): "<<roll<<" "<<pitch<<" "<<yaw<<"\n";

outputs:

getRPY():      0.000254904 -0.00770209 -0.0312527
getEulerYPR(): 0.000254904 -0.00770209 -0.0312527
getEulerZYX(): 0.000254904 -0.00770209 -0.0312527

Why do we have duplicate methods that seem to do exactly one thing? Can somebody please shed some light on this? Thanks a lot in advance


Originally posted by Rika on ROS Answers with karma: 72 on 2021-07-03

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

attribute((deprecated)) void getEulerZYX(tfScalar& yaw, tfScalar& pitch, tfScalar& roll, unsigned int solution_number = 1) const { getEulerYPR(yaw, pitch, roll, solution_number); };

  void getRPY(tfScalar& roll, tfScalar& pitch, tfScalar& yaw, unsigned int solution_number = 1) const
  {
     getEulerYPR(yaw, pitch, roll, solution_number);
  }

No difference according to the code

No real cost maintenanceto allow different functions that just have different argument names to the same underlying function.


Originally posted by bob-ROS with karma: 525 on 2021-07-03

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.