Page 1 of 1

Trouble with Inverse Dynamics with exoskeletons

Posted: Sat Jun 26, 2021 3:53 pm
by dejan_bodiroga
Hello everyone. My name is Guillermo, and I started to work with OpenSim and Moco some months ago. I already wrote this message in the OpenSim forum but I think it fits better here. I would like to ask for some piece of help for a project I'm involved in. I am working with the 3D model, subject_walk_armless.osim, and I've built an exoskeleton on it, as it can be seen in the picture.

Image.

The exoskeleton is composed of two bodies in each leg, the upper bodies are connected to the hip through CustomJoints with 3 DOF each, all of them rotations, while the lower bodies are connected to the tibia through PointConstraints so as to close the loop.

First of all, I performed a Inverse Kinematic analysis in OpenSim by loading marker_trajectories.trc, obtaining the evolution of generalized coordinates in time. Then, I tried to perform a dynamical analysis in Moco so as to obtain generalized forces and torques. For that purpose, I built a Matlab script based in exampleMocoInverse.m, adapted to my problem, using my .osim model, and the .mot file I obtained by doing the Inverse Kinematics. The file can be seen in this picture.

Image

Here the problems arrive. When I make the optimization problem begin, it never reaches a solution, the problem takes so many iterations until reaching the maximum number of iterations allowed, and I don't know what could be happening. I tried to reduce the time interval in the Moco script, and increase the mesh interval, but none of these worked to obtain a solution. Please, could someone give me an idea to solve this problem? Thank you very much.

Re: Trouble with Inverse Dynamics with exoskeletons

Posted: Mon Jul 12, 2021 9:53 am
by nbianco
Hi Guillermo,

Thanks for trying out Moco!

There's several things that could be causing you to hit the max number of iterations (which you can change by the way, but ideally this is not necessary). My first thought is that the problem is related to how the exoskeleton is connected to the body. The problem might be having trouble enforcing the PointConstraints, depending on how the exo is actuated. Did you add CoordinateActuators to the 3 DOF hip joint and/or the "knee" joint of the exo?

-Nick

Re: Trouble with Inverse Dynamics with exoskeletons

Posted: Thu Jul 15, 2021 3:47 am
by dejan_bodiroga
Hi Nicholas,

Thank you very much for your response. Yes, I added Coordinate Actuators to every coordinate created in the exoskeleton, but the optimization algorithm never stops. Maybe is it related to the predetermined tolerance? Aproximately at 300 iterations, the value of cost function barely changes, I've tried to change optimization parameters but Matlab does not recognize the following sentences:

solver.set_convergence_tolerance(1e-3);
solver.set_constraint_tolerance(1e-3);

What else could we do?

Thank you very much,
Guillermo

Re: Trouble with Inverse Dynamics with exoskeletons

Posted: Mon Jul 19, 2021 4:16 pm
by nbianco
Hi Guillermo,

If the cost isn't changing much at 300 iterations you might be close to a solution (even if the iteration-to-iteration time is slow). Are you currently trying to solve the problem with muscles? You could try removing the muscles from the model and replacing them to torque actuators to speed up the problem significantly. Once you have confidence that the constraints are being met, then you could reintroduce the muscles.

If you're using the a MocoSolver directly, those lines will need to be

Code: Select all

solver.set_optim_convergence_tolerance(1e-3);
solver.set_optim_constraint_tolerance(1e-3);
Best,
-Nick

Re: Trouble with Inverse Dynamics with exoskeletons

Posted: Tue Jul 20, 2021 9:10 am
by dejan_bodiroga
Thank you very much Nicholas, I'll try what you said and I'll tell you what results.

Greetings,
Guillermo