Inconsistent ik motion files with cmd line and gui

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Tom Lintern
Posts: 61
Joined: Mon Dec 13, 2010 5:43 pm

Inconsistent ik motion files with cmd line and gui

Post by Tom Lintern » Thu May 24, 2012 12:16 am

Hi,

I have created a model and done an inverse kinematics analysis using some motion capture marker data. When I run the ik solver in the gui, I get results that appear correct and the tab under the motion tab is called "Results".

When I run the same ik setup file from the cmd line, I use the tags <output_motion_file> </output_motion_file> to export the mot file. When I load this motion in the GUI to visualise, it opens but the tab under the motion tab is called "Coordinates" and the data is not correct at all.

Do you know how to fix this? Is there another set of xml tags to export a results file of the same format that I would obtain in the gui?

Thanks,
Tom

User avatar
Ayman Habib
Posts: 2254
Joined: Fri Apr 01, 2005 12:24 pm

Re: Inconsistent ik motion files with cmd line and gui

Post by Ayman Habib » Tue May 29, 2012 10:47 am

Hi Tom,

When the GUI loads a motion file, it checks the header to find out if the rotational coordinates are in radians or degrees. This feature was introduced in version 2.4 to avoid confusion. What version of OpenSim are you using (GUI or command line)? Also can you check the file to see if the header is correct (rotational coordinates values are consistent with header)?

Please let us know so we can help troubleshoot.

Best regards,
-Ayman

User avatar
Tom Lintern
Posts: 61
Joined: Mon Dec 13, 2010 5:43 pm

Re: Inconsistent ik motion files with cmd line and gui

Post by Tom Lintern » Tue May 29, 2012 3:49 pm

Hi Ayman,

I have attached the 2 results files and the corresponding setup file. "IK_gui.mot" was obtained by running the ik simulation in the gui and right clicking on the results (under the motions tab) and selecting save as. The "IK_cmd.mot" was obtained by running the ik analysis from the command line.

The set up file "ik_setup.xml" was used in both cases.

The only difference I can see between the 2 files is the header (one is headed results while the other is headed coordinates), the IK_gui.mot file has columns for the velocities while the IK_cmd does not and the IK_gui.mot file has an 2 additional columns labelled "_unnamedState_" which are populated with all zeros which do not appear in the IK_cmd.mot file.

When I select "load motion" in the gui, the IK_gui.mot is the file which produces the motion correctly.

Any help would be much appreciated.

Cheers
Tom
Attachments
IK_setup.xml
(17.41 KiB) Downloaded 41 times
IK_gui.mot
(668.35 KiB) Downloaded 33 times
IK_cmd.mot
(334.5 KiB) Downloaded 37 times

User avatar
Ayman Habib
Posts: 2254
Joined: Fri Apr 01, 2005 12:24 pm

Re: Inconsistent ik motion files with cmd line and gui

Post by Ayman Habib » Wed May 30, 2012 2:46 pm

Hi Tom,

I'm guessing (based on the presence of unnamed states in one case) that you're using a model component that has an internal state. Normally that would be transparent when you write motion files but not when you write states files. Can you explain what type of components you have in your model and whether they are implemented as plugins? If the latter you need to make sure the plugin is loaded by the command line executable as well as by the GUI so that the two models are identical (they use slightly different mechanisms for loading plugins).

Please let me know so that I can help you troubleshoot,

Best regards,
-Ayman

User avatar
Tom Lintern
Posts: 61
Joined: Mon Dec 13, 2010 5:43 pm

Re: Inconsistent ik motion files with cmd line and gui

Post by Tom Lintern » Wed May 30, 2012 3:32 pm

Hi Ayman,

Thanks for your reply. I am not using any plugins in my model. What I have is a simple model of the head and neck containing a base, 7 vertebrae and a head. They are all connected by custom joints with 4 free dof's (3 rotations and 1 stretch) and are coupled via a kinematic constraint to the orientation of the head. There are also a couple of 'massless' bodies included just so I can include some geometry for visualisation. There are no muscles or any forcing elements in the model.

I have attached the osim file if it helps (I changed the extension to .xml to allow the file to be attached)

Thanks alot,
Tom
Attachments
Phantom_scaled.xml
(100.88 KiB) Downloaded 38 times

User avatar
Tom Lintern
Posts: 61
Joined: Mon Dec 13, 2010 5:43 pm

Re: Inconsistent ik motion files with cmd line and gui

Post by Tom Lintern » Thu May 31, 2012 2:24 am

Hi Ayman,

If it helps with identifying the problem I have attached a marker trc file as well (for a static pose and once again saved it as an xml file to add as attachment...).

Thanks,
Tom
Attachments
markers_static.xml
(174.15 KiB) Downloaded 41 times

User avatar
Ayman Habib
Posts: 2254
Joined: Fri Apr 01, 2005 12:24 pm

Re: Inconsistent ik motion files with cmd line and gui

Post by Ayman Habib » Thu May 31, 2012 2:24 pm

Hi Tom,

I couldn't reproduce your problem as my run from the command line and GUI produced identical results (not containing states similar to your IK_gui.mot). My guess is that the file path referred to in the setup file for the model (which is not used by the GUI as it uses the current model but is used by the command line version) is different from the model loaded in the GUI when you ran and so the results are different.

If that doesn't seem likely then please try to reproduce the problem using files from a local directory (use relative paths) and if you get different results in cmd line vs. GUI, then make a zip file and upload it into a bug report.

Best of luck,
-Ayman

User avatar
Tom Lintern
Posts: 61
Joined: Mon Dec 13, 2010 5:43 pm

Re: Inconsistent ik motion files with cmd line and gui

Post by Tom Lintern » Thu May 31, 2012 10:00 pm

Hi Ayman,

I'm sorry but I may not have been clear and you may have misunderstood my problem. I agree that running the ik_setup.xml file will write an output file to the results directory which is the same whether it is called from the gui or from the cmd line. The problem is that this file will produce incorrect kinematics when loaded into the gui as a motion.

My question is how to export a results file which can then be loaded as a motion in the gui to visualise the kinematics?

The only way to correctly visualise the results is to run the setup file from the gui and playback the "Results" motion which is produced within the gui by default. Another "coordinates" .sto file will also be produced and saved to file, but if this is loaded into the gui as a motion, it produces incorrect kinematics which are different to the "Results" motion. So far, I have had to select the "Results" motion and click "save as" so I can correctly reproduce the kinematics at a later time.

Is this clear? Do you think you could try one more time to see if this same problem can be reproduced on your end? I am now trying to do a states analysis (using statesReporter) and am getting similar problems so it would great to get to the bottom of it.

Thanks alot
Tom

User avatar
Tom Lintern
Posts: 61
Joined: Mon Dec 13, 2010 5:43 pm

Re: Inconsistent ik motion files with cmd line and gui

Post by Tom Lintern » Mon Jun 18, 2012 3:38 pm

I have solved my problem :D

The bug was due to including a freejoint between the base and the ground. It introduced some "unnamed states" into the system. To overcome this, I replaced the free joint with a custom joint with 6 dof.

Cheers
Tom

POST REPLY