# Angular velocity from orientation

Asked by Daniela on 2011-07-12

Hi,

I have already learned here, that if I want to change the position of a body, I must define the velocity in delta_t in order to obtain the desired position.
Now, if I want to rotate the body, I suppose I should proceed the same way, I mean, define the angular velocity that will take my body in the desired orientation. Is this right or can I impose the rotation in this case? If I need to calculate the angular velocity, how can I do this in yade?

Thanks in advance. Daniela

## Question information

Language:
English Edit question
Status:
For:
Assignee:
No assignee Edit question
Last query:
2011-07-19
2011-07-20
 Anton Gladky (gladky-anton) said on 2011-07-18: #1

>Now, if I want to rotate the body, I suppose I should proceed the same way, I mean, define the angular velocity that will take my body in the desired orientation.
Yes.

> If I need to calculate the angular velocity, how can I do this in yade?
I do not clear understand the question. What input data do you have?

 Daniela (dmaionchi) said on 2011-07-19: #2

Hi Anton,

if I had the angles as input data I could just calculate the angular velocity using w = delta theta/ delta t.
But in my case I just have the quaternions defining the orientation. I mean if I know the orientation of the body in the time t1 and in the time t2, could I maybe calculate the angular velocity necessary to change the orientation of the body in yade using a special function? If not, how should I proceed?

I always heard that it is better to work with quaternions instead of euler angles. Because this I though that there should be an easy way to do such calculations.

Thanks in advance, Daniela.

 Anton Gladky (gladky-anton) said on 2011-07-19: #3

Hi Daniela,

Yade has some functions to work with quaternions from python interface:

You can create quaternions, get angles, axis from it etc.

Anton

 Bruno Chareyre (bruno-chareyre) said on 2011-07-19: #4

Quaternion are better yes, but maybe not simpler...
It should not be very difficult but I don't have the exact solution
coming to mind a.t.m.
Maybe something like \$\$rot=(q(t+dt)*q^{-1}(t))/dt\$\$, then get axis and
angle from rot?
You will have to read about quaternions arithmetic and run some tests to
be confident in a solution.

It is a bit ackward to have a list of orientations as input data. Isn't
there a chance to define the problem differently?

Bruno

 Daniela (dmaionchi) said on 2011-07-20: #5

Actually I could work directly with the angles. At the moment my data contains the quaternions for the orientation, but I can define it differently in order to have data containing the angels and axis.
Thanks again for the help. Daniela

 Bruno Chareyre (bruno-chareyre) said on 2011-07-20: #6

Even better: can't you define velocity as the input data instead of
position. :-)
> Daniela posted a new comment:
> Actually I could work directly with the angles. At the moment my data contains the quaternions for the orientation, but I can define it differently in order to have data containing the angels and axis.
> Thanks again for the help. Daniela
>