Matlab version of example2DWalking
Re: Matlab version of example2DWalking
Just a follow up question for you Brian - what was your specific process/changes to the code for running the progressively faster simulations? I've been finding that the solver struggles and gives me some strange movement outputs with faster speeds. I may be trying to increase the speed too much in one go compared to your progressive simulations though.
It sounds like you altered the desired speed within the speed goal and relaxed the bounds on joint coordinates - but where there any other edits you made to generate appropriate faster gait solutions. For one example - did you have to open up the final time bounds to allow for a shorter duration solution to be reached? And were there any other parameters I'm missing that required a change?
Thanks,
Aaron
It sounds like you altered the desired speed within the speed goal and relaxed the bounds on joint coordinates - but where there any other edits you made to generate appropriate faster gait solutions. For one example - did you have to open up the final time bounds to allow for a shorter duration solution to be reached? And were there any other parameters I'm missing that required a change?
Thanks,
Aaron
- Brian Umberger
- Posts: 48
- Joined: Tue Aug 28, 2007 2:03 pm
Re: Matlab version of example2DWalking
Hi Aaron,
I'll preface this response by noting that varying the target speed was something I only played around with when I was starting out with Moco and did not investigate thoroughly or try to fine tune.
In addition to widening the bounds on the states I did also widen the bounds on the final time, allowing shorter step times. I set the lower bound to 0.05 s, ensuring it should not be reached. I also used more mesh intervals (75) and a looser convergence tolerance (1e-2) than what is in the walking example. I don't think I changed anything else.
Starting from the 1.2 m/s walking solution I solved problems with the speed goal set to 2.0, 2.5, 3.0, 3.5, 4.0 m/s, with the initial guess always being the solution from the next lower speed. The only one that had some trouble converging was 4.0 m/s. The gaits were not perfect, and tended to have shorter step lengths and higher step frequencies than what would be expected. At 3.0 m/s and above it was definitely running, with a clear flight phase. It's worth noting that I don't think Antoine used this 2-D model for running in his recent papers and it might not be well suited for simulating running (I'm not sure). The cost function he used was also more complex than this minimum control effort objective.
Best,
Brian
I'll preface this response by noting that varying the target speed was something I only played around with when I was starting out with Moco and did not investigate thoroughly or try to fine tune.
In addition to widening the bounds on the states I did also widen the bounds on the final time, allowing shorter step times. I set the lower bound to 0.05 s, ensuring it should not be reached. I also used more mesh intervals (75) and a looser convergence tolerance (1e-2) than what is in the walking example. I don't think I changed anything else.
Starting from the 1.2 m/s walking solution I solved problems with the speed goal set to 2.0, 2.5, 3.0, 3.5, 4.0 m/s, with the initial guess always being the solution from the next lower speed. The only one that had some trouble converging was 4.0 m/s. The gaits were not perfect, and tended to have shorter step lengths and higher step frequencies than what would be expected. At 3.0 m/s and above it was definitely running, with a clear flight phase. It's worth noting that I don't think Antoine used this 2-D model for running in his recent papers and it might not be well suited for simulating running (I'm not sure). The cost function he used was also more complex than this minimum control effort objective.
Best,
Brian
Re: Matlab version of example2DWalking
Great - thanks for the info Brian.
I'd suggest that the looser convergence tolerance was important in these examples, as I had some difficulty getting the solutions to converge without doing this. I'm also trialling a more complex model with some existing running data as the initial guesses and hoping this may solve some of those oddities you saw in the running technique.
Aaron
I'd suggest that the looser convergence tolerance was important in these examples, as I had some difficulty getting the solutions to converge without doing this. I'm also trialling a more complex model with some existing running data as the initial guesses and hoping this may solve some of those oddities you saw in the running technique.
Aaron
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: Matlab version of example2DWalking
Dear Prof. Brian Umberger,
I thank you very much for sharing the code. It is working. However it seems to work only while ignoring passive fiber force and active force length factor set to 1.5 (I have not tried the effect of these two options individually, used both these options simultaneously). How these options affect convergence?
The results of predictive simulation with coarse mesh and coarse tolerance , finer mesh and finer tolerance seems to be qualitatively similar. Could you please explain why did you use fine mesh and tolerance?
Predictive simulation with the same solver settings as tracking simulation in your code (100 mesh intervals and tolerance of 1e-5) took almost 3600 iterations and 18 hours in my computer. Even with 50 mesh intervals and 1e-4 tol took around 1800 iterations to converge. Did your simulation take these many number of iterations? Is it possible to improve the rate of convergence?
I will highly appreciate if you could please answer these questions.
Thanks & Regards,
Karthick.
I thank you very much for sharing the code. It is working. However it seems to work only while ignoring passive fiber force and active force length factor set to 1.5 (I have not tried the effect of these two options individually, used both these options simultaneously). How these options affect convergence?
The results of predictive simulation with coarse mesh and coarse tolerance , finer mesh and finer tolerance seems to be qualitatively similar. Could you please explain why did you use fine mesh and tolerance?
Predictive simulation with the same solver settings as tracking simulation in your code (100 mesh intervals and tolerance of 1e-5) took almost 3600 iterations and 18 hours in my computer. Even with 50 mesh intervals and 1e-4 tol took around 1800 iterations to converge. Did your simulation take these many number of iterations? Is it possible to improve the rate of convergence?
I will highly appreciate if you could please answer these questions.
Thanks & Regards,
Karthick.
- Brian Umberger
- Posts: 48
- Joined: Tue Aug 28, 2007 2:03 pm
Re: Matlab version of example2DWalking
Hello Karthick,
Thanks for your patience. I became busy with work and was not checking the forum.
For the example, I used a finer mesh and tighter tolerance because in the initial solutions I obtained there were oscillations in the GRFs, which appeared to be due to oscillation in the tendon forces for some of the muscles. Using a finer mesh and tighter tolerance substantially reduced the oscillations. I only ran a couple of predictive simulations of this case, and it did require similar numbers of iterations as you indicated.
I do not intend to use this particular model to do anything other than learn how to use Moco, so I have not spent any time trying to figure out why convergence is slower than expected, why there were oscillations in the muscle forces, the effects of including passive fiber force, etc. One possibility is some of the muscle parameters in this model might need to be adjusted. The questions you are asking are all relevant and appropriate, I just don't have any direct insights for this particular case.
Best regards,
Brian
Thanks for your patience. I became busy with work and was not checking the forum.
For the example, I used a finer mesh and tighter tolerance because in the initial solutions I obtained there were oscillations in the GRFs, which appeared to be due to oscillation in the tendon forces for some of the muscles. Using a finer mesh and tighter tolerance substantially reduced the oscillations. I only ran a couple of predictive simulations of this case, and it did require similar numbers of iterations as you indicated.
I do not intend to use this particular model to do anything other than learn how to use Moco, so I have not spent any time trying to figure out why convergence is slower than expected, why there were oscillations in the muscle forces, the effects of including passive fiber force, etc. One possibility is some of the muscle parameters in this model might need to be adjusted. The questions you are asking are all relevant and appropriate, I just don't have any direct insights for this particular case.
Best regards,
Brian
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: Matlab version of example2DWalking
Dear Prof. Brian Umberger,
Thanks for your answers and suggestions. I will explore more on these issues.
Thanks for your answers and suggestions. I will explore more on these issues.
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: Matlab version of example2DWalking
Hi Moco Team,
Do you have any suggestions for these questions?
Thanks,
Karthick.
Do you have any suggestions for these questions?
Thanks,
Karthick.
- Brian Umberger
- Posts: 48
- Joined: Tue Aug 28, 2007 2:03 pm
Re: Matlab version of example2DWalking
Hi Karthick,
Here is a potential solution that arose in trying to address a similar issue with my own model.
After you create the model object, set the tendon compliance dynamics mode to "implicit"
You can then comment out the lines for IgnorePassiveFiberForces and ScaleActiveFiberForceCurveWidth.
Next, when you configure the solver, set it to minimize the auxiliary derivatives (tendon force derivatives, in this case) with a weight of around 0.1 (that worked, but I did not try to fine-tune this weight).
These changes largely suppress the oscillations in the tendon forces, and permit good convergence for tracking and predictive simulations (250-350 iterations) using a reasonable mesh intervals (50) and tolerances (1e-3). I hope this helps.
Brian
Here is a potential solution that arose in trying to address a similar issue with my own model.
After you create the model object, set the tendon compliance dynamics mode to "implicit"
Code: Select all
modelProcessor.append(ModOpTendonComplianceDynamicsModeDGF('implicit'));
Next, when you configure the solver, set it to minimize the auxiliary derivatives (tendon force derivatives, in this case) with a weight of around 0.1 (that worked, but I did not try to fine-tune this weight).
Code: Select all
solver.set_minimize_implicit_auxiliary_derivatives(true);
solver.set_implicit_auxiliary_derivatives_weight(0.1);
Brian
- Karthick Ganesan
- Posts: 119
- Joined: Thu Oct 10, 2013 12:11 am
Re: Matlab version of example2DWalking
Dear Prof. Brian Umberger,
Thank you very much for sharing your experience.
Recently I also tried the implicit mode for a tracking simulation and it almost halved the number of iterations.I did not try out other options though.
Thanks a lot,
Karthick.
Thank you very much for sharing your experience.
Recently I also tried the implicit mode for a tracking simulation and it almost halved the number of iterations.I did not try out other options though.
Thanks a lot,
Karthick.
Re: Matlab version of example2DWalking
Hi Karthick,
Presumable with half the number of iterations the solver worked much faster?
Perhaps Nick, Chris and/or Brian could provide some background on what the explicit vs. implicit mode does and what the pros/cons of each are?
Thanks,
Aaron
Presumable with half the number of iterations the solver worked much faster?
Perhaps Nick, Chris and/or Brian could provide some background on what the explicit vs. implicit mode does and what the pros/cons of each are?
Thanks,
Aaron