current inverseDynamicsSolver can be faster
Posted: Tue Jan 05, 2016 3:27 am
Hi,
I think the current inverse dynamics solver is suboptimal and can be faster. In the current code, the stage is realized to dynamics. This is however not necessary, the velocity stage should suffice, since this stage already allows to compute the coriolis forces.
I added some code, where I compare my inverse dynamics with the current inverseDynamicsSolver using sit-to-stand movements. The output is exactly the same, but my method is about 9 times faster. If I change my method to (unnecessarily) realize up to dynamics stage, the needed calculation time is in the order of magnitude of the current inverseDynamicsSolver.
Since I only have beginner c++ skills, I implemented my inverse dynamics solver using the vectors of the dynamic equation:
tau = M*udot + J*(h - g - Fext)
with tau the joint torques, M the mass matrix, udot the generalized accelerations, J the system Jacobian, h the coriolis forces in the body frame, g the gravitational forces in the body frame and Fext the external forces in the body frame.
I included the used kinematics and ground reaction forces files. One can use the gait2392 musculoskeletal model.
Maybe someone with more coding experience can have a look at it, to see if my statements also holds for other situations. If so, the current inverseDynamicsSolver might be improved in the next OpenSim version?
Regards,
Kevin
I think the current inverse dynamics solver is suboptimal and can be faster. In the current code, the stage is realized to dynamics. This is however not necessary, the velocity stage should suffice, since this stage already allows to compute the coriolis forces.
I added some code, where I compare my inverse dynamics with the current inverseDynamicsSolver using sit-to-stand movements. The output is exactly the same, but my method is about 9 times faster. If I change my method to (unnecessarily) realize up to dynamics stage, the needed calculation time is in the order of magnitude of the current inverseDynamicsSolver.
Since I only have beginner c++ skills, I implemented my inverse dynamics solver using the vectors of the dynamic equation:
tau = M*udot + J*(h - g - Fext)
with tau the joint torques, M the mass matrix, udot the generalized accelerations, J the system Jacobian, h the coriolis forces in the body frame, g the gravitational forces in the body frame and Fext the external forces in the body frame.
I included the used kinematics and ground reaction forces files. One can use the gait2392 musculoskeletal model.
Maybe someone with more coding experience can have a look at it, to see if my statements also holds for other situations. If so, the current inverseDynamicsSolver might be improved in the next OpenSim version?
Regards,
Kevin