Welcome to ask.woodem.org. You may post when you login through your GitHub account.

Imposing motion on a body - Position Vs. Velocity

0 votes
asked Apr 27, 2017 by andrewDEM (340 points)
Hi Vaclav,

1- To impose motion on a body I'm using the InterpolatedMotion approach:

-XYZ positions using a "Vector3" type for "poss="
-Euler parameters e0 e1 e2 e3 using a "Quaternion" type for "oris="

poss1=[Vector3(dx[i],dy[i],dz[i]) for i in range(len(dx))]
oris1=[Quaternion(e0[i],e1[i],e2[i],e3[i]) for i in range(len(dx))]

The InterpolationMotion approach WORKS WELL!

2- Now I'm trying to use the VariableVelocity3d approach:

-Vx Vy Vz velocities using a "Vector3" type for "vels="
vel1 = [Vector3(vx[i],vy[i],vz[i]) for i in range(len(dx))]
bodyNode.dem.impose = S.lab.bodyForce + woo.dem.VariableVelocity3d(times=t,vels=vel1,ori=oris1vel)

-but for the "ori=" parameter, I have tried many combinations and NONE of them work:
    -using oris1vel = [Quaternion(e0dot[i], e1dot[i], e2dot[i], e3dot[i]) for i in range(len(dx))]
    -using oris1vel = [Quaternion(e3dot[i], e0dot[i], e1dot[i], e2dot[i]) for i in range(len(dx))]
    -using oris1vel = [Quaternion(e0[i],e1[i],e2[i],e3[i]) for i in range(len(dx))]
I keep getting the following error: "No regestered converter was able to produce a C++ rvalue of type Eigen::Quaternion<double, 0>"

According to the documentation, VariableVelocity3D is expecting:
vels(= []) Components of velocity, in local coordinates defined by ori (page 326). [type: vector<Vector3r>]
ori(= Quaternion((1, 0, 0), 0)) Orientation of coordinate axes (by default, impose velocity along global axes) [type: Quaternion233]

Also, I noticed that InterpolatedMotion uses for "oris" a [type: vector<Quaternionr>] , which is different than the Quaternion233.

Is there anymore documentation to understand what to use with VariableVelocity3d and oris= ?



1 Answer

0 votes
answered Apr 29, 2017 by eudoxos (49,150 points)
edited May 1, 2017 by eudoxos

Hi, the VariableVelocity3d.ori is only used to define a single orientation (that's why the conversion from list of quaternions fails), if all precribed velocities are to be transformed. InterpolatedMotion.oris is a different thing, that is a sequence of orientations; VariableVelocity3d.oris does not exist.

What is the problem you are trying to solve? Precribe all 6 components of velocity (3) and angular velocity (3)? I'd create a new subclass of Impose for you if you need that. Not difficult.

Cheers! Vaclav

commented May 1, 2017 by andrewDEM (340 points)

Hi Vaclav,

the 6 components of Velocity could be:
Vx, Vy, Vz in Global Coordinate System
Vrx, Vry, Vrz in Global Coordinate System also

or if it helps:
Vx, Vy, Vz in Global Coordinate System
d/dt(e0,e1,e2,e3) -> the time derivatives of the 4 euler parameters



commented May 1, 2017 by eudoxos (49,150 points)

Hi Andrew,

this was added in https://github.com/woodem/woo/commit/6c21375eab7a08d740d0c1d6b6a14ada3e726115 , see https://woodem.org/woo.dem.html#woo.dem.VariableVelocity3d.angVels for documentation, also the unit test https://woodem.org/_modules/woo/tests/demfield.html#TestImpose.testVariableVelocity3d_rot .

I eventually went with extending VariableVelocity3d, where the angVels component is optional, rather than creating a new derived class.

Cheers, Václav