Quaternion rotational constraints

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
JoeLubertazzi
Posts: 9
Joined: Sun May 01, 2016 12:45 am

Quaternion rotational constraints

Post by JoeLubertazzi »

I've begun researching quaternion constraints, and am trying to implement a simple constraint that locks a body's orientation to a target orientation (i.e. a 3 DoF constraint). My constraint is defined as:

C = β * ϴ^-1; β = target orientation, ϴ = body orientation, i.e. the delta between the body and target orientations is 0.

Deriving C:

dC/dt = 0.5 * β * (w * ϴ)^-1; w here is a pure quaternion with real part equal to 0
= 0.5 * β * ϴ^-1 * -w; w^-1 = -w for pure quaternions
= -0.5 * G(β) * E(ϴ^-1)^T * w; G and E are defined as per this (see 14.1 and associated notation)

J by inspection is then:

J = [ 0 -0.5 * G(β) * E(ϴ^-1)^T ]

Computing K:

K = 0.25 * G(β) * E(ϴ^-1)^T * I^-1 * E(ϴ^-1) * G(β)

K is a 4x4 matrix, which to me means we are removing 4 DoF as per quaternion-space, or 3 DoF as per R^3 (this could be an entirely incorrect assumption).

Computing lambda for the position constraint is then:

λ = K^-1 * -C; C here is represented as (C.W, C.X, C.Y. C.Z) for matrix multiplication, λ is a 4-vector

I then calculate my impulse as:

P = J^T * λ

J^T yields me E(ϴ^-1) * G(β)^T, which is a 3x4 matrix, which allows me to convert λ back into R^3. This impulse is then applied normally to the body.

I believe my derivation is sound, however this does not work. I believe either my algebra is mistaken or my initial constraint equation is incorrect. If anyone can offer any advice and help me come to better understand quaternion constraints it would be much appreciated.

- Joe Lubertazzi
Post Reply