hi everyone,
I am struggling with an issue with my inverse kinematics.
I have a dataset of c3d files which I have converted to trc and mot files. I have ensured the global rotations have been performed to match the coordinate systems during the conversion.
However, when I perform inverse kinematics, I can only achieve the correct solution when the participant is walking in one direction down the lab.
All the data in the other direction provides incorrect solutions, I have previewed all my experimental data on the GUI and it is in the correct coordinate system.
I have ensured my model pelvis to ground joint allows for full pelvic rotation and still no luck.
I think the scaling is good as the one direction provides accurate results, is there any other reason why this may be happening as I am at a loss.
Many thanks,
Caitlin
change in walking direction affects inverse kinematics
- Caitlin Edgar
- Posts: 12
- Joined: Thu Mar 17, 2022 2:23 am
- Ton van den Bogert
- Posts: 166
- Joined: Thu Apr 27, 2006 11:37 am
Re: change in walking direction affects inverse kinematics
It could be the constraints, but it sounds like you already checked that. Make sure the pelvis_rotation (rotation about a vertical axis) has a range of -180 to +180 to allow all possible walking directions. If the walking direction varies around 180 degrees, a range of 0 to 360 would be better, otherwise the solver needs to go back and forth between -180 and +180. But then you hit the bounds when walking direction is around zero. Maybe a range of -270 to +270 will eliminate all such problems.
It could also be the initial guess. Inverse kinematics is a nonlinear optimization problem and the solver will only find the true optimum if the initial guess is good enough. If not, the solver may result in a "twisted" pose that is a local optimum. Typical symptoms would be joint angles that are "stuck" at their limits.
I assume that IK uses the default pose of the model as an initial guess for the first frame. The first frame solution is then used as an initial guess for the second frame, and so on. If the first frame is twisted, it will likely stay twisted for the whole trial. This also explains why a change from -180 to +180 degrees will be hard for the solver. The initial guess is then very far from the solution.
You could try to make the default pose closer to the walking trial by changing the default pelvis rotation in the .osim file:
Change the zero to 90, 180, or whatever your walking direction is. It is not critical, as long as you are within 90 degrees, I think.
Ton van den Bogert
It could also be the initial guess. Inverse kinematics is a nonlinear optimization problem and the solver will only find the true optimum if the initial guess is good enough. If not, the solver may result in a "twisted" pose that is a local optimum. Typical symptoms would be joint angles that are "stuck" at their limits.
I assume that IK uses the default pose of the model as an initial guess for the first frame. The first frame solution is then used as an initial guess for the second frame, and so on. If the first frame is twisted, it will likely stay twisted for the whole trial. This also explains why a change from -180 to +180 degrees will be hard for the solver. The initial guess is then very far from the solution.
You could try to make the default pose closer to the walking trial by changing the default pelvis rotation in the .osim file:
Code: Select all
<Coordinate name="pelvis_rotation">
<motion_type>rotational</motion_type>
<default_value>0</default_value>
Ton van den Bogert
Re: change in walking direction affects inverse kinematics
Hi Caitlin,
I'll second the point made by Ton with respect to ensuring your pelvis rotation bounds allows movement in multiple directions. The default for nearly all models I've come across doesn't allow this, and it always catches me out when we've turned participants around from the 'standard' direction in the lab.
Ton also makes a good point with how you set these bounds. I've done it with -180 to +180 before, and if the model is close to that 180 degree point (e.g. facing directly opposite the axis positive direction) you get these big back and forward jumps in this coordinate.
Aaron
I'll second the point made by Ton with respect to ensuring your pelvis rotation bounds allows movement in multiple directions. The default for nearly all models I've come across doesn't allow this, and it always catches me out when we've turned participants around from the 'standard' direction in the lab.
Ton also makes a good point with how you set these bounds. I've done it with -180 to +180 before, and if the model is close to that 180 degree point (e.g. facing directly opposite the axis positive direction) you get these big back and forward jumps in this coordinate.
Aaron