Easy way to create Task.xml and Actuators.xml for a model

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by jimmy d » Wed Sep 25, 2019 8:03 am

Hi, Ke-

The code I posted above was using the latest development version of OpenSim, so I didn't have your issue. I went back and tested the 4.0 version and saw the issue that you are describing. We obviously didn't catch this bug when we released, but it was subsequently fixed during a different overhaul.

As of now, you won't be able to construct a ForceSet from a force set file (.xml) in Matlab. One workaround you could do is to modify the createActuatorsFile.m file so it returns a ForceSet object (as well as printing to file). I have attached a version of the Matlab function that does that. You could then make modifications to the ForceSet object in memory and re-print.

Code: Select all

% Construct a ForceSet object from a Model. 
forceset = createActuatorsFile_ReturnForceSet(path2Model)

% Make modifications to the ForceSet
...

% Write to file
forceset.print('path2writeFile.xml')
Again, this bug has seemed to be fixed in 4.1, which will be released soon.

Thanks,
-J
Attachments
createActuatorsFile_ReturnForceSet.m.zip
(3.13 KiB) Downloaded 75 times

Tags:

User avatar
Ke Song
Posts: 5
Joined: Wed Apr 13, 2016 2:11 pm

Re: Easy way to create Task.xml and Actuators.xml for a model

Post by Ke Song » Wed Sep 25, 2019 8:56 am

Thank you for explaining this and the suggested workaround, very appreciated! - Ke

POST REPLY