KULeuvenNeuromechanics / PredSim

Generate predictive simulations of human locomotion
MIT License
27 stars 53 forks source link

Update Settings and main script #144

Closed Lars-DHondt-KUL closed 2 months ago

Lars-DHondt-KUL commented 3 months ago

1) Changes to existing settings

Description Motivation and Context
Added default value for S.solver.run_as_batch_job (false) This was a required setting because it was used in main (i.e. before getDefaultSettings was called). This setting is now initialized to its default value in InitializeSettings
Changed default value for S.OpenSimADOptions.verbose_mode (false) The verbose mode is only useful for debugging OpenSimAD errors.
Changed default value for S.solver.CasADi_path to use casadi.GlobalOptions.getCasadiPath(). If casadi is on the matlab search path, you no longer have to pass it to this setting.
Move save_folder from subject to misc. All other paths are in misc, so this is more consistent.
Move savename and result_filename from post_processing to misc. All other file names are in misc, so this is more consistent.
Move IG_selection and IG_selection_gaitCyclePercent from subject to solver. These relate to the solver, while subject settings are about tuning the neuromusculoskeletal model.
Changed S.subject.v_pelvis_x_trgt to S.misc.forward_velocity. Task constraints (gaitmotion_type) are in misc. Changed name because: 1) we impose the velocity on the forward motion of the floating base, this does not have to be pelvis; 2) trgt (target) could mean that the velocity is in the objective ( $(v-v_{tgt})^2$ ), while this is not the case.
Renamed S.weights.e_arm to S.weights.e_torqAct. This is the weight for the excitation of the torque actuators, which happen to drive the arms is the example models.
Removed S.subject.spasticity and S.subject.muscle_coordination. These settings are not used.
Set S.misc.main_path in initializeSettings instead of in main. Assigning this setting in main suggests the user can change its value, while it has to be the path to the PredSim repo.

2) New settings

Setting Default Motivation and Context
S.solver.constr_viol_tol_ipopt 6 Control the constraint violation tolerance independent of the convergence tolerance (tol_ipopt). Default chosen such that constraint violation at the solution is below 1E-6.
S.solver.nlpsol_options [] Makes it possible to pass options to CasADi's nlp solver.
S.solver.ipopt_options [] Makes it possible to pass options to ipopt.
S.weights.a_exp 2 Choose the exponent for the muscle activation term in the cost function.

3) Cleaner main script

How Has This Been Tested?

Ran main script and compared result to example result.

Suggested tests for reviewers

Run main script.

To do

I will update the example results, to reflect the changes to the settings. I will do this after the changes to settings are approved.

miriamfebrer commented 2 months ago

1) Changes to existing settings -> I agree with all the changes and I think that they make more sense now 2) New settings -> I also agree and I think that they are useful settings 3) Cleaner main script -> perfect!

I have added small comments to some lines.

I have not run the code, as I see that Dhruv ran it without problems.