title: ENU -> NED frame conversion using quaternions
body: <h3>What I am looking for:</h3>
  <p>A uniform way to rotate a vector (X, Y, Z) from ENU to NED and vice versa<br>
  The same uniform way to rotate a quaternion from ENU to NED and vice versa<br><br>
  It would be appreciated if there can be given a solution in python, but it is more about the know-how to me.</p>
  <h3>What I think I already know</h3>
  <p>If I have this vector in ENU</p>
  <pre><code>v_xyz_ENU = [5,2,1] 
  </code></pre>
  <p>translates to</p>
  <pre><code>v_xyz_NED = [2,5,-1]
  </code></pre>
  <blockquote>
  <p>ENU &lt;-&gt; NED<br>
  X, Y, Z &lt;-&gt; Y, X,-Z</p>
  </blockquote>
  <p>If I use this technique on a vector containing RPY (if that is the correct way to put it) I get confused.<br></p>
  <pre><code>v_rpy_ENU = [0,0,90] 
  </code></pre>
  <p>translates to</p>
  <pre><code>v_rpy_NED = [0,0,-90]
  </code></pre>
  <p><em>When I write calculations down I prefer to use angles in degrees</em><br></p>
  <p>This rotations seems incorrect, because I <strong>know</strong> the result should be 0°<br>
  ENU Yaw 0° should be NED Yaw -90°<br>
  ENU Yaw 90° should be NED Yaw 0°<br>
  ENU Yaw 180° should be NED Yaw -90°/270°<br>
  ENU Yaw -90° should be NED Yaw 180°<br></p>
  <h3>What I have tried so far</h3>
  <p>I did try to wrap my head about quaternions. The explanation and examples I find elsewhere online about rotations using quaternions seems straight forward but I can't seem to come up with a result I understand.</p>
  <p>For now, I forget about RPY and start using Quaternions.
  I have this quaternions in ENU representing the same 90° rotation about Z<br></p>
  <pre><code>Q_ENU = pq.Quaternion(axis=[0,0,1], degrees=90)
  </code></pre>
  <p>One claimed the rotation can be made similarly to the vector rotation but leave the w component untouched. So I try:<br></p>
  <pre><code>Q_NED = pq.Quaternion(Q_ENU.q[0], Q_ENU.q[2], Q_ENU.q[1], -Q_ENU.q[3])
  </code></pre>
  <blockquote>
  <p>Quaternion.q's data order = [w,x,y,z]</p>
  </blockquote>
  <p>Now I verify if I get a yaw of 0° in NED once I convert the Q_NED to RPY angles, but it seems the result is:<br></p>
  <pre><code>Q_ENU: 0.707 +0.000i +0.000j +0.707k
  Q_NED: 0.707 +0.000i +0.000j -0.707k
  rpy_NED: [0.0, 0.0, -89.99999999999999]
  I expect rpy_NED [0.0, 0.0, 0.0]
  </code></pre>
  <p>Now before I start writing all other possibilities I did try, I think a save myself and you a lot of time by not doing that. I would be really thankful for some explanation on how to do it, or at least a push in the right direction.</p>
  <p>-T</p>