Read IK (iTaSC) Jacobian Data

Is there some way for me to read the current (final/solved) value of the Jacobian that the iTaSC IK solver uses? My true objective is to measure the ‘kinematic coefficient’ of a mechanism in its current state, and thus estimate the mechanical advantage. My research thus far has not yielded any results:


WORKAROUND: Ended up not being able to figure out the real solution, so I made a quick and dirty script to get an approximation. Basically measures the current rotation between sequential bones, then shift the IK target slightly, measure angles again and find the delta. (then move the target object back, haha).

import bpy
from mathutils import Vector
from math import acos, fabs

# select the armature to work with
arm =['ArmatureObject'].pose

# set the object to move
control_object =['Empty']

# set the test direction to move (global)
delta_cart = Vector([0, 0, 1e-2])

# trace, for 3x3 matrices only. not sure why this isn't in mathutils?
def trace(matrix):
    return matrix[0][0] + matrix[1][1] + matrix[2][2]

def getRotationRelativeToParent(bone):
    if bone.parent == None:
        return None
    mat1 = bone.parent.matrix.to_3x3()
    mat2 = bone.matrix.to_3x3()
    relative = mat1 * mat2
    # surely there is a better way to check the identity transform?
    if relative[0][0] > .9999 and relative[1][1] > .9999 and relative[2][2] > .9999:
        return 0
    # now use angle axis form to
    # TODO might need some sign checking
    assert (trace(relative) - 1)/2.0 > -1 and (trace(relative) - 1)/2.0 < 1, 'acos will fail'
    theta = acos((trace(relative) - 1)/2.0)
    return theta

# dictionary. key is name of bone. values are initial, final, delta
boneMetrics = {}

# for each bone... log its current rotation relative to parent
print('Performing Initial Pass...')
for bone in arm.bones: # each is an object
    boneMetrics[] = {'initial':getRotationRelativeToParent(bone), 'final':0, 'delta': 0}

# move control_object a bit
control_object.location = control_object.location + delta_cart

# force a redraw to update positions
bpy.ops.wm.redraw_timer(type='DRAW', iterations=1)

# for each bone... log its new rotation relative to parent
print('Performing Second Pass...')
for bone in arm.bones:
    boneMetrics[]['final'] = getRotationRelativeToParent(bone)
    if boneMetrics[]['final'] is not None:
        boneMetrics[]['delta'] = fabs(boneMetrics[]['final'] - boneMetrics[]['initial'])
        if boneMetrics[]['delta'] > 1e-8:
            print(, ' ... ', delta_cart.magnitude/boneMetrics[]['delta'], 'Nm / N')

# move the control object back
control_object.location = control_object.location - delta_cart