Grouping muscle activations

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
POST REPLY
User avatar
Ana de Sousa
Posts: 62
Joined: Thu Apr 07, 2016 4:21 pm

Grouping muscle activations

Post by Ana de Sousa » Tue Aug 27, 2024 2:35 am

Hi everyone!

I'm working on a project, and I need some advice. I want to group muscles in a specific area to share the same activation. Is there a way to do this in OpenSim Moco, or does it need to be handled in OpenSim itself (by modelling)?

For example, my model has two muscles: the rectus femoris and the vastus lateralis. Each muscle has its activation variable, so when I run MocoInverse, I get separate results for each muscle. I want to combine these two muscles into one group - let's call it 'quadriceps' - so that there is just one activation variable for the entire group, and I get a unified solution.

Does anyone know how to achieve this in Moco, or are there any constraints or techniques that might help?

Thanks in advance for any suggestions!

User avatar
Pasha van Bijlert
Posts: 219
Joined: Sun May 10, 2020 3:15 am

Re: Grouping muscle activations

Post by Pasha van Bijlert » Wed Aug 28, 2024 2:59 am

Hi Ana,

If you load a model into a problem that you solve with Moco, I think Moco automatically adds a controller to each actuator that doesn't already have one. I think if you first manually define a controller, then add the muscles you want it to control, you circumvent this. The code would look something like this (but I haven't tested it):

Code: Select all

mycontroller = Controller()
mycontroller.setActuator(muscle_one)
mycontroller.setActuator(muscle_two)
model.addController(mycontroller)

model.initSystem()
You may have to SafeDownCast the muscles first, and/or check whether the other (uncontrolled) actuators still get their own controller automatically.


Cheers,
Pasha

POST REPLY