Hello everyone!
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
Trying to update the state with motion's coordinates
- Giulia Ghielmi
- Posts: 9
- Joined: Sun Mar 05, 2023 10:40 am
- Nicholas Bianco
- Posts: 1050
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Trying to update the state with motion's coordinates
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
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
- Giulia Ghielmi
- Posts: 9
- Joined: Sun Mar 05, 2023 10:40 am
Re: Trying to update the state with motion's coordinates
It worked, thanks for the help!