# I Constant angular acceleration in 3D?

1. Sep 20, 2016

### yahastu

In 1-dimensions, the final orientation after undergoing constant angular acceleration is:

$$\theta_f = \theta_0 + \omega_0 t + 0.5 \alpha t^2$$

What is an analogous equation in the 3D case?

In other words, if I know the initial orientation (say, as a quaternion), angular velocity (as a 3-vector, representing axis and speed), and constant angular acceleration (as a 3-vector, about a different axis), what is the final orientation of an object (as a quaternion)?

Note: if there is a more elegant way to represent the problem (eg, not using quaternions) then that is fine. I'm really just looking for the most elegant/direct way to compute the final orientation with a closed form expression.

EDIT: I'm thinking the below might be a solution, though I haven't verified it yet...

$$Q_f = Q_0 + \frac{t}{2} Q_{\omega} Q_0 + \frac{t^2}{4} Q_{\alpha} Q_0$$

where $$Q_0$$ is the initial orientation expressed as a quaternion, $$Q_{\omega} = (0, \omega)$$ is a non-normalized quaternion representation of the angular velocity $$\omega$$ expressed as axis multiplied by rate of spin, and $$Q_{\alpha} = (0, \Delta \omega)$$ is similarly defined as a quaternion representation of angular acceleration.

Can anyone confirm or deny this?

Last edited: Sep 20, 2016
2. Sep 20, 2016

### Simon Bridge

We would normally do the math modelling using rotation matrixes rather than quaternions these days ... because computers.
You can easily translate that into quaterion equations if you need rapid rendering... it will also help you troubleshoot your result.

It is also possible to translate the 2D rotation into a 3D rotation just by doing the transforms to an arbitrary plane... you do that by rotating the object in the plane, and defining the plane wrt arbitrary 3D orientation.

3. Sep 21, 2016

### yahastu

By all means, if you know how to formulate the answer to my question in terms of rotation matrices, please do share it.

4. Sep 22, 2016

### Simon Bridge

You can derive the rotation matrix that is appropriate to your problem by transformation ... so why not do it yourself.
You want to know the new orientation of a vector $\vec v = (v_x,v_y,v_z)^T$ after rotation in 3D - this is basically a rotation about a defined axis $\vec u = (u_x, u_y, u_z)^T$ ... define a new coordinate system which put the +z' axis along the $\vec u$ direction, and $\vec v$ initially lies in the x'-z' plane.
You can handle that rotation right?
Next step is to transform final $\vec v$ back to the original coordinates.

The result of a rotation about an arbitrary axis, the matrix is given by:
https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
... so just substitute $\omega t$ for $\theta$ in the description to get the matrix for a rotation at a constant angular velocity.

The precise method depends on what you want to achieve: why do you want to do this? What is it for?

5. Sep 23, 2016

### yahastu

I'm not confused how to construct a rotation about an axis. I'm confused how to translate the constant angular acceleration into a rotation.

The reason I am seeking a closed form expression is because I need to solve the inverse problem - I need to compute the torque and force required to apply to an object in order to achieve a desired position, orientation, with zero velocity and zero angular velocity, after a given period of time.
I can solve this problem approximately using nonlinear least squares if I can construct an analytical equation for the angular acceleration component and then differentiate it with respect to the angular acceleration elements.

6. Sep 23, 2016

### yahastu

For future posterity, I have verified (through simulation) that the equation I proposed in my original edit seems to be correct.

7. Sep 23, 2016

### yahastu

Furthermore, I have worked out an equivalent formulation of

$$Q_f = Q( (t^2/2) \alpha ) Q( t \omega ) Q_0$$

where \omega is angular velocity, \alpha is angular acceleration, and Q(x) means quaternion from x, where x is an axis-angle.

8. Sep 24, 2016

### Simon Bridge

... If you know how to construct a rotation of angle $\theta$ about an arbitrary axis $\vec u$ then you just put $\theta=\omega_0 t + \frac{1}{2}\alpha t$ into your expression for the rotation and you have constructed a rotation at constant angular acceleration $\alpha$ after time $t$.

... sure: the forward problem us $\vec r = R\vec r_o$ then the inverse expression is $\vec r_0 = R^{-1}\vec r$ ... where the vectors are however you are encoding the orientation and R is the rotation matrix.

...
Your problem is also over specified - some combinations of your constraints are not physically possible.
$\tau = I\omega_0/T$ is the torque required to slow an object from initial angular velocity $\omega_0$ to rest in time T.
The angle the object rotates in this time is $\theta = \frac{1}{2}\omega_0T$

