Minimize Initial or Final States

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
Jonathan Mortensen
Posts: 32
Joined: Wed Jul 06, 2016 1:33 pm

Minimize Initial or Final States

Post by Jonathan Mortensen » Tue May 26, 2020 4:26 pm

I am just getting starting with MOCO. I am impressed with the large range of problems that can be solved with the existing goals. It might just be that I do not know how to use it well enough yet, but I am struggling to find a way to minimize initial or final states. I would like to include the initial speed of particular coordinates in the cost function. If I understand it correctly, I should be able to use the MocoSumSquaredStateGoal to minimize speeds over the entire simulation. However, I only want to minimize speeds at the beginning of the simulation. Is this possible without writing a custom goal?

User avatar
Aaron Fox
Posts: 273
Joined: Sun Aug 06, 2017 10:54 pm

Re: Minimize Initial or Final States

Post by Aaron Fox » Tue May 26, 2020 5:33 pm

Hi Jonathan,

It looks like there are some initial/final goals for things like markers and activation, but not for joint coordinate speeds. You'd probably be able to adapt one of these (e.g. MocoInitialActivationGoal) to suit your needs. Another option though is if you want this initial state to be an exact value (or as close to this as possible) you can set it in the problem using MocoInitialBounds for that state. I'm not sure whether it works for your problem, but I guess if you bound this state to be zero at the start of the simulation then this may achieve the desired behaviour of this speed being 'minimised.' I've used this approach for final joint velocities being zero, and for the most part it gets pretty close but isn't always exactly zero (e.g. sometimes can be 1e-5 or similar).

Aaron

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

Re: Minimize Initial or Final States

Post by Christopher Dembia » Tue May 26, 2020 5:57 pm

Thanks, Aaron, for that great answer.

Jonathan, can you provide more background about why you want to minimize initial/final quantities? Such goals should be easy for us to add, but I want to make sure I understand why you want them.

User avatar
Jonathan Mortensen
Posts: 32
Joined: Wed Jul 06, 2016 1:33 pm

Re: Minimize Initial or Final States

Post by Jonathan Mortensen » Fri May 29, 2020 12:56 pm

Thanks Aaron and Christopher.

I am interested in performing forensic analysis on falls from height. I am hoping to be able to input constraints, such as initial height and landing location/orientation, and solving for a most probable initial posture/speed. I am theorizing that minimal joint speeds will result in the most natural initial states. Of course this may take a lot of fine tuning to be accurate, and muscle activation during the fall may confound results, but I am hoping this will be a useful starting point.

Thanks again!

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

Re: Minimize Initial or Final States

Post by Christopher Dembia » Mon Jun 01, 2020 5:03 pm

It seems to me that you could simply enforce that the model starts from rest (all initial speeds are 0).

I recommend conducting a grid convergence study to ensure your solutions are accurate (viewtopicPhpbb.php?f=1815&t=11937&p=0&s ... 67e4ce14e8)

POST REPLY