# Inverse kinematics on motion capture data

Discussion in 'Simulation' started by Radu Darie, Dec 6, 2017.

Hi,

I am working on using MuJoCo (version 1.50, with mujoco-py) to estimate joint torques from motion capture data of an animal walking on a treadmill (like several other people on this forum, it seems). Empirically, I've arrived at a combination of solver parameters that generates realistic looking ground reaction force profiles in terms of magnitude and time course. However, these values don't make much physical sense to me. I use:

solimp = '1e-6 1e-6 1e-3' (However, I have also set impedance = 'constant', so I don't believe dmin and width have any effect. Is this correct?)
solref = '7.5e-4 5e1'
impratio = '1e3'
friction = '1 5e-3 1e-4' (I left it as default)

I get inverse kinematics by solving the optimization problem of finding a qpos vector which minimizes the squared error between the position of sites on my model and the 3D positions of optical markers, then compute qvel and qacc by doing finite differencing. (Note that I wasn't aware of the mocap bodies mechanism when I implemented this as an optimization problem... Sigh. However, this part works well). I then run mj_inverse and examine the output of mj_contactForce for the active contacts and find that the ground reaction forces have expected magnitude and shape. (here, I am assuming that as long as all of my inputs are in SI units, these values will also be SI, so N for the translational forces and N*m for torques). I also look at qfrc_constraint and find that these forces produce realistic torques at the joints. However, when I run any forward simulations with these parameters, the result is, expectedly, a mess, with a very bouncy floor and exploding position values. I wonder what might be causing this discrepancy.

While trying to troubleshoot this question, I added a piece of code to check that the equations of motion are being satisfied, i.e. that

qfrc_inverse + qfrc_passive + qfrc_constraint = M * v' + qfrc_bias

Where I calculate M * v' as mj_mulM(model, data, MVDot, qacc). There are no applied forces. Is there anything wrong with that equality? It is always false after running mj_inverse.

Thanks for any help,