How to work with actuators in acceleration matching static optimization

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mohammadreza Rezaie
Posts: 377
Joined: Fri Nov 24, 2017 12:48 am

How to work with actuators in acceleration matching static optimization

Post by Mohammadreza Rezaie » Thu Dec 21, 2023 7:25 am

Hi, I'm trying to implement acceleration matching static optimization, but I don't know the correct way of getting accelerations.

To get correct accelerations, I think residual actuators are needed. At this stage, I'm ignoring reserve actuators. I have added strong CoordinateActuators to coordinates without muscles, e.g. pelvis and lumbar coordinates, with optimal force, min and max control values of 500, -1, and +1, respectively. Then, I updated coordinates values setValue and speeds setSpeedValue. In the equality constraint, muscles activations setActivation were updated and model equilibrateMuscles was called first. Here are 3 methods I found to control the actuators:

1. updating actuators activation setOverrideActuation.

2. updating model's control setControls.

3. adding a PrescribedController for every actuator and updating their Constants values setValue.

And finally, calling model.realizeAcceleration() followed by state.getUDot(). Method 2 seems to be working. Which method is correct?

Any help/guidance/tip is greatly appreciated.
-Mohammadreza

Tags:

User avatar
Mohammadreza Rezaie
Posts: 377
Joined: Fri Nov 24, 2017 12:48 am

Re: How to work with actuators in acceleration matching static optimization

Post by Mohammadreza Rezaie » Fri Jan 05, 2024 1:36 pm

Hi, any specific recommendations in this regard? I would be grateful for your help.

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

Re: How to work with actuators in acceleration matching static optimization

Post by Nicholas Bianco » Mon Jan 08, 2024 11:33 am

Hi Mohammadreza,

Model accelerations are computed after the dynamics (i.e., forces) stage in OpenSim. You are correct that you need actuators in the model in order to produce model accelerations.

And yes, using the 'setControls' interface is the best way to set actuator controls for a custom optimization.

Best,
Nick

User avatar
Mohammadreza Rezaie
Posts: 377
Joined: Fri Nov 24, 2017 12:48 am

Re: How to work with actuators in acceleration matching static optimization

Post by Mohammadreza Rezaie » Tue Jan 09, 2024 6:27 am

Hi Nick,

Thank you so much for your response. It's great to see no PrescribedController is required.

Best,
-Mohammadreza

POST REPLY