[ODE] matching body orientation

Erin Catto erincatto at sbcglobal.net
Sat May 7 23:44:49 MST 2005


I'm not sure how to do this in ODE, but in principle you need to create 3
angular constraints.

Let x, y, z be orthonormal axes fixed in the body. Let
xr, yr, and zr be the columns of the rotation matrix formed from your
reference quaternion (qd). Now form 3 angular constraints:

dot(x, zr) = 0
dot(y, zr) = 0
dot(z, xr) = 0

This should be a sufficient set of equations. Note that a 180 degree flip is
possible, so you have to ensure the reference quaternion is not too far from
the current body quaternion.

Now to form the velocity constraint, you just differentiate the angular
constraints with respect to time:

w % x * zr + x * wr % zr = 0
w % y * zr + y * wr % zr = 0
w % z * xr + z * wr % xr = 0

where * is the dot product, % is the cross product, w is the angular
velocity of the body, and wr is the desired angular velocity. Using the
scalar triple product identity:

x % zr * w = - x * wr % zr
y % zr * w = - y * wr % zr
z % xr * w = - z * wr % xr

This is linear in w and can be written in matrix form as

J w = b

where J is the constraint Jacobian and b is the reference constraint
velocity.

You will also need to stabilize the velocity constraint by feeding the
angular constraint error into the right hand side by adjusting b, for
example:

b1 = b1 - beta * dot(x, zr)

where beta is called ERP in ODE speak (and the Baumgarte parameter in the
literature).

I'm not sure if this is implemented in ODE, but it shouldn't be difficult.

Erin

-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org] On Behalf Of Daan
Nusman
Sent: Saturday, May 07, 2005 7:49 AM
To: ODE Mailing List
Subject: [ODE] matching body orientation

Hi everyone,

First some background information (for the interested, you can skip 
this): for my thesis I'm working on connecting an experimental full-body 
motion capture suit, that uses inertial sensors, to an ODE articulated 
human body, in a distributed virtual environment. I've created a ragdoll 
that works quite well, using ball joints and hinge joints. Now I'm 
looking for a way to control the ragdoll using the motion capture suit. 
The suit measures the absolute orientation of each limb, represented by 
quaternions. So onto..


THE QUESTION: I've got some quaternion 'qd' and an ODE body with 
quaternion 'qb'. I want the body to (try to) orient itself from qb to qd 
during the simulation. How can I best do this?


One option seems to be to take the 'forward' vectors of qd and qb, use 
the cross product on them to find the torque axis, and use the dot 
product to find out how much force is required (how long the torque axis 
should be). This is essentially a spring as described in section 7.5 of 
the manual, but only angular, I guess. So the problems are: finding a 
usable spring constant, the body has to come up to speed in several 
steps, and possible extra forces might lead to the body never reaching 
the orientation or speed at all. Another problem is that the body won't 
match the rotation along the forward axis. I'd have to add torque along 
the forward axis, but I can't figure out how much that would be.

I've looked at the angular motor, but I must admit I don't really 
understand the user mode. Does anyone know if the amotor is suitable to 
do this?
- should I attach the amotor to only one body?
- what kind of axes should I set? How should I relate the velocity of 
the axes to my desired quaternion?


Any help would be greatly appreciated,
Daan Nusman
www.keepitsimple.nl

_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode




More information about the ODE mailing list