Simulation of ankle exoskeleton

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Iris Magnusdottir
Posts: 19
Joined: Thu Nov 01, 2018 2:04 am

Simulation of ankle exoskeleton

Post by Iris Magnusdottir » Thu Mar 05, 2020 2:17 am

In this post I will share what I've learned after a Virtual Office Hour with Chris and Nick.
First of all, thank you guys for taking the time. The session was super helpful.

My research goal is to investigate the potential reduction in power and torque demand on actuators in an ankle exoskeleton by adding springs under different assistive modes with the metabolic cost as an observed outcome.
The experimental data used for the simulation includes motion tracking and ground reaction force data.

For the initial simulation of unassisted gait, MocoInverse was selected as the appropriate tool.
Moco does not (not yet) allow evaluation of metabolic cost. However, the Moco results can be analyzed in OpenSim using the Analyze Tool.

Exoskeleton's weight has been shown to result in metabolic penalty for its user. Therefore, my aim is to add this weight to the model. Most models don't consider the effect of increased weight on the ground reaction data. The 2D_gait.osim model (in example2DWalking.m) was selected as it is capable of these considerations. The mass can be added by, for example, increasing the weight of the tibia segment. Adding of components can be done by using OpenSim GUI or Moco, doesn't really matter. MocoInverse will not account for the increased weight, and therefore, switching to MocoTrack is appropriate. MocoTrack needs a lot of fine tuning of parameters to make it work well.

Spring (extension spring) and motor can be added to the model using pathSpring (or SpringGeneralizedForce) and pathActuator. When using pathSpring, be careful that the rest length << path length. Adding the two in series is more complex than in parallel, where one option would be to use pathActuator and a torque spring at the ankle.

My follow up question is this:
The 2D_gait.osim model, as used in the example, is already scaled according to the data being used. Loading the model in OpenSim gives errors as it does not recognize some if its components. Is it possible to make the changes to the original model (gait10dof18musc.osim) after scaling, as done in some other examples?
That is, replace the moving knee flexion axis by a fixed flexion axis, replace the Millard2012EquilibriumMuscles by DeGrooteFregly2016Muscles, and add SmoothSphereHalfSpaceForces (two contact spheres per foot) to model the contact interactions between the feet and the ground.
Or can the 2D_gait.osim be scaled as is?

Again, big thanks to the Moco team!

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Simulation of ankle exoskeleton

Post by Christopher Dembia » Thu Mar 05, 2020 2:25 pm

Iris, thank you so much for posting these notes. I bet they'll be helpful for other users :)

Eventually, DeGrooteFregly2016Muscle will be part of OpenSim and then you can load the model in the GUI. For now, consider creating a separate model for just visualization where you rename DeGrooteFregly2016Muscle with Millard2012EquilibriumMuscle.

User avatar
Iris Magnusdottir
Posts: 19
Joined: Thu Nov 01, 2018 2:04 am

Re: Simulation of ankle exoskeleton

Post by Iris Magnusdottir » Fri Mar 20, 2020 5:48 am

Thanks! Worked.

I am currently having trouble with scaling my model. My setup files work perfectly when scaling gait2354.osim. I tried adding the additional joints to gait10dof18muscl.osim and scale which also worked.

However, I'm trying to scale the 2Dgait.osim as I want its properties with recognizing changes in ground reaction force due to increased mass. This file is build differently than the original gait10dof18musc.osim.
I've tried moving muscles from <components> to <ForseSet> and adding hip_adduction and hip_rotation (changing the joint to CustomJoint) and add pelvis_list, pelvis_rotation and pelvis_tz joints (and to <CoordinateActuator>).
I was not able to add the lumbar joints (bending, rotation, extension), as it stopped loading in the OpenSim GUI (error: Joint::getMotionType() given an invalid CoordinateIndex Thrown at Joint.cpp:224 in getMotionType()).

Is there a better way to add these joints to the model? or the other way around, to make the changes made for 2Dgait.osim to my scaled gait10dof18musc.osim file?

Thanks!

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Simulation of ankle exoskeleton

Post by Christopher Dembia » Fri Mar 20, 2020 11:20 am

Can you explain in more detail the parts of the 2Dgait.osim model that you want to use? It sounds like you are trying to convert 2Dgait into a 3D model, in which case I would suggest you work off of the 3D model that is part of example3DWalking, and carry over any relevant muscle properties manually.

User avatar
Iris Magnusdottir
Posts: 19
Joined: Thu Nov 01, 2018 2:04 am

Re: Simulation of ankle exoskeleton

Post by Iris Magnusdottir » Mon Mar 23, 2020 5:39 am

I'm sorry, I will try to clarify.

I want to see the effect of an ankle exoskeleton on metabolic cost and ankle torque. I was told that 2D_gait.osim model is able to evaluate changes in ground reaction force due to the increased weight of the device (not sure which parts of the model are responsible here). Therefore, I'm interested in using this model to compare ankle torque between assisted and unassisted gait .

I wanted to test using the data provided in example3DWalking (exampleMocoTrack.m), coordinates.sto, with the 2D model. This did not work, which I believe is, due to the scaling of the models where coordinates.sto is generated using OpenSim's full-body model. Please correct me if I'm wrong here.