... or you can do it analytically as above.
This is why it is useful to know what you are using this for. If you are constructing a computer simulation then the answer would be different.
However, you should already have all the tools you need to figure out what you need.

Well done:
I knew you had the tools to figure this out. :)

9. Sep 24, 2016

### yahastu

No, that's just the original equation for constant angular acceleration in the 2D plane embedded in a 3D space. It is not a solution to the general 3D case because, in general, angular velocity and angular acceleration are not about the same axis.

The problem is over-determined, but not over-specified: there are 6 unknowns (for linear and angular acceleration) and at least 12 constraints (3 for desired final position, 3 for desired final orientation, 3 for final velocity=0, and 3 for final angular velocity=0). I'm actually using more constraints to evaluate the rotation aspect but that's another matter.

If you ignore the position constraints, then yeah, you may be able to directly solve for the time it takes to stop moving -- but you don't move anywhere close to the desired destination. What about the case where you start from rest and want to move to a location far away?

Because there are more constraints than parameters, it is true that there is no exact solution but there is a unique least squares error solution, and this is what I'm after. Least squares solutions don't generally have closed form solutions.

Depends what you mean by simulation -- but yeah, I'm using a computer to solve this problem 90 times per second in order to determine force and torque to apply to an object in order to meet continuously updated position and orientation targets.

If you know of another more standard way to do this type of force control, I'd be interested to hear it. This is not my area of expertise and I'm sure what I'm doing would be laughed at by any serious robotics person.

Heh, thanks...in retrospect, it does look quite obvious. However I wasn't sure if it was valid to simply apply the acceleration as a separate rotation after velocity, thought that it might produce a more indirect that required solving an integration problem..but I guess not.

It was very surprising to me that the general equation for 3D constant acceleration does not seem to appear in any textbooks, coursework, or online searching.

Last edited: Sep 24, 2016
10. Sep 24, 2016

### Simon Bridge

An arbitrary rotation of angle $\theta$ about axis $\vec u$ in 3D space is given by the rotation matrix $R(\vec u,\theta)$ linked to in prev posts. To turn this into a rotation at constant angular acceleration you use instead: $R(\vec u, \omega_0t + \frac{1}{2}\alpha t^2)$ ... where $\alpha$ is the magnitude of the angular acceleration about the axis $\vec u$. Angular acceleration for rotations is always about the axis of rotation... it is always a 1D pseudovector pointing parallel to $\vec u$. The main issue is that the rotation required to get the new orientation may not share an axis with $\vec\omega_0$ right?

The problem I've been having, and why I have not been able to speak directly to your problem, is that you won't tell me what the problem actually is. You are going out of your way to be vague and general.
See below:

OK lets see ...
Is it the case that you know the initial position, initial linear velocity, the initial angular velocity, the initial orientation, and you want to know the constant torque and linear force needed to come to rest (final angular velocity and final linear velocity both zero) at a specified final orientation and position in a specified time?

11. Sep 25, 2016

### yahastu

I thought it was clear from my post #5, but yes, that is the problem.

If it helps to have more context, I have a hardware sensor measuring position and orientation of a hand-held object in 3D space at 90 hz.
I also have a physics simulation (that I did not implement) containing a virtual representation of this same object.
My objective is to continually update the virtually applied force and torque in the physics sim such that the movement of the simulated object matches that of the real object as closely as possible.

12. Sep 25, 2016

### Simon Bridge

OK - and you are hoping that 1/90 th of a second is a small enough time that the applied forces can be taken as constant?

The purpose makes a difference.
The problem of what forces to apply would normally be solved by applying three torques ...
1. stop the initial rotation
2. start the motion to the new orientation
3. stop the motion started in 2 at the correct new orientation
... I suspect it is not going to be possible to do that in a single constant torque, not in general. There are stability issues, tumbling, and precession.
These issues are not a problem for an object that can be comfortably held in your hand because the hand does not rely on just using one constant torque etc. You are unconsciously adjusting your forces to account for the issues as they arise.
The model may be too simple - but nothing ventured right?

MIT has a course called "rigid body dynamics" which I think you will need in order to do what you want the way you want to.
https://ocw.mit.edu/courses/aeronautics-and-astronautics/16-07-dynamics-fall-2009/lecture-notes/
... L25-31. Good luck.

If all you want to do is match the computer model to the object, and you already have "a hardware sensor measuring position and orientation of a hand-held object in 3D space"... then why not just use the data from the sensor directly?