Standing still!

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Ross Miller
Posts: 375
Joined: Tue Sep 22, 2009 2:02 pm

Standing still!

Post by Ross Miller » Fri Mar 04, 2022 9:51 am

Hi all,

I had an unexpectedly hard time getting my Moco model (modified version of Rajagopal model) to do static upright standing, and thought I would document my adventures here.

Motivation is I'm doing some "predictive" (minimum metabolic cost) simulations of walking, and normally for that I use a tracking simulation as the initial guess. I want to check if this guess is biasing the predictive result to be similar to the tracking result, so I will try a standing simulation as an initial guess for predictive walking.

To simulate standing, I created a tracking targets file with all the coordinates set to zero except for the pelvis height, which was set to a height that should produce a vertical GRF of about bodyweight if all the other coordinates are zero. Also created a GRF tracking targets file with the vertical GRF set to one-half bodyweight under each foot and the other GRF set to zero. Then ran a simulation with a cost function of tracking errors plus "muscle fatigue" (sum of squared muscle excitations). The kinematic tracking targets were used as the initial guess.

The first problem was I was getting huge cost function scores from the initial guess, and IPOPT was having a hard time minimizing the cost function, even on a coarse grid. This seemed odd to me since this seems like a fairly easy optimization problem. Initially I thought I must be setting the pelvis target height to a too-low value, putting the feet deep under the floor and generating huge GRF. This was not the case though. The problem ended up being that I was still dividing the muscle fatigue term by the model's displacement, so there was a conflict there: tracking the targets well has zero displacement, but zero displacement sent the muscle fatigue term to infinity.

After removing the "divide by displacement" option, the optimizer was still having a hard time finding solutions where the model stood still. Another problem was my problem statement was lacking the usual periodicity/symmetry goals that I use for locomotion, so the optimizer again had a conflict: it was free to pick unconstrained initial states that allowed for low muscle excitations, but those states had bad tracking. I fixed this by (1) adding the generalized speeds to the tracking targets, and (2) adding a periodicity constraint on all states.

Finally this got a good solution on a coarse grid (11 nodes over T = 0.5 seconds) which I then interpolated onto a fine grid (N=51 nodes) that converged quickly. You can see the result here:

https://twitter.com/rosshm16/status/1499775843849101316

I'm skeptical that this pose is a "minimum fatigue" pose (most people don't stand still on their toes) but maybe humans don't stand with minimum fatigue. One of the earliest uses of optimality principles in biomechanics was on the question of why humans tend to adopt stereotypical poses when standing (Nubar & Contini, 1961):

https://link.springer.com/article/10.1007/BF02476493

Ross

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

Re: Standing still!

Post by Pasha van Bijlert » Tue Mar 08, 2022 9:07 am

Hi Ross,

Thanks for sharing your troubleshooting process, that was an interesting read!

Regarding the final optimal posture: could this be a result of the contact sphere placement? Minimal fatigue will of course be dependent both on the moment arms & relative F_max of the triceps surae and the tibialis anterior(and other ankle muscles). If we assume all of that is close enough to reality, we still need to worry about the moment arm of the GRF about the ankle. Maybe the placement of the spheres is such that the effective mechanical advantage of the ankle flexors is too low in this specific task?

Cheers,
Pasha

User avatar
Ton van den Bogert
Posts: 166
Joined: Thu Apr 27, 2006 11:37 am

Re: Standing still!

Post by Ton van den Bogert » Tue Mar 08, 2022 9:42 am

Thanks, Ross!

I also prefer to use standing as an initial guess for predictive walking simulations, so gait data are used which could bias the solution towards a particular (realistic) local minimum solution.

Here is my approach and experience (outside of Moco, though). I just use one node and require an equilibrium state x.

If the system dynamics is: f(x, dx/dt, u) = 0, the optimization problem is:

find x,u such that f(x,0,u) = 0 and the control cost, for instance sum(u.^2) is minimized.

It would be interesting if Moco could do that. If you solve not one state, but a trajectory (like you do), it is a harder problem and you definitely need periodicity constraints, otherwise falling down will happen.

When I use fully random numbers as initial guess for x,u, I often find standing on the toes, but that seems to be a local minimum. If I try often enough (with different random number seeds), I can find a solution that stands with feet flat and the cost is slightly lower. Then I record the random number seed, so I can reproduce that solution when I need it.

Another way to find that solution may be to put bounds on the ankle angle but it could be tricky.

I concluded that standing on the toes is a local optimum that is easier to find than the global optimum.

Also, the control cost is extremely low for standing. IPOPT is known to be sensitive to scaling of the problem. I have not tried this, but using 100*sum(u.^2) might work better as a cost function.

Ton van den Bogert

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

Re: Standing still!