Therefore, my question is,
Can I add the grf property to the subject_walk_armless.osim model?
or, can I somehow scale the 2D_gait.osim model so that it works with the coordinate.sto data? The problems I faced here are described in my comment above.

I hope I'm being more clear.
Thank you!

User avatar
Wei Wang
Posts: 3
Joined: Thu Feb 20, 2020 12:21 am

Re: Simulation of ankle exoskeleton

Post by Wei Wang » Mon May 11, 2020 7:24 pm

Hi Iris,

I do a work similiar with yours. I plan to explore the effects of different exoskeleton assistive conditions on human physiological responses.

I have a question about how to fix the torqueprofile of the pathActuator in Moco. For example, i want the pathActuator provide a predefined torqueprofile, we set this torqueprofile, not intend to optimize it. How can i implement this in Moco?

Thank you very much.

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Simulation of ankle exoskeleton

Post by Christopher Dembia » Mon May 11, 2020 7:41 pm

Wei:

You can use MocoControlBoundConstraint or MocoControlTrackingGoal, or use an OpenSim Force (e.g., PrescribedForce) instead of an Actuator.

User avatar
Ross Miller
Posts: 375
Joined: Tue Sep 22, 2009 2:02 pm

Re: Simulation of ankle exoskeleton

Post by Ross Miller » Tue May 12, 2020 3:39 am

Hi Iris,

I've always found it easiest to modify a model by editing the XML code.

Changing the lumbar joint from 2-D to 3-D is conceptually the same process as changing the pelvis or hip to 3-D, so I would check and make sure you have all the new non-sagittal coordinates defined correctly in the model. The Rajagopal model is a good example of how to define those joints in 3-D.

I did a similar thing recently in extending a 2-D model to 3-D. At least for tracking problems (MocoTrack), I found it worked best to add complexity to the model one small piece at a time. E.g. starting from a good solution with a 2-D model, I first made just the pelvis 3-D and got a good solution there, using the prior 2-D solution as the initial guess. Then I would make the hip 3-D and get a good solution there, using the prior "only the pelvis is 3-D" solution as the initial guess. Repeated this process until the model had the full complexity that I wanted.

If I tried to start from the full-complexity 3-D model and use createGuess(), it was difficult to get the optimizer to converge, and same story if I added a lot of complexity to a prior version of the model all at once. But adding one or two coordinates and one or two muscles at a time worked well.

It sounds like your problem could be well addressed by a 2-D model, although it's nice to know if 3-D makes a difference.

Here is a Matlab code snippet for defining an initial guess from a prior solution generated by a less complex model (assuming the MocoSolver object is already defined):

Code: Select all

% Insert previous solution from a less complex model
guess = solver.createGuess(); % Generate guess for new model
prevSolution = MocoTrajectory('file_with_prior_solution.sto'); % Load prior solution from old model
prevStatesTable = prevSolution.exportToStatesTable(); % Old states
prevControlsTable = prevSolution.exportToControlsTable(); % Old controls
guess.insertStatesTrajectory(prevStatesTable, true); % Insert old states into new guess
guess.insertControlsTrajectory(prevControlsTable, true); % Insert old controls into new guess
solver.setGuess(guess);
Hope this helps,
Ross

User avatar
Iris Magnusdottir
Posts: 19
Joined: Thu Nov 01, 2018 2:04 am

Re: Simulation of ankle exoskeleton

Post by Iris Magnusdottir » Fri Jul 03, 2020 8:07 am

Hi all,

I have two questions regarding my ankle exoskeleton. I have created a pure passive device using PathSpring, pure active using PathActuator and a parallel elastic actuation (PEA) using the both. I also want to create a series elastic actuation (SEA) as shown in figure below.

I believe OpenSim does not have an inbuilt function for this so my goal is to either add:
a) linear spring (PathSpring) + torsional motor
b) torsional spring + linear motor (PathActuator)

and then somehow convert the torsional actuator (spring or motor) to a linear one, for my discussion.

So my question is this, what would be the most appropriate actuators to use here? OpenSim has few, for example TorqueActuator, CoordinateActuator, CoordinateLimitForce, SpringGeneralizedForce and the PathSpring and PathActuator, and probably more.

Second, how can I get the actuator power (W) from my MocoInverse solution?

Any comments more than appreciated.
Thanks!
Iris
Attachments
footSEA.png
footSEA.png (34.65 KiB) Viewed 1311 times

User avatar
Nicholas Bianco
Posts: 1041
Joined: Thu Oct 04, 2012 8:09 pm

Re: Simulation of ankle exoskeleton

Post by Nicholas Bianco » Fri Jul 03, 2020 9:58 am

Hi Iris,

It might be easiest to actually start with an OpenSim Muscle, since they have an active component (muscle fiber) in series with an elastic component (tendon). Obviously muscle curves don't represent what a motor would do, but you could make some adjustments to get close to a typical actuator. For example, DeGrooteFregly2016Muscle has the property 'active_force_width_scale', which you could set to a large number to avoid force length effects. You could also disable fiber passive forces.

All OpenSim Actuators have the output 'power' that you can use to get actuator power.

-Nick

POST REPLY