Page 1 of 1

Minimum Time Optimal Control Problem

Posted: Fri May 18, 2018 10:35 am
by nicos1993
Dear users,

I am trying to solve an optimal control problem using the OpenSim Matlab Interface and Matlab's fmincon function. The model I am using is a modified version of the refined LaiArnold2017 model (pelvis is fixed in space with only the left lower-limbs). I am attempting to minimize the time taken for the calcaneus segment to be positioned at (0.5, 0.5, 0 m) (ant,vert,med) with respect to the ground coordinate system. I have previously managed to solve a similar problem whereby the final time is a fixed parameter (e.g. 0.75 s), minimized the sum of squared muscle activations and used a constraint to ensure the model achieves the required pose at the final time. I am yet, however, to figure out how to introduce time as a varying parameter. From my reading I believe that I need to add the time parameter to my vector of controls, but I am not certain if this is the correct approach? I have also come across an article by Pandy et al. (1992)* in which they transform the final time (tf) into a solvable parameter by normalizing the time:

Tau = t/tf

The system differential equations then become functions of the states, controls and tau. I am therefore wondering whether anyone has managed to solve a minimum time optimal control problem using the Matlab OpenSim Interface? And whether it is possible to achieve this using Matlab's fmincon function? Any guidance/recommended reading would be greatly appreciated too!

Kind regards,

Nicos Haralabidis

* Pandy, M. G., Anderson, F. C. & Hull, D.G. (1992) A parameter optimization approach for the optimal control of large-scale musculoskeletal systems. Journal of Biomechanical Engineering, 114(4), 450-460.

Re: Minimum Time Optimal Control Problem

Posted: Tue Apr 12, 2022 9:02 pm
by zhengsize
Hi Nicos Haralabidis,

I am going to solve similar optimal control problems with Matlab fmincon. Could you please show me how to include the OpenSim model's system dynamics into the problem? I tried to write equations of motion by myself and added them to fmincon, but I feel hard and troublesome to do this. Is there a better way for this?

Thanks,
Simon

Re: Minimum Time Optimal Control Problem

Posted: Wed Apr 13, 2022 8:05 am
by nicos1993
Hello Simon,

You can't get access to the equations of motion directly, but you can evaluate them for a given state and control vector, using methods within the API like computeStateVariableDerivatives (https://simtk.org/api_docs/opensim/api_ ... 29f59b6465) (returns velocities and acceleration using explicit formulation) or calcResidualForceIgnoringConstraints (https://simbody.github.io/simbody-3.6-d ... 7ab65f8f81) (returns generalized forces for an unconstrained model; implicit formulation of dynamics). To use these methods you will need to set/input the state and control variables (and account for any external forces) prior to calling them. You can then use these outputs to setup your multibody dynamics constraint equations for use with fmincon (i.e., pos_dot = vel, vel_dot = acc, where pos, vel and acc are the generalised coordinates, velocities and accelerations - acc calculated from computeStateVariableDerivatives). Let me know if something isn't clear!

Best wishes,

Nicos