Trying to update the state with motion's coordinates

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Giulia Ghielmi
Posts: 9
Joined: Sun Mar 05, 2023 10:40 am

Trying to update the state with motion's coordinates

Post by Giulia Ghielmi » Fri Dec 01, 2023 5:02 am

Hello everyone! :D

I'm trying to use this function https://github.com/modenaxe/MuscleForce ... athAsMat.m from Luca Modenese to extract the muscle path.

I'm encountering problems regarding the state. For now I've used only:
state = model.initSystem();

My goal is to get the muscle path updated according to the kinematics of the system, then introducing the motion. Then, I would like to extract the muscle path for each time instant of the motion.

I'm thinking to extract all the coordinates for each instant and then update the state with the new value of coordinates. But I don't know how to implement it because the functions that I've tried to use don't work.
I've tried in this way:
motionData = Storage('motion_file.mot');
stateVector = motionData.getStateVector();
state = model.updState();
model.setState(state, stateVector);

I always receive this message: Undefined function or variable. :?

Thanks in advance :P

Tags:

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

Re: Trying to update the state with motion's coordinates

Post by Nicholas Bianco » Tue Dec 05, 2023 3:53 pm

Hi Guilia,

If you retrieve the coordinate set from the model via model.getCoordinateSet(), you can set coordinate values and speeds via Coordinate::setValue() and Coordinate::setSpeedValue(). Both of those methods take a State argument, and update the correct slot in the state for the associated coordinate value/speed.

Best,
Nick

User avatar
Giulia Ghielmi
Posts: 9
Joined: Sun Mar 05, 2023 10:40 am

Re: Trying to update the state with motion's coordinates

Post by Giulia Ghielmi » Tue Mar 05, 2024 4:53 am

It worked, thanks for the help! :D

POST REPLY