title: About EulerAngles Conversion from Eigen C++ Library
body: <p>Suppose that I have a 3-dimensional frame with rotation roll = 0, pitch = 0 and yaw = 0 about x, y and z axis respectively.</p>
  
  <p>I want the frame to rotate about x-axis for 3.14159 (Pi) or roll = Pi.</p>
  
  <p>Below is the code for said situation.</p>
  
  <p>The problem is, when I want to convert the rotation matrix back to roll, pitch, and yaw, the code gives different answer.</p>
  
  <p>Instead of roll = Pi, the result is roll = 0, pitch = pi, and yaw = pi.</p>
  
  <p>I think RVC toolbox by Peter Corke on Matlab gives correct answer. </p>
  
  <p>Maybe something is not right with with my program or eulerAngles in Eigen works differently? Please help. </p>
  
  <p>Code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;Eigen/Dense&gt;
  
  const double PI = 3.14159265359;
  
  int main()
  {
      using ::Eigen::AngleAxisd;
      using ::Eigen::Matrix3d;
      using ::Eigen::Vector3d;
      using ::std::cout;
      using ::std::endl;
  
      Matrix3d R,Rx;
  
      R = AngleAxisd(PI, Vector3d::UnitX())
          * AngleAxisd(0, Vector3d::UnitY())
          * AngleAxisd(0, Vector3d::UnitZ());
      Rx = AngleAxisd(PI, Vector3d::UnitX());
  
      cout &lt;&lt; R &lt;&lt; endl &lt;&lt; endl;
      cout &lt;&lt; Rx &lt;&lt; endl &lt;&lt; endl;
  
      Vector3d ea = R.eulerAngles(0,1,2); 
      Vector3d eax = Rx.eulerAngles(0,1,2); 
  
      cout &lt;&lt; ea &lt;&lt; endl &lt;&lt; endl;
      cout &lt;&lt; eax &lt;&lt; endl &lt;&lt; endl;
  
      std::cin.ignore();
      return 0;
  }
  </code></pre>
  
  <p>Output (I round off numbers which are too small to zero):</p>
  
  <pre><code>1 0 0
  0 -1 0
  0 0 -1
  
  1 0 0
  0 -1 0
  0 0 -1
  
  0
  3.14159
  3.14159
  
  0
  3.14159
  3.14159
  </code></pre>