OpenSense- downweighing sensors in Matlab API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Therese Parr
Posts: 9
Joined: Mon Dec 02, 2019 9:47 am

OpenSense- downweighing sensors in Matlab API

Post by Therese Parr » Mon Jun 13, 2022 9:13 am

Hello,

I'd like to downweigh the tibia and foot IMU sensors for the IK calculation in OpenSense. I know how to do this on the GUI, but want to be able to do it on Matlab for faster processing.

Here's what I currently have:

imuIK = IMUInverseKinematicsTool();
imuIK.set_orientation_weights();

I am unsure what argument to put in the parentheses of the set_orientation_weights function, and if I can set different weights for specific sensors. I am trying to follow the OpenSense publication weights (pelvis=1.0, thigh=1.0, tibia=0.5, foot=0.01).

Thank you in advance for the help.

Tags:

User avatar
Carmichael Ong
Posts: 401
Joined: Fri Feb 24, 2012 11:50 am

Re: OpenSense- downweighing sensors in Matlab API

Post by Carmichael Ong » Fri Jun 17, 2022 2:45 pm

There are a few steps needed to make this work.

For set_orientation_weights, we can see from the documentation that it takes an object of type OrientationWeightSet (https://simtk.org/api_docs/opensim/api_ ... 58dcef9a4e).

Working with Sets can be a little tricky, but here's one way to create an OrientationWeightSet and fill it in:

1. Create the OrientationWeightSet

Code: Select all

weightSet = OrientationWeightSet();
2. Create an OrientationWeight, and then add it to the OrientationWeightSet

Code: Select all

thisWeight = OrientationWeight("name", 1.0);
weightSet.adoptAndAppend(thisWeight)
3. Now set the IMUIK's orientation weights:

Code: Select all

imuIK.set_orientation_weights(weightSet)

User avatar
Therese Parr
Posts: 9
Joined: Mon Dec 02, 2019 9:47 am

Re: OpenSense- downweighing sensors in Matlab API

Post by Therese Parr » Mon Jun 20, 2022 9:53 am

Thank you, Carmichael! This worked great.

POST REPLY