I'm trying to run Moco with the implicit formulations of multibody dynamics and tendon compliance and am unable to get the setup right. The issue seems clear (the trajectory I'm supplying for the initial guess does not have generalized accelerations in it) but I can't figure out how to get them in there. Here is the code for generating the guess, solver, and then solving:
Code: Select all
% Set the normalized tendon forces in guess
solver = MocoCasADiSolver.safeDownCast(study.updSolver());
solver.set_multibody_dynamics_mode('implicit')
solver.set_minimize_implicit_multibody_accelerations(true)
solver.set_implicit_multibody_accelerations_weight(0.001)
solver.set_optim_max_iterations(2000);
solver.set_num_mesh_intervals(21);
solver.set_optim_constraint_tolerance(1e-3);
solver.set_optim_convergence_tolerance(1e-3);
solver.set_minimize_implicit_auxiliary_derivatives(true)
solver.set_implicit_auxiliary_derivatives_weight(0.01)
solver.resetProblem(problem);
guess = solver.getGuess();
numRows = guess.getNumTimes();
StateNames = model.getStateVariableNames();
for i = 1:model.getNumStateVariables()
currentStateName = string(StateNames.getitem(i-1));
if contains(currentStateName,'normalized_tendon_force')
guess.setState(currentStateName, linspace(0.2,0.2,numRows));
end
end
solver.setGuess(guess);
% Solve the problem
gaitTrackingSolution = study.solve();
Any guesses?
Ross