[ODE] On torque ..
Jon Watte
hplus-ode at mindcontrol.org
Fri May 7 14:50:57 MST 2004
> This function should return the torque which needs to be applied
> to the body in order to rotate the coordinate system onto the new
> forward vector in the given amount of time.
You have an input angular momentum that needs to be counter-acted, as well as enough torque applied to make the object spin towards where you want it in the time prescribed. Even worse, you may also want the constraint that the object reaches the desired orientation with zero (or close to zero) rotational momentum; else it'll over-shoot on the next step.
Just write this out symbolically as integrals.
You start with some angular momentum A, and direction D.
You want to apply torque T such that at time t you have angular momentum A' and direciton D'.
Because there is a constraint on A', you need at least a two-valued torque; "acceleration" and "breaking". The easiest way to model this is with a linear function that starts out as T1 and ends as T2, although another way to model this, which uses less absolute instantaneous torque, is a stair-step function that uses T1 for some dt, and then T2 for (1-dt) time.
Plug it into your favourite differential equation solver, and out comes the solution, although the stair-step version would probably have to be solved iteratively.
Cheers,
/ h+
More information about the ODE
mailing list