Amplitude difference between values and displayed angle
- Charles David Sasportes
- Posts: 15
- Joined: Thu Jan 23, 2020 6:36 am
Amplitude difference between values and displayed angle
Hello everyone,
I have a quick question, that might be a non-issue, but that is disturbing to me :
When I open a motion file and run the animation in the GUI, my model does not behave according to the .mot file. To be specific, in my use case I try to simulate a forward bending movement (I am using the Musculoskeletal model of the lumbar spine, lumbar_C_4) . I have a .mot file that contains values for a variable called "flex_extension". When running the animation, my model bends forward but does not seem to go all the way. I can see the dial in the coordinates tab moving and going to the right values, but the amplitude of the movement is very small compared to the expected values. And if I type in the same values in the coordinates tab, the model goes to the correct position with no problem
To give you a more visual explanation of my problem, I included 2 images of the max amplitude in the forward bending, for an expected angle of 20 degrees. The first image is what is displayed when i press "play" in the animation, and the second image is when I enter the value in the coordinates tab manually. Notice that in both cases, the flex_extension value is the same, but the displayed angle of the model is way bigger when the value is entered manually.
What is even more disturbing is the fact that if I run Static Optimization, and play the states animation, the movement seems correct. This is not the case when I run Inverse Dynamics.
Do you know if this could affect my experimental results, and if so, how I can correct this ? Otherwise, is there a way to know if this is just a display issue or if the values are affected too ?
Thanks in advance,
I have a quick question, that might be a non-issue, but that is disturbing to me :
When I open a motion file and run the animation in the GUI, my model does not behave according to the .mot file. To be specific, in my use case I try to simulate a forward bending movement (I am using the Musculoskeletal model of the lumbar spine, lumbar_C_4) . I have a .mot file that contains values for a variable called "flex_extension". When running the animation, my model bends forward but does not seem to go all the way. I can see the dial in the coordinates tab moving and going to the right values, but the amplitude of the movement is very small compared to the expected values. And if I type in the same values in the coordinates tab, the model goes to the correct position with no problem
To give you a more visual explanation of my problem, I included 2 images of the max amplitude in the forward bending, for an expected angle of 20 degrees. The first image is what is displayed when i press "play" in the animation, and the second image is when I enter the value in the coordinates tab manually. Notice that in both cases, the flex_extension value is the same, but the displayed angle of the model is way bigger when the value is entered manually.
What is even more disturbing is the fact that if I run Static Optimization, and play the states animation, the movement seems correct. This is not the case when I run Inverse Dynamics.
Do you know if this could affect my experimental results, and if so, how I can correct this ? Otherwise, is there a way to know if this is just a display issue or if the values are affected too ?
Thanks in advance,
Tags:
- Nicos Haralabidis
- Posts: 196
- Joined: Tue Aug 16, 2016 1:46 am
Re: Amplitude difference between values and displayed angle
Hi Charles,
I have had an issue like this before when in my motion file the Degrees tag at the top has been true, but my values are actually in Radians. Try inspect this, this information can be found at the top of the motion file, you should also get a similar message in the GUI command window!
Cheers,
Nicos
I have had an issue like this before when in my motion file the Degrees tag at the top has been true, but my values are actually in Radians. Try inspect this, this information can be found at the top of the motion file, you should also get a similar message in the GUI command window!
Cheers,
Nicos
- Charles David Sasportes
- Posts: 15
- Joined: Thu Jan 23, 2020 6:36 am
Re: Amplitude difference between values and displayed angle
Hi,
Thanks for your response !
Indeed, that might be the problem. Here are some screencaps from the header of the .mot file and the GUI
The .osim model expects radians and the values in the .mot file are in radians, but it seems the software does not process this correctly. I tried adding lines to the header Unfortunately, this does not change a thing. Do you know what command I should use to rectify this ?
I also guess this is consistent with the warning I get when I load my model :
Eventually, do you know how to use the updatePre40.. tool ?
Thanks in advance,
Thanks for your response !
Indeed, that might be the problem. Here are some screencaps from the header of the .mot file and the GUI
The .osim model expects radians and the values in the .mot file are in radians, but it seems the software does not process this correctly. I tried adding lines to the header Unfortunately, this does not change a thing. Do you know what command I should use to rectify this ?
I also guess this is consistent with the warning I get when I load my model :
Eventually, do you know how to use the updatePre40.. tool ?
Thanks in advance,
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Amplitude difference between values and displayed angle
Hello,
As the warning/dialog indicates, the old motion file is not reusable unless you run the tool to upgrade result files. Would be safer if you can save the model in version 4.0+ and recreate motion files there so they are all consistent and match the GUI without having to mess around with hand editing old result files.
If not possible and you want to upgrade old results, the method documentation is here https://simtk.org/api_docs/opensim/api_ ... d37b2810f3
The actual code depends on if you're using C++, Matlab, Python or the scripting shell, so let us know your choice if you decide to go this route.
Best regards,
-Ayman
As the warning/dialog indicates, the old motion file is not reusable unless you run the tool to upgrade result files. Would be safer if you can save the model in version 4.0+ and recreate motion files there so they are all consistent and match the GUI without having to mess around with hand editing old result files.
If not possible and you want to upgrade old results, the method documentation is here https://simtk.org/api_docs/opensim/api_ ... d37b2810f3
The actual code depends on if you're using C++, Matlab, Python or the scripting shell, so let us know your choice if you decide to go this route.
Best regards,
-Ayman
- Charles David Sasportes
- Posts: 15
- Joined: Thu Jan 23, 2020 6:36 am
Re: Amplitude difference between values and displayed angle
Hello and thank you for your reply,
I saved the model in 4.0 (so I do not have the warning anymore). For the motion file, it was generated very recently using a matlab script. It symply contains the values of the flex_extension variable in radians, which should correspond to the flex_extension dial in the coordinates tab. Apart from this, the header does not contain any "inDegrees" tag.
I still have the message in the GUI prompt "assuming rotations in degrees". Do you still think using the upgrade tool makes sense ? I do not get what it will change because the .mot file seems pretty straightfoward to me.
Here is a quick screencap of the .mot file so you can see its structure :
Many thanks,
I saved the model in 4.0 (so I do not have the warning anymore). For the motion file, it was generated very recently using a matlab script. It symply contains the values of the flex_extension variable in radians, which should correspond to the flex_extension dial in the coordinates tab. Apart from this, the header does not contain any "inDegrees" tag.
I still have the message in the GUI prompt "assuming rotations in degrees". Do you still think using the upgrade tool makes sense ? I do not get what it will change because the .mot file seems pretty straightfoward to me.
Here is a quick screencap of the .mot file so you can see its structure :
Many thanks,
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Amplitude difference between values and displayed angle
Hello,
The model is now consistent with version 4.0 where flex_extension is now assumed coupled (as such we don't auto convert values from degrees to radians) and the values are taken as is. If your matlab script assumed the coordinate is in degrees then you have to convert the values yourself or update the script accordingly.
Hope this helps,
-Ayman
The model is now consistent with version 4.0 where flex_extension is now assumed coupled (as such we don't auto convert values from degrees to radians) and the values are taken as is. If your matlab script assumed the coordinate is in degrees then you have to convert the values yourself or update the script accordingly.
Hope this helps,
-Ayman
- Charles David Sasportes
- Posts: 15
- Joined: Thu Jan 23, 2020 6:36 am
Re: Amplitude difference between values and displayed angle
Hello and thank you for your response,
I did a quick test to see if the code had a problem by drafting manually a constant movement file (simulating a static position). From my first observation, it seems like the problem persists (visually the model does not bend as much as expected). I'd like to test this. Do you know if there's a way to run inverse dynamics on 1 frame only, without loading a .mot file, just by actuating the model with the coordinates dial?
Many thanks
I did a quick test to see if the code had a problem by drafting manually a constant movement file (simulating a static position). From my first observation, it seems like the problem persists (visually the model does not bend as much as expected). I'd like to test this. Do you know if there's a way to run inverse dynamics on 1 frame only, without loading a .mot file, just by actuating the model with the coordinates dial?
Many thanks
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Amplitude difference between values and displayed angle
Hi Charles,
One last thing to try is to change the extension of the file (and header if needed) to sto rather than mot (which has an implicit assumption that rotations are in degrees). Just to play it safe and avoid uncertainty.
The tools in the GUI use files as input so you can't use the coordinate dial, but you can programmatically call the underlying solver with one frame of data to solve.
If that seems complicated please file a bug (using the GUI help->file a bug) and attach the model (or link to it) and your motion file and we'll investigate. It's also possible that there're constraints or coupled coordinates in the model resulting that assembly of the model changes the coordinate values from what you set.
Hope this helps,
-Ayman
One last thing to try is to change the extension of the file (and header if needed) to sto rather than mot (which has an implicit assumption that rotations are in degrees). Just to play it safe and avoid uncertainty.
The tools in the GUI use files as input so you can't use the coordinate dial, but you can programmatically call the underlying solver with one frame of data to solve.
If that seems complicated please file a bug (using the GUI help->file a bug) and attach the model (or link to it) and your motion file and we'll investigate. It's also possible that there're constraints or coupled coordinates in the model resulting that assembly of the model changes the coordinate values from what you set.
Hope this helps,
-Ayman
- Charles David Sasportes
- Posts: 15
- Joined: Thu Jan 23, 2020 6:36 am
Re: Amplitude difference between values and displayed angle
Hi!
I just tried changing the extension to .sto but unfortunately, I did not change the behavior of the model. Here is a quick screencap of the file header so you can check that it is correct (I took a tutorial file as an example, it should be ok but let me know). I guess I will file a bug report on the program directly today so you can investigate a bit further.
Thank you very much for your help!
I just tried changing the extension to .sto but unfortunately, I did not change the behavior of the model. Here is a quick screencap of the file header so you can check that it is correct (I took a tutorial file as an example, it should be ok but let me know). I guess I will file a bug report on the program directly today so you can investigate a bit further.
Thank you very much for your help!
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: Amplitude difference between values and displayed angle
Which tutorial file did you use? The space on row 1 might be interpreted as a delimiter (see https://github.com/opensim-org/opensim- ... e.cpp#L112). As a quick check, you might try replacing the space with an underscore or deleting "name[space]" before "20deg_static".I took a tutorial file as an example