Page 1 of 1

MobilizedBody_FunctionBased - mapping between qdot and u

Posted: Wed Jul 06, 2022 2:40 pm
by nicos1993
Hello, I am currently to understand how there is an exact mapping between qdot and u (e.g., qdot = N(q)u, where N(q) = Identity matrix) when using the MobilizedBody_FunctionBased class (https://github.com/simbody/simbody/blob ... ionBased.h), and I am therefore wondering whether anyone could please provide some clarity on this matter?

For some context, I am using a custom joint within OpenSim which then relies on the MobilizedBody_FunctionBased class. If I take the u's for this particular mobilizer to be the angular velocity vector, and I then parameterize the transform with Euler angles shouldn't N(q) be the matrix which converts the angular velocity (u) to Euler angle derivatives (similarly to how it is necessary for the ball and socket mobilizer as explained in equation 10 of [1])? Hopefully my question makes sense and it isn't silly!

[1] Seth et al. (2010). Minimal formulation of joint motion for biomechanisms. Nonlinear dynamics.

Best wishes,

Nicos Haralabidis

Re: MobilizedBody_FunctionBased - mapping between qdot and u

Posted: Wed Jul 06, 2022 3:28 pm
by sherm
Hi, Nicos. No, that's a very reasonable question!

The answer is that FunctionBased Mobilizer is a special case of Custom Mobilizer provided for convenience. The author of that class designed it to work only for mobilizers where qdot=u (that is, N=identity). The general Custom mobilizer supports N != identity but FunctionBased does not.

So if you use FunctionBasedMobilizer and you want to use Euler angles for orientation, you must make the generalized speeds Euler angle derivatives rather than angular velocity components. There is nothing magical about using angular velocity for generalized speeds though, so using Euler angle derivatives is likely a reasonable alternative. That makes qdot=u so the requirements of the FunctionBasedMobilizer are met.

Regards,
Sherm

Re: MobilizedBody_FunctionBased - mapping between qdot and u

Posted: Wed Jul 06, 2022 6:15 pm
by nicos1993
Hello Sherm,

Thanks for the prompt reply.

So it's more for ease of implementation than necessarily being correct (?). I am trying to think of a use case in 3D which it makes sense to me - as wouldn't the hinge map matrix (which I am interpreting to be the Jacobian of the transform wrt q) in equation 2 of [1] be the identity/constant matrix for transforming to angular velocity? In which case the spatial angular velocity is equal to u, which happens to be the time derivatives of the Euler angles. I think I have just been thinking about it for too long incorrectly and I am just missing some vital intuition!

Best wishes,

Nicos Haralabidis

Re: MobilizedBody_FunctionBased - mapping between qdot and u

Posted: Wed Jul 06, 2022 10:33 pm
by sherm
No, sorry Nicos. Angular velocity is not the derivative of Euler angles (except in one special case: when all three Euler angles are zero). Otherwise you have to use Euler angle derivatives for u to get N=identity. Angular velocity is in fact not the derivative of any set of q's -- there is always a non-identity N if you want qdot=N(q)*w for angular velocity w.

If you know the Euler angles and derivatives, you can calculate angular velocity. If you know Euler angles and angular velocity you can calculate Euler angle derivatives. Simbody has utility functions for those conversions.

The FunctionBasedMobilizer is precisely correct in its defined domain; it is not an approximation of any kind. Its documentation explains when you can use it -- only in the case where qdot=u. If you want to define a mobilizer for which qdot != u, you can't use FunctionBasedMobilizer to do it (but you can use Custom Mobilizer).

Please let me know where you need further clarification.

Sherm

Re: MobilizedBody_FunctionBased - mapping between qdot and u

Posted: Thu Jul 07, 2022 3:25 pm
by nicos1993
Hello Sherm,

Thanks for the super clear explanation, with your help I think I have finally understood it!

q: Euler angles; u: Euler angle derivatives
In the case where qdot = N(q).u (as per the mobilizedbody_functionbased class), N = identity, and the spatial angular velocity w = H(q).u, with H(q) the matrix to map from Euler angle derivatives to angular velocity w.

q: Euler angles; u: angular velocity
In this case qdot = N(q).u, N(q) is the matrix to map from angular velocity to Euler angle derivatives, and the spatial angular velocity w = H(q).u, with H = identity.

Hopefully that's correct and I appreciate the time given for the explanation, it certainly helps in understanding more than just the behaviour of the functionbased class!

Thanks,

Nicos