Page 1 of 1

Quick Question About - MocoSumSquaredStateGoal

Posted: Tue Feb 02, 2021 3:17 am
by 04kulaburak
Hello Everyone,

I am trying to use "MocoSumSquaredStateGoal" in my project but I am not sure how it works.
I have a set of data and I am trying to Minimize the sum of squared states, integrated over the phase of given data.
I tried below code and obtained result given in figure atteched to this post.

Code: Select all

copMinGoal=MocoSumSquaredStateGoal("point_Right_X");
problem.addGoal(copMinGoal);
Thank you for your help.
Burak

Re: Quick Question About - MocoSumSquaredStateGoal

Posted: Fri Feb 05, 2021 1:06 pm
by nbianco
Hi Burak,

MocoSumSquaredStateGoal works only for state variables in the model. This include coordinate values, coordinate speeds, muscle activations, and any other model quantity that can be bounded via 'problem.setStateInfo()'. This does not necessarily include all outputs from a model that can be computed via the SimTK::State. Note that a state variable of the model, and the SimTK::State are two separate things. A SimTK::State object contains a vector of all model state variable values at a particular time point (plus other info).

Code: Select all

copMinGoal=MocoSumSquaredStateGoal("point_Right_X");
The line above only sets the name of the goal. By default it will minimize all states in the model, but you can change the weights for individual states via `setWeightForState()`.

-Nick