0
$\begingroup$

The practical application of the following problem is a control system for aircraft.

I have done a lot of googling and searching this StackExchange looking for an answer but I haven't found anything that seems applicable here. On top of this the wikipedia articles on quaternions go over my head at times.

So, I have a unit quaternion which holds the current rotation of the aircraft and I plan to use a single velocity value and use these together as a velocity vector. The problem I have is that I do not know how to transform the location of the aircraft, which is held as a cartesian vector $(x, y, z)$, using the quaternion and velocity.

I would happily rework the concept if this is not the best way of going about velocity and transformations.

$\endgroup$
11
  • $\begingroup$ By "rotation", do you mean "orientation"? $\endgroup$ Nov 25, 2016 at 14:27
  • $\begingroup$ Yeah, coloquially: which direction the aircraft is pointing. $\endgroup$
    – Juckix
    Nov 25, 2016 at 14:54
  • $\begingroup$ Do you care at all about rotating the plane, or do you only care about the direction it's going? $\endgroup$ Nov 25, 2016 at 15:01
  • $\begingroup$ I'm not sure I understand what you mean. I am fairly certain I understand how to apply rotations to the quaternion. I want to find out the new coordinates of the aircraft based on the velocity, the direction of the velocity. The distance covered is the $vt$ where $v$ is velocity and $t$ is time since the last transformation but how is this translated into the change in coordinates? $\endgroup$
    – Juckix
    Nov 25, 2016 at 15:08
  • $\begingroup$ The answer depends on a lot... What is your body fixed coordinate system? What is your global coordinate system? Is your velocity represented in the body coordinate system? Do you assume that the velocity is in line with the primary axis of the vehicle? $\endgroup$
    – Tpofofn
    Nov 25, 2016 at 21:31

1 Answer 1

0
$\begingroup$

You can extract the direction something is pointing in from a unit quaternion in the form $\left<\cos\frac\theta2, d_x\sin\frac\theta2,d_y\sin\frac\theta2,d_z\sin\frac\theta2 \right>=\left<q_w,q_x,q_y,q_z\right>$ (first element is the real part, last three elements is the imaginary part) by taking $\sin\cos^{-1}q_w$ and dividing the last three parts by that result to get the direction vector, $\vec d$. From there, your change in position is $s\vec d\Delta t$, where $s$ is the speed.

A few things about quaternions: make sure that you normalize them every so often. The formula to rotate a point is $q*\vec v*q^{-1}=q*\vec v*(q*)$, where $*$ represents quaternion multiplication and $\vec v=\left<0,v_x,v_y,v_z\right>$. $q^{-1}=q*$ is only true for unit quaternions. $q*$ is just the conjugate of $q$.

$\endgroup$
4
  • $\begingroup$ Thanks! I'll take some time to try to understand it before accepting it as an answer. $\endgroup$
    – Juckix
    Nov 25, 2016 at 15:38
  • $\begingroup$ I'd suggest that you look up rotations in physics engines, as they need to do similar things with quaternions and the internet is chock full of stuff involving physics engines. $\endgroup$ Nov 25, 2016 at 15:41
  • $\begingroup$ It is not true that $q^{-1}=-q$. I believe that what you intended was $q^{-1}=q^*$ where $q^*$ is the conjugate (i.e. only the imaginary parts are negated). $\endgroup$
    – Tpofofn
    Nov 25, 2016 at 21:02
  • $\begingroup$ @Tpofofn Right. Sorry about that. $\endgroup$ Nov 25, 2016 at 22:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .