Quick Question About - MocoSumSquaredStateGoal

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
POST REPLY
User avatar
Burak Kula
Posts: 31
Joined: Wed Dec 04, 2019 3:34 pm

Quick Question About - MocoSumSquaredStateGoal

Post by Burak Kula » Tue Feb 02, 2021 3:17 am

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
Attachments
image_2021-02-02_131424.png
image_2021-02-02_131424.png (3.2 KiB) Viewed 262 times

User avatar
Nicholas Bianco
Posts: 1044
Joined: Thu Oct 04, 2012 8:09 pm

Re: Quick Question About - MocoSumSquaredStateGoal

Post by Nicholas Bianco » Fri Feb 05, 2021 1:06 pm

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

POST REPLY