Page 1 of 1

IK code details

Posted: Thu Apr 24, 2014 2:51 am
by fantasymew
Hello,

I am tracing IK codes to know more about IK details. I know there are lots of comments in the codes, but too many professional terms. Could you help me realize something, thanks.

In InverseKinematics::run(), we create an IK solver, and the parameter markersReference comes from <IKMarkerTask>, coordinateReferences comes from <IKCoordinateTask>. After some setup, IK solver calls assemble(SimTK::State &s) and track(SimTK::State &s) in a for loop. I think these two are core functions in whole IK flow. According to my tracing, assemble(SimTK::State &s) should be AssemblySolver::assemble(SimTK::State &state) and track(SimTK::State &s) should be AssemblySolver::track(SimTK::State &s).

It says that assemble() is to assemble a model configuration that meets the assembly conditions (desired values and constraints). So, assemble() finds an solution for initial state, and track() tracks the small change between each frame, that is, the solution for t2 is based on the solution for t1, am I right? And why track() tracks from i = 0 not from i = 1. I see that the code Assembler::assemble() and Assembler::track(Real frameTime) are almost the same. track() indeed is a repeated assembly. It seems that the first frame is assembled twice, one in assemble() and one in track()?

Thank you very much. :)

Best regards,

Yu-Wei

Re: IK code details

Posted: Sun Apr 27, 2014 11:21 pm
by jimmy
Hi Yu-Wei,

looking at the InverseKinematicsTool() code, it seems as if ikSolver.assemble(s) is taking the initial set of states and configures the model without enforcing constraints. This would be to get an initial guess of model configuration.

IkSolver.track(s) iterates through each frame (all array references start from "0", not "1") and obtains a model configuration for the model while satisfying (or close to satisfying) the constraints.

cheers,
-james

Re: IK code details

Posted: Sun May 04, 2014 7:58 pm
by fantasymew
Hello, James,

Thanks for your reply. I got more clear about the IK flow. Thank you very much. :)

Best regards,
Yu-Wei