IK code details

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Yu-Wei Chen
Posts: 13
Joined: Wed Jan 08, 2014 1:13 am

IK code details

Post by Yu-Wei Chen » Thu Apr 24, 2014 2:51 am

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

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: IK code details

Post by jimmy d » Sun Apr 27, 2014 11:21 pm

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

User avatar
Yu-Wei Chen
Posts: 13
Joined: Wed Jan 08, 2014 1:13 am

Re: IK code details

Post by Yu-Wei Chen » Sun May 04, 2014 7:58 pm

Hello, James,

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

Best regards,
Yu-Wei

POST REPLY