I'd like to visualize an already made MOCO solution storage file, but can not seem to get the visualize() function working. All of the available examples require that you first solve a MOCO study, then visualize the solution. The documentation page says you should be able to do visualize(model, storage), however I am unable to do this. All I would like to do is take a storage file that was produced by a previous MOCO solution and load it into the looping visualizer executable.
Here is an example of what I would like to do in MATLAB, which does not work:
Code: Select all
import org.opensim.modeling.*;
storagePath = 'test.sto';
storage = Storage(storagePath);
model = Model('Mymodel.osim');
visualize(model, storage);
Code: Select all
import org.opensim.modeling.*;
storagePath = 'test.sto';
% Start MocoStudy
study = MocoStudy();
problem = study.updProblem();
% Import Model
model = Model('Mymodel.osim');
problem.setModel(model);
% Configure the solver.
solver = study.initCasADiSolver();
solver.set_num_mesh_intervals(5);
% Loosen the tolerance values to extreme amounts
solver.set_optim_convergence_tolerance(1e+10);
solver.set_optim_constraint_tolerance(1e+10);
% Set the initial guess using the optimizer solution storage file
solver.setGuessFile(storagePath);
% Solve and visualize
trackingSolution = study.solve();
study.visualize(trackingSolution);
Thank you