Post by Ross Miller » Tue Mar 08, 2022 10:08 am

Pasha: the image attached here is the distribution of the model's contact spheres. Adding more points didn't affect walking simulations much but I've not tried that for standing. The walking data I'm normally tracking are barefoot data where I think the points of contact of the foot are limited, unless someone has very low arches.

Ton: could you elaborate on how you generate walking simulations using an initial standing guess? I've tried this in Moco and not gotten good results yet. I've tried asking it to walk at a fast speed (1.45 m/s) and a slow speed (0.1 m/s) and IPOPT seems to struggle, gets down to very low inf_pr and inf_du but won't converge.

Ross
Screen Shot 2022-03-08 at 11.55.27 AM.png
Screen Shot 2022-03-08 at 11.55.27 AM.png (725.35 KiB) Viewed 1078 times

User avatar
Ton van den Bogert
Posts: 166
Joined: Thu Apr 27, 2006 11:37 am

Re: Standing still!

Post by Ton van den Bogert » Tue Mar 08, 2022 10:57 am

I did a lot of work with a 9-dof 2D model, and a standing initial was not even needed to generate walking. Solution success rate was close to 100% even with totally random numbers as initial guess. But I often get toe walking, a local optimum that is apparently easier to find. There are lower cost solutions, with foot flat, and those were not very realistic either. To get realistic solutions, I had to use tracking (e.g. in my 2012 paper in J Sports Eng Technol).

This was always with a 1st order collocation (backward Euler) and that seems to be easier to solve than higher order approximations. Then you can use that as an initial guess for a more accurate higher order approximation or denser mesh. I think Moco only has second order and third order approximations available (trapezoidal and Hermite-Simpson).

With a 3D model I found it very hard to find a purely predictive walking simulation based on a standing initial guess. Let alone with random initial guess. So far, we need tracking in the cost function to get any solution at all. To be honest, I don't understand yet why this is so hard. Antoine Falisse seems to be much more successful with such problems, he mentions random initial guesses and 3rd order collocation in his 2019 paper. Could it be that Moco has trouble because it uses finite difference approximations? Your "almost solved" results might point in that direction. Antoine used algorithmic differentiation. I use symbolic differentiation (mostly) which should be just as accurate. For predictive simulation, I want to use a much simpler cost function than Antoine, though, I don't like having all those terms.

Ton

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

Re: Standing still!

Post by Ross Miller » Tue Mar 08, 2022 12:12 pm

Thanks Ton. I've been able to get convergence in Moco with 3-D models on "purely predictive" simulations (zero tracking), example here:

https://twitter.com/rosshm16/status/1500861743509258246

This was J = metabolic_cost + w*arm_swing_cost. I took away the arm muscles because they didn't seem to be helping. You can see it roughly resembles "normal" walking but misses many details. The initial guess was a tracking solution. If I make w large, the model doesn't swing its arms much, and it does more normal-looking hip abduction. If I make w small, the model does more realistic armswing like you see in this video, it also does this hip circumduction gait, and the metabolic cost goes down by ~10%.

I agree on not wanting a lot of terms. Adding terms to see which ones result in more realistic predictions is interesting but usually I'm more interested in what gaits result from minimizing single specific terms. If I want it to resemble the tracking data then I just do a tracking simulation!

Ross

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

Re: Standing still!

Post by Pasha van Bijlert » Sat Mar 19, 2022 12:08 pm

Hi Ross,

A bit off-topic, but I was wondering what the GRF curves look like, in your 3D trackingless predictions?

Cheers,
Pasha

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

Re: Standing still!

Post by Ross Miller » Sun Mar 20, 2022 5:55 am

Hi Pasha,

Do you mean for walking? I can share a few a little later today or tomorrow (most interesting case currently running!).

For standing they just look like this: ______________ :lol:

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

Re: Standing still!

Post by Pasha van Bijlert » Sun Mar 20, 2022 4:39 pm

Hi Ross,
(most interesting case currently running!)
That sounds exciting!

Yeah I meant for walking (or jogging/running, etc).
For standing they just look like this: ______________ :lol:
Would definitely save on figure space if you could get away with that in a paper :P

Cheers,
Pasha

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

Re: Standing still!

Post by Ross Miller » Mon Mar 21, 2022 6:01 am

Here are GRF from three predictive simulations of walking at 1.45 m/s with stride duration 1.0 s, and a ~75-kg model.

(1) Minimized metabolic cost
(2) Minimized u^2
(3) Minimized u^3

The last one I think is a local minimum.

Ross
MinMC.png
MinMC.png (133.7 KiB) Viewed 948 times
MinU2.png
MinU2.png (119.5 KiB) Viewed 948 times
MinU3.png
MinU3.png (130.25 KiB) Viewed 948 times

POST REPLY